LLVM  11.0.0git
Classes | Public Member Functions | Static Public Member Functions | List of all members
llvm::ValueLatticeElement Class Reference

#include "llvm/Analysis/ValueLattice.h"

Collaboration diagram for llvm::ValueLatticeElement:
Collaboration graph
[legend]

Classes

struct  MergeOptions
 Struct to control some aspects related to merging constant ranges. More...
 

Public Member Functions

 ValueLatticeElement ()
 
 ~ValueLatticeElement ()
 
 ValueLatticeElement (const ValueLatticeElement &Other)
 
 ValueLatticeElement (ValueLatticeElement &&Other)
 
ValueLatticeElementoperator= (const ValueLatticeElement &Other)
 
ValueLatticeElementoperator= (ValueLatticeElement &&Other)
 
bool isUndef () const
 
bool isUnknown () const
 
bool isUnknownOrUndef () const
 
bool isConstant () const
 
bool isNotConstant () const
 
bool isConstantRangeIncludingUndef () const
 
bool isConstantRange (bool UndefAllowed=true) const
 Returns true if this value is a constant range. More...
 
bool isOverdefined () const
 
ConstantgetConstant () const
 
ConstantgetNotConstant () const
 
const ConstantRangegetConstantRange (bool UndefAllowed=true) const
 Returns the constant range for this value. More...
 
Optional< APIntasConstantInteger () const
 
bool markOverdefined ()
 
bool markUndef ()
 
bool markConstant (Constant *V, bool MayIncludeUndef=false)
 
bool markNotConstant (Constant *V)
 
bool markConstantRange (ConstantRange NewR, MergeOptions Opts=MergeOptions())
 Mark the object as constant range with NewR. More...
 
bool mergeIn (const ValueLatticeElement &RHS, MergeOptions Opts=MergeOptions())
 Updates this object to approximate both this object and RHS. More...
 
ConstantgetCompare (CmpInst::Predicate Pred, Type *Ty, const ValueLatticeElement &Other) const
 true, false or undef constants, or nullptr if the comparison cannot be evaluated. More...
 
unsigned getNumRangeExtensions () const
 
void setNumRangeExtensions (unsigned N)
 

Static Public Member Functions

static ValueLatticeElement get (Constant *C)
 
static ValueLatticeElement getNot (Constant *C)
 
static ValueLatticeElement getRange (ConstantRange CR, bool MayIncludeUndef=false)
 
static ValueLatticeElement getOverdefined ()
 

Detailed Description

Definition at line 26 of file ValueLattice.h.

Constructor & Destructor Documentation

◆ ValueLatticeElement() [1/3]

llvm::ValueLatticeElement::ValueLatticeElement ( )
inline

Definition at line 145 of file ValueLattice.h.

Referenced by operator=().

◆ ~ValueLatticeElement()

llvm::ValueLatticeElement::~ValueLatticeElement ( )
inline

Definition at line 147 of file ValueLattice.h.

◆ ValueLatticeElement() [2/3]

llvm::ValueLatticeElement::ValueLatticeElement ( const ValueLatticeElement Other)
inline

Definition at line 149 of file ValueLattice.h.

References ConstVal, and Range.

◆ ValueLatticeElement() [3/3]

llvm::ValueLatticeElement::ValueLatticeElement ( ValueLatticeElement &&  Other)
inline

Definition at line 168 of file ValueLattice.h.

References ConstVal, llvm::Other, and Range.

Member Function Documentation

◆ asConstantInteger()

Optional<APInt> llvm::ValueLatticeElement::asConstantInteger ( ) const
inline

◆ get()

static ValueLatticeElement llvm::ValueLatticeElement::get ( Constant C)
inlinestatic

Definition at line 200 of file ValueLattice.h.

References C, markConstant(), and markUndef().

Referenced by getEdgeValueLocal(), and getValueFromICmpCondition().

◆ getCompare()

Constant* llvm::ValueLatticeElement::getCompare ( CmpInst::Predicate  Pred,
Type Ty,
const ValueLatticeElement Other 
) const
inline

◆ getConstant()

Constant* llvm::ValueLatticeElement::getConstant ( ) const
inline

◆ getConstantRange()

const ConstantRange& llvm::ValueLatticeElement::getConstantRange ( bool  UndefAllowed = true) const
inline

Returns the constant range for this value.

Use UndefAllowed to exclude non-singleton constant ranges that may also be undef. Note that this function also returns a range if the range may include undef, but only contains a single element. In that case, it can be replaced by a constant.

Definition at line 269 of file ValueLattice.h.

References assert(), isConstantRange(), and Range.

Referenced by asConstantInteger(), getCompare(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), getEdgeValueLocal(), getMaxWidenStepsOpts(), getPredicateResult(), hasSingleValue(), intersect(), isObjectDereferencedInBlock(), markConstantRange(), mergeIn(), llvm::operator<<(), and simplifyInstsInBlock().

◆ getNot()

static ValueLatticeElement llvm::ValueLatticeElement::getNot ( Constant C)
inlinestatic

◆ getNotConstant()

Constant* llvm::ValueLatticeElement::getNotConstant ( ) const
inline

Definition at line 260 of file ValueLattice.h.

References assert(), ConstVal, and isNotConstant().

Referenced by getPredicateResult(), markNotConstant(), mergeIn(), and llvm::operator<<().

◆ getNumRangeExtensions()

unsigned llvm::ValueLatticeElement::getNumRangeExtensions ( ) const
inline

Definition at line 476 of file ValueLattice.h.

Referenced by getMaxWidenStepsOpts().

◆ getOverdefined()

static ValueLatticeElement llvm::ValueLatticeElement::getOverdefined ( )
inlinestatic

◆ getRange()

static ValueLatticeElement llvm::ValueLatticeElement::getRange ( ConstantRange  CR,
bool  MayIncludeUndef = false 
)
inlinestatic

◆ isConstant()

bool llvm::ValueLatticeElement::isConstant ( ) const
inline

◆ isConstantRange()

bool llvm::ValueLatticeElement::isConstantRange ( bool  UndefAllowed = true) const
inline

Returns true if this value is a constant range.

Use UndefAllowed to exclude non-singleton constant ranges that may also be undef. Note that this function also returns true if the range may include undef, but only contains a single element. In that case, it can be replaced by a constant.

Definition at line 249 of file ValueLattice.h.

References llvm::ConstantRange::isSingleElement(), and Range.

Referenced by asConstantInteger(), getCompare(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), getMaxWidenStepsOpts(), getPredicateResult(), hasSingleValue(), intersect(), isObjectDereferencedInBlock(), markConstantRange(), mergeIn(), llvm::operator<<(), and simplifyInstsInBlock().

◆ isConstantRangeIncludingUndef()

bool llvm::ValueLatticeElement::isConstantRangeIncludingUndef ( ) const
inline

◆ isNotConstant()

bool llvm::ValueLatticeElement::isNotConstant ( ) const
inline

◆ isOverdefined()

bool llvm::ValueLatticeElement::isOverdefined ( ) const
inline

◆ isUndef()

bool llvm::ValueLatticeElement::isUndef ( ) const
inline

Definition at line 237 of file ValueLattice.h.

Referenced by markConstant(), markConstantRange(), markUndef(), mergeIn(), and llvm::operator<<().

◆ isUnknown()

bool llvm::ValueLatticeElement::isUnknown ( ) const
inline

◆ isUnknownOrUndef()

bool llvm::ValueLatticeElement::isUnknownOrUndef ( ) const
inline

Definition at line 239 of file ValueLattice.h.

Referenced by getCompare(), and getMaxWidenStepsOpts().

◆ markConstant()

bool llvm::ValueLatticeElement::markConstant ( Constant V,
bool  MayIncludeUndef = false 
)
inline

◆ markConstantRange()

bool llvm::ValueLatticeElement::markConstantRange ( ConstantRange  NewR,
MergeOptions  Opts = MergeOptions() 
)
inline

Mark the object as constant range with NewR.

If the object is already a constant range, nothing changes if the existing range is equal to NewR and the tag. Otherwise NewR must be a superset of the existing range or the object must be undef. The tag is set to constant_range_including_undef if either the existing value or the new range may include undef.

Definition at line 347 of file ValueLattice.h.

References assert(), llvm::ConstantRange::contains(), getConstantRange(), isConstantRange(), isConstantRangeIncludingUndef(), llvm::ConstantRange::isEmptySet(), llvm::ConstantRange::isFullSet(), isUndef(), isUnknown(), markOverdefined(), and Range.

Referenced by getRange(), markConstant(), markNotConstant(), and mergeIn().

◆ markNotConstant()

bool llvm::ValueLatticeElement::markNotConstant ( Constant V)
inline

Definition at line 321 of file ValueLattice.h.

References assert(), ConstVal, getNotConstant(), isNotConstant(), isUnknown(), and markConstantRange().

Referenced by getNot().

◆ markOverdefined()

bool llvm::ValueLatticeElement::markOverdefined ( )
inline

Definition at line 284 of file ValueLattice.h.

References isOverdefined().

Referenced by getMaxWidenStepsOpts(), getOverdefined(), markConstantRange(), and mergeIn().

◆ markUndef()

bool llvm::ValueLatticeElement::markUndef ( )
inline

Definition at line 292 of file ValueLattice.h.

References assert(), isUndef(), and isUnknown().

Referenced by get(), getRange(), and markConstant().

◆ mergeIn()

bool llvm::ValueLatticeElement::mergeIn ( const ValueLatticeElement RHS,
MergeOptions  Opts = MergeOptions() 
)
inline

◆ operator=() [1/2]

ValueLatticeElement& llvm::ValueLatticeElement::operator= ( const ValueLatticeElement Other)
inline

Definition at line 188 of file ValueLattice.h.

References ValueLatticeElement().

◆ operator=() [2/2]

ValueLatticeElement& llvm::ValueLatticeElement::operator= ( ValueLatticeElement &&  Other)
inline

Definition at line 194 of file ValueLattice.h.

References llvm::Other, and ValueLatticeElement().

◆ setNumRangeExtensions()

void llvm::ValueLatticeElement::setNumRangeExtensions ( unsigned  N)
inline

Definition at line 477 of file ValueLattice.h.

References N, and llvm::operator<<().

Referenced by getMaxWidenStepsOpts().

Member Data Documentation

◆ ConstVal

Constant* llvm::ValueLatticeElement::ConstVal

◆ Range

ConstantRange llvm::ValueLatticeElement::Range

The documentation for this class was generated from the following file: