LLVM API Documentation
#include "llvm/Analysis/Passes.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/AssumptionTracker.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/CaptureTracking.h"
#include "llvm/Analysis/InstructionSimplify.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/MemoryBuiltins.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Operator.h"
#include "llvm/Pass.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetLibraryInfo.h"
#include <algorithm>
#include "llvm/IR/Intrinsics.gen"
Go to the source code of this file.
#define GET_INTRINSIC_MODREF_BEHAVIOR |
enum ExtensionKind |
Definition at line 165 of file BasicAliasAnalysis.cpp.
Basic Alias Analysis | ( | stateless AA | impl | ) |
static const Value* DecomposeGEPExpression | ( | const Value * | V, |
int64_t & | BaseOffs, | ||
SmallVectorImpl< VariableGEPIndex > & | VarIndices, | ||
bool & | MaxLookupReached, | ||
const DataLayout * | DL, | ||
AssumptionTracker * | AT, | ||
DominatorTree * | DT | ||
) | [static] |
DecomposeGEPExpression - If V is a symbolic pointer expression, decompose it into a base pointer with a constant offset and a number of scaled symbolic offsets.
The scaled symbolic offsets (represented by pairs of a Value* and a scale in the VarIndices vector) are Value*'s that are known to be scaled by the specified amount, but which may have other unrepresented high bits. As such, the gep cannot necessarily be reconstructed from its decomposed form.
When DataLayout is around, this function is capable of analyzing everything that GetUnderlyingObject can look through. To be able to do that GetUnderlyingObject and DecomposeGEPExpression must use the same search depth (MaxLookupSearchDepth). When DataLayout not is around, it just looks through pointer casts.
Definition at line 283 of file BasicAliasAnalysis.cpp.
References llvm::AddrSpaceCast, llvm::SmallVectorTemplateCommon< T >::begin(), llvm::dyn_cast(), llvm::SmallVectorImpl< T >::erase(), llvm::gep_type_begin(), llvm::StructLayout::getElementOffset(), llvm::Type::getIntegerBitWidth(), GetLinearExpression(), llvm::Operator::getOpcode(), llvm::User::getOperand(), llvm::GEPOperator::getPointerAddressSpace(), llvm::Type::getPointerElementType(), llvm::DataLayout::getPointerSizeInBits(), llvm::APInt::getSExtValue(), llvm::DataLayout::getStructLayout(), llvm::Value::getType(), llvm::DataLayout::getTypeAllocSize(), llvm::GEPOperator::hasAllZeroIndices(), I, llvm::Type::isSized(), MaxLookupSearchDepth, llvm::User::op_begin(), llvm::User::op_end(), llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::JumpTable::Simplified, llvm::SimplifyInstruction(), and llvm::SmallVectorTemplateCommon< T >::size().
static Value* GetLinearExpression | ( | Value * | V, |
APInt & | Scale, | ||
APInt & | Offset, | ||
ExtensionKind & | Extension, | ||
const DataLayout & | DL, | ||
unsigned | Depth, | ||
AssumptionTracker * | AT, | ||
DominatorTree * | DT | ||
) | [static] |
GetLinearExpression - Analyze the specified value as a linear expression: "A*V + B", where A and B are constant integers. Return the scale and offset values as APInts and return V as a Value*, and return whether we looked through any sign or zero extends. The incoming Value is known to have IntegerType and it may already be sign or zero extended.
Note that this looks through extends, so the high bits may not be represented in the result.
Definition at line 196 of file BasicAliasAnalysis.cpp.
References llvm::APInt::getBitWidth(), llvm::APInt::getLimitedValue(), llvm::Type::getPrimitiveSizeInBits(), llvm::Value::getType(), llvm::Type::isIntegerTy(), llvm::MaskedValueIsZero(), llvm::APIntOps::Or(), llvm::APInt::trunc(), and llvm::APInt::zext().
Referenced by DecomposeGEPExpression().
static uint64_t getObjectSize | ( | const Value * | V, |
const DataLayout & | DL, | ||
const TargetLibraryInfo & | TLI, | ||
bool | RoundToAlign = false |
||
) | [static] |
getObjectSize - Return the size of the object specified by V, or UnknownSize if unknown.
Definition at line 102 of file BasicAliasAnalysis.cpp.
References llvm::getObjectSize(), and llvm::AliasAnalysis::UnknownSize.
Definition at line 427 of file BasicAliasAnalysis.cpp.
References llvm::GlobalValue::getParent().
Referenced by llvm::FastISel::canFoldAddIntoGEP(), llvm::LiveVariables::VarInfo::findKill(), llvm::RegionBase< Tr >::getDepth(), llvm::FastISel::hasTrivialKill(), LLVMGetBasicBlockParent(), LLVMGetGlobalParent(), LLVMGetInstructionParent(), LLVMGetParamParent(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::PHITransAddr::NeedsPHITranslationFromBlock(), notDifferentParent(), llvm::RNSuccIterator< NodeType, BlockT, RegionT >::operator=(), redirectValuesFromPredecessorsToPhi(), and llvm::LoopBase< BlockT, LoopT >::verifyLoop().
INITIALIZE_AG_PASS_BEGIN | ( | BasicAliasAnalysis | , |
AliasAnalysis | , | ||
"basicaa" | , | ||
"Basic Alias Analysis (stateless AA impl)" | , | ||
false | , | ||
true | , | ||
false | |||
) |
static bool isAssumeIntrinsic | ( | ImmutableCallSite | CS | ) | [static] |
Definition at line 798 of file BasicAliasAnalysis.cpp.
References llvm::dyn_cast(), llvm::CallSiteBase< FunTy, ValTy, UserTy, InstrTy, CallTy, InvokeTy, IterTy >::getInstruction(), and llvm::IntrinsicInst::getIntrinsicID().
static bool isEscapeSource | ( | const Value * | V | ) | [static] |
isEscapeSource - Return true if the pointer is one which would have been considered an escape by isNonEscapingLocalObject.
Definition at line 87 of file BasicAliasAnalysis.cpp.
static bool isMemsetPattern16 | ( | const Function * | MS, |
const TargetLibraryInfo & | TLI | ||
) | [static] |
static bool isNonEscapingLocalObject | ( | const Value * | V | ) | [static] |
isNonEscapingLocalObject - Return true if the pointer is to a function-local object that never escapes from the function.
Definition at line 62 of file BasicAliasAnalysis.cpp.
References llvm::ARM_PROC::A, llvm::isNoAliasCall(), and llvm::PointerMayBeCaptured().
static bool isObjectSize | ( | const Value * | V, |
uint64_t | Size, | ||
const DataLayout & | DL, | ||
const TargetLibraryInfo & | TLI | ||
) | [static] |
isObjectSize - Return true if we can prove that the object specified by V has size Size.
Definition at line 154 of file BasicAliasAnalysis.cpp.
References llvm::getObjectSize(), and llvm::AliasAnalysis::UnknownSize.
static bool isObjectSmallerThan | ( | const Value * | V, |
uint64_t | Size, | ||
const DataLayout & | DL, | ||
const TargetLibraryInfo & | TLI | ||
) | [static] |
isObjectSmallerThan - Return true if we can prove that the object specified by V is smaller than Size.
Definition at line 113 of file BasicAliasAnalysis.cpp.
References llvm::getObjectSize(), llvm::isIdentifiedObject(), and llvm::AliasAnalysis::UnknownSize.
static AliasAnalysis::AliasResult MergeAliasResults | ( | AliasAnalysis::AliasResult | A, |
AliasAnalysis::AliasResult | B | ||
) | [static] |
Definition at line 1082 of file BasicAliasAnalysis.cpp.
References llvm::ARM_PROC::A, llvm::AliasAnalysis::MayAlias, llvm::AliasAnalysis::MustAlias, and llvm::AliasAnalysis::PartialAlias.
Definition at line 437 of file BasicAliasAnalysis.cpp.
References getParent().
Definition at line 585 of file BasicAliasAnalysis.cpp.
Definition at line 585 of file BasicAliasAnalysis.cpp.
Basic Alias false |
Definition at line 587 of file BasicAliasAnalysis.cpp.
const unsigned MaxLookupSearchDepth = 6 [static] |
Definition at line 54 of file BasicAliasAnalysis.cpp.
Referenced by DecomposeGEPExpression().
Cutoff after which to stop analysing a set of phi nodes potentially involved in a cycle. Because we are analysing 'through' phi nodes we need to be careful with value equivalence. We use reachability to make sure a value cannot be involved in a cycle.
Definition at line 49 of file BasicAliasAnalysis.cpp.
Basic Alias true |
Definition at line 587 of file BasicAliasAnalysis.cpp.