LLVM API Documentation
#include <AliasAnalysis.h>
Definition at line 46 of file AliasAnalysis.h.
Alias Queries... Alias analysis result - Either we know for sure that it does not alias, we know for sure it must alias, or we don't know anything: The two pointers _might_ alias. This enum is designed so you can do things like: if (AA.alias(P1, P2)) { ... } to check to see if two pointers might alias.
Definition at line 87 of file AliasAnalysis.h.
Simple mod/ref information... ModRefResult - Represent the result of a mod/ref query. Mod and Ref are bits which may be or'd together.
Definition at line 118 of file AliasAnalysis.h.
ModRefBehavior - Summary of how a function affects memory in the program. Loads from constant globals are not considered memory accesses for this interface. Also, functions may freely modify stack space local to their invocation without having to report it through these interfaces.
| DoesNotAccessMemory | |
| AccessesArguments | |
| AccessesArgumentsAndGlobals | |
| OnlyReadsMemory | |
| UnknownModRefBehavior |
Definition at line 125 of file AliasAnalysis.h.
| llvm::AliasAnalysis::AliasAnalysis | ( | ) | [inline] |
Definition at line 64 of file AliasAnalysis.h.
| AliasAnalysis::~AliasAnalysis | ( | ) | [virtual] |
Definition at line 174 of file AliasAnalysis.cpp.
| void AliasAnalysis::InitializeAliasAnalysis | ( | Pass * | P | ) | [protected] |
InitializeAliasAnalysis - Subclasses must call this method to initialize the AliasAnalysis interface before any other methods are called. This is typically called by the run* methods of these subclasses. This may be called multiple times.
InitializeAliasAnalysis - Subclasses must call this method to initialize the AliasAnalysis interface before any other methods are called.
Definition at line 179 of file AliasAnalysis.cpp.
References AA, llvm::Pass::getAnalysis(), llvm::Pass::getAnalysisIfAvailable(), and TD.
Referenced by llvm::LibCallAliasAnalysis::runOnFunction().
| void AliasAnalysis::getAnalysisUsage | ( | AnalysisUsage & | AU | ) | const [protected, virtual] |
getAnalysisUsage - All alias analysis implementations should invoke this directly (using AliasAnalysis::getAnalysisUsage(AU)).
Reimplemented in llvm::LibCallAliasAnalysis.
Definition at line 186 of file AliasAnalysis.cpp.
References llvm::AnalysisUsage::addRequired().
Referenced by llvm::LibCallAliasAnalysis::getAnalysisUsage().
| const TargetData* llvm::AliasAnalysis::getTargetData | ( | ) | const [inline] |
getTargetData - Return a pointer to the current TargetData object, or null if no TargetData object is available.
Definition at line 70 of file AliasAnalysis.h.
References TD.
getTypeStoreSize - Return the TargetData store size for the given type, if known, or a conservative value otherwise.
getTypeStoreSize - Return the TargetData store size for the given type, if known, or a conservative value otherwise.
Definition at line 193 of file AliasAnalysis.cpp.
References llvm::TargetData::getTypeStoreSize(), and TD.
Referenced by llvm::AliasSetTracker::add(), llvm::FindAvailableLoadedValue(), llvm::MemoryDependenceAnalysis::getDependency(), getModRefInfo(), llvm::MemoryDependenceAnalysis::getNonLocalPointerDependency(), llvm::AliasSetTracker::remove(), and UnderlyingObjectsAlias().
| AliasAnalysis::AliasResult AliasAnalysis::alias | ( | const Value * | V1, | |
| unsigned | V1Size, | |||
| const Value * | V2, | |||
| unsigned | V2Size | |||
| ) | [virtual] |
alias - The main low level interface to the alias analysis implementation. Returns a Result indicating whether the two pointers are aliased to each other. This is the interface that must be implemented by specific alias analysis implementations.
Definition at line 46 of file AliasAnalysis.cpp.
Referenced by alias(), getModRefInfo(), llvm::AliasSet::mergeSetIn(), and UnderlyingObjectsAlias().
getMustAliases - If there are any pointers known that must alias this pointer, return them now. This allows alias-set based alias analyses to perform a form a value numbering (which is exposed by load-vn). If an alias analysis supports this, it should ADD any must aliased pointers to the specified vector.
Definition at line 52 of file AliasAnalysis.cpp.
References AA, and getMustAliases().
Referenced by getMustAliases().
pointsToConstantMemory - If the specified pointer is known to point into constant global memory, return true. This allows disambiguation of store instructions from constant pointers.
Definition at line 57 of file AliasAnalysis.cpp.
References AA, and pointsToConstantMemory().
Referenced by getModRefInfo(), and pointsToConstantMemory().
| AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior | ( | CallSite | CS, | |
| std::vector< PointerAccessInfo > * | Info = 0 | |||
| ) | [virtual] |
getModRefBehavior - Return the behavior when calling the given call site.
Definition at line 109 of file AliasAnalysis.cpp.
References llvm::CallSite::doesNotAccessMemory(), DoesNotAccessMemory, llvm::CallSite::getCalledFunction(), OnlyReadsMemory, and llvm::CallSite::onlyReadsMemory().
Referenced by doesNotAccessMemory(), getModRefInfo(), and onlyReadsMemory().
| AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior | ( | Function * | F, | |
| std::vector< PointerAccessInfo > * | Info = 0 | |||
| ) | [virtual] |
getModRefBehavior - Return the behavior when calling the given function. For use when the call site is not known.
Definition at line 121 of file AliasAnalysis.cpp.
References llvm::Function::doesNotAccessMemory(), DoesNotAccessMemory, llvm::Function::getIntrinsicID(), llvm::Function::onlyReadsMemory(), OnlyReadsMemory, and UnknownModRefBehavior.
doesNotAccessMemory - If the specified call is known to never read or write memory, return true. If the call only reads from known-constant memory, it is also legal to return true. Calls that unwind the stack are legal for this predicate.
Many optimizations (such as CSE and LICM) can be performed on such calls without worrying about aliasing properties, and many calls have this property (e.g. calls to 'sin' and 'cos').
This property corresponds to the GCC 'const' attribute.
Definition at line 212 of file AliasAnalysis.h.
References DoesNotAccessMemory, and getModRefBehavior().
Referenced by llvm::AliasSetTracker::add(), llvm::AliasSetTracker::deleteValue(), and llvm::AliasSetTracker::remove().
doesNotAccessMemory - If the specified function is known to never read or write memory, return true. For use when the call site is not known.
Definition at line 219 of file AliasAnalysis.h.
References DoesNotAccessMemory, and getModRefBehavior().
onlyReadsMemory - If the specified call is known to only read from non-volatile memory (or not access memory at all), return true. Calls that unwind the stack are legal for this predicate.
This property allows many common optimizations to be performed in the absence of interfering store instructions, such as CSE of strlen calls.
This property corresponds to the GCC 'pure' attribute.
Definition at line 232 of file AliasAnalysis.h.
References DoesNotAccessMemory, getModRefBehavior(), and OnlyReadsMemory.
Referenced by llvm::MemoryDependenceAnalysis::getDependency(), and llvm::MemoryDependenceAnalysis::getNonLocalCallDependency().
onlyReadsMemory - If the specified function is known to only read from non-volatile memory (or not access memory at all), return true. For use when the call site is not known.
Definition at line 241 of file AliasAnalysis.h.
References DoesNotAccessMemory, getModRefBehavior(), and OnlyReadsMemory.
| AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo | ( | CallSite | CS, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) | [virtual] |
getModRefInfo - Return information about whether or not an instruction may read or write memory specified by the pointer operand. An instruction that doesn't read or write memory may be trivially LICM'd for example. getModRefInfo (for call sites) - Return whether information about whether a particular call site modifies or reads the memory specified by the pointer.
Reimplemented in llvm::LibCallAliasAnalysis.
Definition at line 139 of file AliasAnalysis.cpp.
References AA, AccessesArguments, AI, alias(), llvm::CallSite::arg_begin(), llvm::CallSite::arg_end(), DoesNotAccessMemory, getModRefBehavior(), getModRefInfo(), Mod, ModRef, NoAlias, NoModRef, OnlyReadsMemory, pointsToConstantMemory(), and Ref.
Referenced by canInstructionRangeModify(), llvm::FindAvailableLoadedValue(), llvm::LibCallAliasAnalysis::getModRefInfo(), and getModRefInfo().
| AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo | ( | CallSite | CS1, | |
| CallSite | CS2 | |||
| ) | [virtual] |
getModRefInfo - Return information about whether two call sites may refer to the same set of memory locations. This function returns NoModRef if the two calls refer to disjoint memory locations, Ref if CS1 reads memory written by CS2, Mod if CS1 writes to memory read or written by CS2, or ModRef if CS1 might read or write memory accessed by CS2.
Reimplemented in llvm::LibCallAliasAnalysis.
Definition at line 78 of file AliasAnalysis.cpp.
References AA, and getModRefInfo().
| bool AliasAnalysis::hasNoModRefInfoForCalls | ( | ) | const [virtual] |
hasNoModRefInfoForCalls - Return true if the analysis has no mod/ref information for pairs of function calls (other than "pure" and "const" functions). This can be used by clients to avoid many pointless queries. Remember that if you override this and chain to another analysis, you must make sure that it doesn't have mod/ref info either.
Reimplemented in llvm::LibCallAliasAnalysis.
Definition at line 62 of file AliasAnalysis.cpp.
References AA, and hasNoModRefInfoForCalls().
Referenced by hasNoModRefInfoForCalls().
| AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo | ( | LoadInst * | L, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) |
Convenience functions...
Definition at line 90 of file AliasAnalysis.cpp.
References alias(), llvm::User::getOperand(), llvm::Value::getType(), getTypeStoreSize(), NoModRef, and Ref.
| AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo | ( | StoreInst * | S, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) |
Definition at line 96 of file AliasAnalysis.cpp.
References alias(), llvm::User::getOperand(), llvm::Value::getType(), getTypeStoreSize(), Mod, NoModRef, and pointsToConstantMemory().
| ModRefResult llvm::AliasAnalysis::getModRefInfo | ( | CallInst * | C, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) | [inline] |
| ModRefResult llvm::AliasAnalysis::getModRefInfo | ( | InvokeInst * | I, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) | [inline] |
| ModRefResult llvm::AliasAnalysis::getModRefInfo | ( | VAArgInst * | I, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) | [inline] |
| ModRefResult llvm::AliasAnalysis::getModRefInfo | ( | Instruction * | I, | |
| Value * | P, | |||
| unsigned | Size | |||
| ) | [inline] |
Definition at line 286 of file AliasAnalysis.h.
References Call, getModRefInfo(), llvm::Instruction::getOpcode(), Load, NoModRef, llvm::SPII::Store, and VAArg.
| bool AliasAnalysis::canBasicBlockModify | ( | const BasicBlock & | BB, | |
| const Value * | Ptr, | |||
| unsigned | Size | |||
| ) |
Higher level methods for querying mod/ref information. canBasicBlockModify - Return true if it is possible for execution of the specified basic block to modify the value pointed to by Ptr.
canBasicBlockModify - Return true if it is possible for execution of the specified basic block to modify the value pointed to by Ptr.
Definition at line 200 of file AliasAnalysis.cpp.
References llvm::BasicBlock::back(), canInstructionRangeModify(), and llvm::BasicBlock::front().
| bool AliasAnalysis::canInstructionRangeModify | ( | const Instruction & | I1, | |
| const Instruction & | I2, | |||
| const Value * | Ptr, | |||
| unsigned | Size | |||
| ) |
canInstructionRangeModify - Return true if it is possible for the execution of the specified instructions to modify the value pointed to by Ptr. The instructions to consider are all of the instructions in the range of [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
canInstructionRangeModify - Return true if it is possible for the execution of the specified instructions to modify the value pointed to by Ptr. The instructions to consider are all of the instructions in the range of [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
Definition at line 210 of file AliasAnalysis.cpp.
References E, getModRefInfo(), llvm::Instruction::getParent(), and Mod.
Referenced by canBasicBlockModify().
| void AliasAnalysis::deleteValue | ( | Value * | V | ) | [virtual] |
Methods that clients should call when they transform the program to allow alias analyses to update their internal data structures. Note that these methods may be called on any instruction, regardless of whether or not they have pointer-analysis implications. deleteValue - This method should be called whenever an LLVM Value is deleted from the program, for example when an instruction is found to be redundant and is eliminated.
Definition at line 67 of file AliasAnalysis.cpp.
References AA, and deleteValue().
Referenced by llvm::AliasSetTracker::deleteValue(), deleteValue(), FindPHIToPartitionLoops(), llvm::MemoryDependenceAnalysis::removeInstruction(), replaceWithNewValue(), and llvm::SplitBlockPredecessors().
copyValue - This method should be used whenever a preexisting value in the program is copied or cloned, introducing a new value. Note that analysis implementations should tolerate clients that use this method to introduce the same value multiple times: if the analysis already knows about a value, it should ignore the request.
Definition at line 72 of file AliasAnalysis.cpp.
References AA, and copyValue().
Referenced by copyValue(), llvm::AliasSetTracker::copyValue(), replaceWithNewValue(), and llvm::SplitBlockPredecessors().
replaceWithNewValue - This method is the obvious combination of the two above, and it provided as a helper to simplify client code.
Definition at line 338 of file AliasAnalysis.h.
References copyValue(), and deleteValue().
const TargetData* llvm::AliasAnalysis::TD [protected] |
Definition at line 48 of file AliasAnalysis.h.
Referenced by getTargetData(), getTypeStoreSize(), and InitializeAliasAnalysis().
AliasAnalysis* llvm::AliasAnalysis::AA [protected] |
Definition at line 49 of file AliasAnalysis.h.
Referenced by alias(), copyValue(), deleteValue(), getModRefInfo(), getMustAliases(), hasNoModRefInfoForCalls(), InitializeAliasAnalysis(), and pointsToConstantMemory().
char AliasAnalysis::ID = 0 [static] |