]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/llvm/lib/Analysis/ValueLattice.cpp
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / llvm / lib / Analysis / ValueLattice.cpp
1 //===- ValueLattice.cpp - Value constraint analysis -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 #include "llvm/Analysis/ValueLattice.h"
10
11 namespace llvm {
12 raw_ostream &operator<<(raw_ostream &OS, const ValueLatticeElement &Val) {
13   if (Val.isUnknown())
14     return OS << "unknown";
15   if (Val.isUndef())
16     return OS << "undef";
17   if (Val.isOverdefined())
18     return OS << "overdefined";
19
20   if (Val.isNotConstant())
21     return OS << "notconstant<" << *Val.getNotConstant() << ">";
22   if (Val.isConstantRange())
23     return OS << "constantrange<" << Val.getConstantRange().getLower() << ", "
24               << Val.getConstantRange().getUpper() << ">";
25   return OS << "constant<" << *Val.getConstant() << ">";
26 }
27 } // end namespace llvm