|
LLVM
5.0.0
|
#include "llvm/Analysis/LazyValueInfo.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Analysis/AssumptionCache.h"#include "llvm/Analysis/ConstantFolding.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/IR/AssemblyAnnotationWriter.h"#include "llvm/IR/CFG.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/Dominators.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/PatternMatch.h"#include "llvm/IR/ValueHandle.h"#include "llvm/Support/Debug.h"#include "llvm/Support/FormattedStream.h"#include "llvm/Support/raw_ostream.h"#include <map>#include <stack>Go to the source code of this file.
Namespaces | |
| llvm | |
| Compute iterated dominance frontiers using a linear time algorithm. | |
Macros | |
| #define | DEBUG_TYPE "lazy-value-info" |
Functions | |
| INITIALIZE_PASS_BEGIN (LazyValueInfoWrapperPass,"lazy-value-info","Lazy Value Information Analysis", false, true) INITIALIZE_PASS_END(LazyValueInfoWrapperPass | |
| FunctionPass * | llvm::createLazyValueInfoPass () |
| createLazyValueInfoPass - This creates an instance of the LazyValueInfo pass. More... | |
| raw_ostream & | llvm::operator<< (raw_ostream &OS, const LVILatticeVal &Val) LLVM_ATTRIBUTE_USED |
| static bool | hasSingleValue (const LVILatticeVal &Val) |
| Returns true if this lattice value represents at most one possible value. More... | |
| static LVILatticeVal | intersect (const LVILatticeVal &A, const LVILatticeVal &B) |
| Combine two sets of facts about the same value into a single set of facts. More... | |
| static LVILatticeVal | getFromRangeMetadata (Instruction *BBI) |
| static bool | InstructionDereferencesPointer (Instruction *I, Value *Ptr) |
| static bool | isObjectDereferencedInBlock (Value *Val, BasicBlock *BB) |
| Return true if the allocation associated with Val is ever dereferenced within the given basic block. More... | |
| static LVILatticeVal | getValueFromCondition (Value *Val, Value *Cond, bool isTrueDest=true) |
| static LVILatticeVal | getValueFromICmpCondition (Value *Val, ICmpInst *ICI, bool isTrueDest) |
| static LVILatticeVal | getValueFromCondition (Value *Val, Value *Cond, bool isTrueDest, DenseMap< Value *, LVILatticeVal > &Visited) |
| static LVILatticeVal | getValueFromConditionImpl (Value *Val, Value *Cond, bool isTrueDest, DenseMap< Value *, LVILatticeVal > &Visited) |
| static bool | getEdgeValueLocal (Value *Val, BasicBlock *BBFrom, BasicBlock *BBTo, LVILatticeVal &Result) |
| Compute the value of Val on the edge BBFrom -> BBTo. More... | |
| static LazyValueInfoImpl & | getImpl (void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr) |
| This lazily constructs the LazyValueInfoImpl. More... | |
| static bool | isKnownNonConstant (Value *V) |
| Returns true if we can statically tell that this value will never be a "useful" constant. More... | |
| static LazyValueInfo::Tristate | getPredicateResult (unsigned Pred, Constant *C, const LVILatticeVal &Val, const DataLayout &DL, TargetLibraryInfo *TLI) |
| INITIALIZE_PASS_BEGIN (LazyValueInfoPrinter,"print-lazy-value-info","Lazy Value Info Printer Pass", false, false) INITIALIZE_PASS_END(LazyValueInfoPrinter | |
Variables | |
| static const unsigned | MaxProcessedPerValue = 500 |
| lazy value | info |
| lazy value Lazy Value Information | Analysis |
| lazy value Lazy Value Information | false |
| print lazy value Lazy Value Info Printer | Pass |
| #define DEBUG_TYPE "lazy-value-info" |
Definition at line 42 of file LazyValueInfo.cpp.
|
static |
Compute the value of Val on the edge BBFrom -> BBTo.
Returns false if Val is not constrained on the edge. Result is unspecified if return value is false.
Definition at line 1361 of file LazyValueInfo.cpp.
References assert(), llvm::ConstantRange::difference(), llvm::ConstantInt::get(), llvm::SelectInst::getCondition(), llvm::Value::getContext(), llvm::Type::getInt1Ty(), llvm::Type::getIntegerBitWidth(), llvm::BasicBlock::getTerminator(), llvm::Value::getType(), getValueFromCondition(), and llvm::ConstantRange::unionWith().
|
static |
Definition at line 750 of file LazyValueInfo.cpp.
References llvm::MCID::Call, llvm::getConstantRangeFromMetadata(), llvm::Instruction::getMetadata(), llvm::Instruction::getOpcode(), llvm::Value::getType(), llvm::SPII::Load, and llvm::LLVMContext::MD_range.
|
static |
This lazily constructs the LazyValueInfoImpl.
Definition at line 1526 of file LazyValueInfo.cpp.
References assert().
Referenced by llvm::AttributeList::addAttributes(), llvm::AttributeList::addParamAttribute(), llvm::LazyValueInfo::eraseBlock(), llvm::AttributeList::get(), llvm::ConstantArray::get(), llvm::ConstantVector::get(), llvm::MDTuple::get(), llvm::LazyValueInfo::getConstant(), llvm::LazyValueInfo::getConstantOnEdge(), llvm::LazyValueInfo::getConstantRange(), llvm::LazyValueInfo::getConstantRangeOnEdge(), llvm::MDTuple::getDistinct(), llvm::MDTuple::getIfExists(), llvm::LazyValueInfo::getPredicateAt(), llvm::LazyValueInfo::getPredicateOnEdge(), llvm::MDTuple::getTemporary(), llvm::LazyValueInfo::printLVI(), llvm::LazyValueInfo::releaseMemory(), llvm::AttributeList::removeAttributes(), llvm::LazyValueInfoWrapperPass::runOnFunction(), and llvm::LazyValueInfo::threadEdge().
|
static |
Definition at line 1683 of file LazyValueInfo.cpp.
References C, llvm::ConstantFoldCompareInstOperands(), llvm::ConstantRange::contains(), llvm::dyn_cast(), llvm::LazyValueInfo::False, llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::ConstantRange::inverse(), llvm::Constant::isNullValue(), llvm::ConstantRange::isSingleElement(), llvm::ConstantRange::makeExactICmpRegion(), llvm::LazyValueInfo::True, and llvm::LazyValueInfo::Unknown.
Referenced by llvm::LazyValueInfo::getPredicateAt(), and llvm::LazyValueInfo::getPredicateOnEdge().
Definition at line 1352 of file LazyValueInfo.cpp.
References assert().
Referenced by getEdgeValueLocal(), and getValueFromConditionImpl().
|
static |
Definition at line 1341 of file LazyValueInfo.cpp.
References llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::end(), llvm::DenseMapBase< DenseMap< KeyT, ValueT, KeyInfoT, BucketT >, KeyT, ValueT, KeyInfoT, BucketT >::find(), and getValueFromConditionImpl().
|
static |
Definition at line 1321 of file LazyValueInfo.cpp.
References llvm::dyn_cast(), llvm::BinaryOperator::getOpcode(), llvm::User::getOperand(), getValueFromCondition(), getValueFromICmpCondition(), and intersect().
Referenced by getValueFromCondition().
|
static |
Definition at line 1253 of file LazyValueInfo.cpp.
References llvm::getConstantRangeFromMetadata(), llvm::Type::getIntegerBitWidth(), llvm::CmpInst::getInversePredicate(), llvm::User::getOperand(), llvm::CmpInst::getPredicate(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::ConstantInt::getValue(), llvm::CmpInst::ICMP_EQ, llvm::ICmpInst::isEquality(), llvm::Type::isIntegerTy(), llvm::PatternMatch::m_Add(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_Specific(), llvm::ConstantRange::makeAllowedICmpRegion(), llvm::PatternMatch::match(), llvm::LLVMContext::MD_range, llvm::ConstantRange::subtract(), and std::swap().
Referenced by getValueFromConditionImpl().
Returns true if this lattice value represents at most one possible value.
This is as precise as any lattice value can get while still representing reachable code.
Definition at line 280 of file LazyValueInfo.cpp.
Referenced by intersect().
| INITIALIZE_PASS_BEGIN | ( | LazyValueInfoWrapperPass | , |
| "lazy-value-info" | , | ||
| "Lazy Value Information Analysis" | , | ||
| false | , | ||
| true | |||
| ) |
| INITIALIZE_PASS_BEGIN | ( | LazyValueInfoPrinter | , |
| "print-lazy-value-info" | , | ||
| "Lazy Value Info Printer Pass" | , | ||
| false | , | ||
| false | |||
| ) |
|
static |
Definition at line 834 of file LazyValueInfo.cpp.
References llvm::dyn_cast(), llvm::GetUnderlyingObject(), llvm::ConstantInt::isZero(), L, and MI.
Referenced by isObjectDereferencedInBlock().
Combine two sets of facts about the same value into a single set of facts.
Note that this method is not suitable for merging facts along different paths in a CFG; that's what the mergeIn function is for. This is for merging facts gathered about the same value at the same location through two independent means. Notes:
Definition at line 305 of file LazyValueInfo.cpp.
References A, and hasSingleValue().
Referenced by llvm::rdf::Liveness::computeLiveIns(), and getValueFromConditionImpl().
Returns true if we can statically tell that this value will never be a "useful" constant.
In practice, this means we've got something like an alloca or a malloc call for which a comparison against a constant can only be guarding dead code. Note that we are potentially giving up some precision in dead code (a constant result) in favour of avoiding a expensive search for a easily answered common query.
Definition at line 1598 of file LazyValueInfo.cpp.
References llvm::Value::stripPointerCasts().
Referenced by llvm::LazyValueInfo::getConstant().
|
static |
Return true if the allocation associated with Val is ever dereferenced within the given basic block.
This establishes the fact Val is not null, but does not imply that the memory at Val is dereferenceable. (Val may point off the end of the dereferenceable part of the object.)
Definition at line 869 of file LazyValueInfo.cpp.
References assert(), llvm::Module::getDataLayout(), llvm::BasicBlock::getModule(), llvm::Value::getType(), llvm::GetUnderlyingObject(), InstructionDereferencesPointer(), and llvm::Type::isPointerTy().
| lazy value Lazy Value Information Analysis |
Definition at line 53 of file LazyValueInfo.cpp.
Definition at line 53 of file LazyValueInfo.cpp.
| print lazy value info |
Definition at line 53 of file LazyValueInfo.cpp.
Referenced by findLiveReferences(), llvm::CCState::getInRegsParamInfo(), insertParsePoints(), and recomputeLiveInValues().
Definition at line 46 of file LazyValueInfo.cpp.
Definition at line 1970 of file LazyValueInfo.cpp.
Referenced by llvm::coverage::RawCoverageMappingReader::read().
1.8.6