LLVM  11.0.0git
ValueLattice.cpp
Go to the documentation of this file.
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 
10 
11 namespace llvm {
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 
24  return OS << "constantrange incl. undef <"
25  << Val.getConstantRange(true).getLower() << ", "
26  << Val.getConstantRange(true).getUpper() << ">";
27 
28  if (Val.isConstantRange())
29  return OS << "constantrange<" << Val.getConstantRange().getLower() << ", "
30  << Val.getConstantRange().getUpper() << ">";
31  return OS << "constant<" << *Val.getConstant() << ">";
32 }
33 } // end namespace llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const APInt & getUpper() const
Return the upper value for this range.
const ConstantRange & getConstantRange(bool UndefAllowed=true) const
Returns the constant range for this value.
Definition: ValueLattice.h:269
bool isConstantRange(bool UndefAllowed=true) const
Returns true if this value is a constant range.
Definition: ValueLattice.h:249
bool isConstantRangeIncludingUndef() const
Definition: ValueLattice.h:242
Constant * getConstant() const
Definition: ValueLattice.h:255
Constant * getNotConstant() const
Definition: ValueLattice.h:260
const APInt & getLower() const
Return the lower value for this range.
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
Definition: APInt.h:2099
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:46