LLVM API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
llvm::AliasAnalysis Class Reference

#include <AliasAnalysis.h>

Inheritance diagram for llvm::AliasAnalysis:
Inheritance graph
[legend]
Collaboration diagram for llvm::AliasAnalysis:
Collaboration graph
[legend]

List of all members.

Classes

struct  Location
 Location - A description of a memory location. More...

Public Types

enum  AliasResult { NoAlias = 0, MayAlias, PartialAlias, MustAlias }
enum  ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 }
enum  { Nowhere = 0, ArgumentPointees = 4, Anywhere = 8 | ArgumentPointees }
enum  ModRefBehavior {
  DoesNotAccessMemory = Nowhere | NoModRef, OnlyReadsArgumentPointees = ArgumentPointees | Ref, OnlyAccessesArgumentPointees = ArgumentPointees | ModRef, OnlyReadsMemory = Anywhere | Ref,
  UnknownModRefBehavior = Anywhere | ModRef
}

Public Member Functions

 AliasAnalysis ()
virtual ~AliasAnalysis ()
const DataLayoutgetDataLayout () const
const TargetLibraryInfogetTargetLibraryInfo () const
uint64_t getTypeStoreSize (Type *Ty)
Location getLocation (const LoadInst *LI)
Location getLocation (const StoreInst *SI)
Location getLocation (const VAArgInst *VI)
Location getLocation (const AtomicCmpXchgInst *CXI)
Location getLocation (const AtomicRMWInst *RMWI)
virtual AliasResult alias (const Location &LocA, const Location &LocB)
AliasResult alias (const Value *V1, uint64_t V1Size, const Value *V2, uint64_t V2Size)
 alias - A convenience wrapper.
AliasResult alias (const Value *V1, const Value *V2)
 alias - A convenience wrapper.
bool isNoAlias (const Location &LocA, const Location &LocB)
bool isNoAlias (const Value *V1, uint64_t V1Size, const Value *V2, uint64_t V2Size)
 isNoAlias - A convenience wrapper.
bool isNoAlias (const Value *V1, const Value *V2)
 isNoAlias - A convenience wrapper.
bool isMustAlias (const Location &LocA, const Location &LocB)
 isMustAlias - A convenience wrapper.
bool isMustAlias (const Value *V1, const Value *V2)
 isMustAlias - A convenience wrapper.
virtual bool pointsToConstantMemory (const Location &Loc, bool OrLocal=false)
bool pointsToConstantMemory (const Value *P, bool OrLocal=false)
 pointsToConstantMemory - A convenient wrapper.
virtual ModRefBehavior getModRefBehavior (ImmutableCallSite CS)
 getModRefBehavior - Return the behavior when calling the given call site.
virtual ModRefBehavior getModRefBehavior (const Function *F)
bool doesNotAccessMemory (ImmutableCallSite CS)
bool doesNotAccessMemory (const Function *F)
bool onlyReadsMemory (ImmutableCallSite CS)
bool onlyReadsMemory (const Function *F)
ModRefResult getModRefInfo (const Instruction *I, const Location &Loc)
ModRefResult getModRefInfo (const Instruction *I, const Value *P, uint64_t Size)
 getModRefInfo - A convenience wrapper.
virtual ModRefResult getModRefInfo (ImmutableCallSite CS, const Location &Loc)
ModRefResult getModRefInfo (ImmutableCallSite CS, const Value *P, uint64_t Size)
 getModRefInfo (for call sites) - A convenience wrapper.
ModRefResult getModRefInfo (const CallInst *C, const Location &Loc)
ModRefResult getModRefInfo (const CallInst *C, const Value *P, uint64_t Size)
 getModRefInfo (for calls) - A convenience wrapper.
ModRefResult getModRefInfo (const InvokeInst *I, const Location &Loc)
ModRefResult getModRefInfo (const InvokeInst *I, const Value *P, uint64_t Size)
 getModRefInfo (for invokes) - A convenience wrapper.
ModRefResult getModRefInfo (const LoadInst *L, const Location &Loc)
ModRefResult getModRefInfo (const LoadInst *L, const Value *P, uint64_t Size)
 getModRefInfo (for loads) - A convenience wrapper.
ModRefResult getModRefInfo (const StoreInst *S, const Location &Loc)
ModRefResult getModRefInfo (const StoreInst *S, const Value *P, uint64_t Size)
 getModRefInfo (for stores) - A convenience wrapper.
ModRefResult getModRefInfo (const FenceInst *S, const Location &Loc)
ModRefResult getModRefInfo (const FenceInst *S, const Value *P, uint64_t Size)
 getModRefInfo (for fences) - A convenience wrapper.
ModRefResult getModRefInfo (const AtomicCmpXchgInst *CX, const Location &Loc)
ModRefResult getModRefInfo (const AtomicCmpXchgInst *CX, const Value *P, unsigned Size)
 getModRefInfo (for cmpxchges) - A convenience wrapper.
ModRefResult getModRefInfo (const AtomicRMWInst *RMW, const Location &Loc)
ModRefResult getModRefInfo (const AtomicRMWInst *RMW, const Value *P, unsigned Size)
 getModRefInfo (for atomicrmws) - A convenience wrapper.
ModRefResult getModRefInfo (const VAArgInst *I, const Location &Loc)
ModRefResult getModRefInfo (const VAArgInst *I, const Value *P, uint64_t Size)
 getModRefInfo (for va_args) - A convenience wrapper.
virtual ModRefResult getModRefInfo (ImmutableCallSite CS1, ImmutableCallSite CS2)
ModRefResult callCapturesBefore (const Instruction *I, const AliasAnalysis::Location &MemLoc, DominatorTree *DT)
ModRefResult callCapturesBefore (const Instruction *I, const Value *P, uint64_t Size, DominatorTree *DT)
 callCapturesBefore - A convenience wrapper.
bool canBasicBlockModify (const BasicBlock &BB, const Location &Loc)
bool canBasicBlockModify (const BasicBlock &BB, const Value *P, uint64_t Size)
 canBasicBlockModify - A convenience wrapper.
bool canInstructionRangeModify (const Instruction &I1, const Instruction &I2, const Location &Loc)
bool canInstructionRangeModify (const Instruction &I1, const Instruction &I2, const Value *Ptr, uint64_t Size)
 canInstructionRangeModify - A convenience wrapper.
virtual void deleteValue (Value *V)
virtual void copyValue (Value *From, Value *To)
virtual void addEscapingUse (Use &U)
void replaceWithNewValue (Value *Old, Value *New)

Static Public Member Functions

static Location getLocationForSource (const MemTransferInst *MTI)
static Location getLocationForDest (const MemIntrinsic *MI)
static bool onlyReadsMemory (ModRefBehavior MRB)
static bool onlyAccessesArgPointees (ModRefBehavior MRB)
static bool doesAccessArgPointees (ModRefBehavior MRB)

Static Public Attributes

static char ID = 0
static uint64_t const UnknownSize = ~UINT64_C(0)

Protected Member Functions

void InitializeAliasAnalysis (Pass *P)
virtual void getAnalysisUsage (AnalysisUsage &AU) const

Protected Attributes

const DataLayoutTD
const TargetLibraryInfoTLI

Detailed Description

Definition at line 56 of file AliasAnalysis.h.


Member Enumeration Documentation

anonymous enum

These values define additional bits used to define the ModRefBehavior values.

Enumerator:
Nowhere 
ArgumentPointees 
Anywhere 

Definition at line 235 of file AliasAnalysis.h.

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.

See docs/AliasAnalysis.html for more information on the specific meanings of these values.

Enumerator:
NoAlias 

No dependencies.

MayAlias 

Anything goes.

PartialAlias 

Pointers differ, but pointees overlap.

MustAlias 

Pointers are equal.

Definition at line 161 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.

Enumerator:
DoesNotAccessMemory 

DoesNotAccessMemory - This function does not perform any non-local loads or stores to memory.

This property corresponds to the GCC 'const' attribute. This property corresponds to the LLVM IR 'readnone' attribute. This property corresponds to the IntrNoMem LLVM intrinsic flag.

OnlyReadsArgumentPointees 

OnlyReadsArgumentPointees - The only memory references in this function (if it has any) are non-volatile loads from objects pointed to by its pointer-typed arguments, with arbitrary offsets.

This property corresponds to the IntrReadArgMem LLVM intrinsic flag.

OnlyAccessesArgumentPointees 

OnlyAccessesArgumentPointees - The only memory references in this function (if it has any) are non-volatile loads and stores from objects pointed to by its pointer-typed arguments, with arbitrary offsets.

This property corresponds to the IntrReadWriteArgMem LLVM intrinsic flag.

OnlyReadsMemory 

OnlyReadsMemory - This function does not perform any non-local stores or volatile loads, but may read from any memory location.

This property corresponds to the GCC 'pure' attribute. This property corresponds to the LLVM IR 'readonly' attribute. This property corresponds to the IntrReadMem LLVM intrinsic flag.

UnknownModRefBehavior 

UnknownModRefBehavior - This indicates that the function could not be classified into one of the behaviors above.

Definition at line 241 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.

Enumerator:
NoModRef 
Ref 
Mod 
ModRef 

Definition at line 231 of file AliasAnalysis.h.


Constructor & Destructor Documentation

llvm::AliasAnalysis::AliasAnalysis ( ) [inline]

Definition at line 78 of file AliasAnalysis.h.

AliasAnalysis::~AliasAnalysis ( ) [virtual]

Definition at line 479 of file AliasAnalysis.cpp.


Member Function Documentation

void AliasAnalysis::addEscapingUse ( Use U) [virtual]

addEscapingUse - This method should be used whenever an escaping use is added to a pointer value. Analysis implementations may either return conservative responses for that value in the future, or may recompute some or all internal state to continue providing precise responses.

Escaping uses are considered by anything _except_ the following:

  • GEPs or bitcasts of the pointer
  • Loads through the pointer
  • Stores through (but not of) the pointer

Definition at line 72 of file AliasAnalysis.cpp.

References addEscapingUse().

Referenced by addEscapingUse(), and ConstructSSAForLoadSet().

AliasAnalysis::AliasResult AliasAnalysis::alias ( const Location LocA,
const Location LocB 
) [virtual]

alias - The main low level interface to the alias analysis implementation. Returns an AliasResult 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 51 of file AliasAnalysis.cpp.

Referenced by alias(), llvm::AliasSet::aliasesPointer(), getModRefInfo(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), isMustAlias(), isNoAlias(), llvm::AliasSet::mergeSetIn(), MIsNeedChainEdge(), and underlyingObjectsAlias().

AliasResult llvm::AliasAnalysis::alias ( const Value V1,
uint64_t  V1Size,
const Value V2,
uint64_t  V2Size 
) [inline]

alias - A convenience wrapper.

Definition at line 175 of file AliasAnalysis.h.

References alias().

AliasResult llvm::AliasAnalysis::alias ( const Value V1,
const Value V2 
) [inline]

alias - A convenience wrapper.

Definition at line 181 of file AliasAnalysis.h.

References alias(), and UnknownSize.

AliasAnalysis::ModRefResult AliasAnalysis::callCapturesBefore ( const Instruction I,
const AliasAnalysis::Location MemLoc,
DominatorTree DT 
)
ModRefResult llvm::AliasAnalysis::callCapturesBefore ( const Instruction I,
const Value P,
uint64_t  Size,
DominatorTree DT 
) [inline]

callCapturesBefore - A convenience wrapper.

Definition at line 485 of file AliasAnalysis.h.

References callCapturesBefore().

bool AliasAnalysis::canBasicBlockModify ( const BasicBlock BB,
const Location Loc 
)

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 506 of file AliasAnalysis.cpp.

References llvm::BasicBlock::back(), canInstructionRangeModify(), and llvm::BasicBlock::front().

Referenced by canBasicBlockModify().

bool llvm::AliasAnalysis::canBasicBlockModify ( const BasicBlock BB,
const Value P,
uint64_t  Size 
) [inline]

canBasicBlockModify - A convenience wrapper.

Definition at line 499 of file AliasAnalysis.h.

References canBasicBlockModify().

bool AliasAnalysis::canInstructionRangeModify ( const Instruction I1,
const Instruction I2,
const Location Loc 
)

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 516 of file AliasAnalysis.cpp.

References getModRefInfo(), llvm::Instruction::getParent(), I, and Mod.

Referenced by canBasicBlockModify(), and canInstructionRangeModify().

bool llvm::AliasAnalysis::canInstructionRangeModify ( const Instruction I1,
const Instruction I2,
const Value Ptr,
uint64_t  Size 
) [inline]

canInstructionRangeModify - A convenience wrapper.

Definition at line 511 of file AliasAnalysis.h.

References canInstructionRangeModify().

void AliasAnalysis::copyValue ( Value From,
Value To 
) [virtual]

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 67 of file AliasAnalysis.cpp.

References copyValue().

Referenced by ConstructSSAForLoadSet(), llvm::AliasSetTracker::copyValue(), copyValue(), replaceWithNewValue(), and UpdatePHINodes().

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 62 of file AliasAnalysis.cpp.

References deleteValue().

Referenced by llvm::AliasSetTracker::deleteValue(), deleteValue(), FindPHIToPartitionLoops(), llvm::FoldSingleEntryPHINodes(), llvm::MemoryDependenceAnalysis::removeInstruction(), and replaceWithNewValue().

static bool llvm::AliasAnalysis::doesAccessArgPointees ( ModRefBehavior  MRB) [inline, static]

doesAccessArgPointees - Return true if functions with the specified behavior are known to potentially read or write from objects pointed to be their pointer-typed arguments (with arbitrary offsets).

Definition at line 346 of file AliasAnalysis.h.

References ArgumentPointees, and ModRef.

Referenced by getModRefInfo().

bool llvm::AliasAnalysis::doesNotAccessMemory ( ImmutableCallSite  CS) [inline]

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 295 of file AliasAnalysis.h.

References DoesNotAccessMemory, and getModRefBehavior().

bool llvm::AliasAnalysis::doesNotAccessMemory ( const Function F) [inline]

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 302 of file AliasAnalysis.h.

References DoesNotAccessMemory, and getModRefBehavior().

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 492 of file AliasAnalysis.cpp.

References llvm::AnalysisUsage::addRequired().

const DataLayout* llvm::AliasAnalysis::getDataLayout ( ) const [inline]

getDataLayout - Return a pointer to the current DataLayout object, or null if no DataLayout object is available.

Definition at line 89 of file AliasAnalysis.h.

References TD.

Referenced by getLocForWrite(), getPointerSize(), and isOverwrite().

AliasAnalysis::Location AliasAnalysis::getLocation ( const LoadInst LI)

getLocation - Fill in Loc with information about the memory reference by the given instruction.

Definition at line 226 of file AliasAnalysis.cpp.

References llvm::Instruction::getMetadata(), llvm::LoadInst::getPointerOperand(), llvm::Value::getType(), getTypeStoreSize(), and llvm::LLVMContext::MD_tbaa.

Referenced by GetLocation(), getLocForWrite(), getModRefInfo(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), and isSafeToMove().

AliasAnalysis::Location AliasAnalysis::getLocation ( const StoreInst SI)
AliasAnalysis::Location AliasAnalysis::getLocation ( const VAArgInst VI)
AliasAnalysis::Location AliasAnalysis::getLocation ( const AtomicCmpXchgInst CXI)
AliasAnalysis::Location AliasAnalysis::getLocation ( const AtomicRMWInst RMWI)
AliasAnalysis::Location AliasAnalysis::getLocationForDest ( const MemIntrinsic MI) [static]
AliasAnalysis::Location AliasAnalysis::getLocationForSource ( const MemTransferInst MTI) [static]
AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior ( ImmutableCallSite  CS) [virtual]
AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior ( const Function F) [virtual]

getModRefBehavior - Return the behavior when calling the given function. For use when the call site is not known.

Definition at line 217 of file AliasAnalysis.cpp.

References getModRefBehavior().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const Instruction I,
const Location Loc 
) [inline]

getModRefInfo - Return information about whether or not an instruction may read or write the specified memory location. An instruction that doesn't read or write memory may be trivially LICM'd for example.

Definition at line 353 of file AliasAnalysis.h.

References llvm::Call, llvm::Instruction::getOpcode(), llvm::SPII::Load, NoModRef, and llvm::SPII::Store.

Referenced by llvm::AliasSet::aliasesPointer(), llvm::AliasSet::aliasesUnknownInst(), canInstructionRangeModify(), llvm::FindAvailableLoadedValue(), getModRefInfo(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), isSafeToMove(), and mayLoopAccessLocation().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const Instruction I,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo - A convenience wrapper.

Definition at line 371 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( ImmutableCallSite  CS,
const Location Loc 
) [virtual]
ModRefResult llvm::AliasAnalysis::getModRefInfo ( ImmutableCallSite  CS,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for call sites) - A convenience wrapper.

Definition at line 382 of file AliasAnalysis.h.

References getModRefInfo().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const CallInst C,
const Location Loc 
) [inline]

getModRefInfo (for calls) - Return information about whether a particular call modifies or reads the specified memory location.

Definition at line 389 of file AliasAnalysis.h.

References getModRefInfo().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const CallInst C,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for calls) - A convenience wrapper.

Definition at line 394 of file AliasAnalysis.h.

References getModRefInfo().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const InvokeInst I,
const Location Loc 
) [inline]

getModRefInfo (for invokes) - Return information about whether a particular invoke modifies or reads the specified memory location.

Definition at line 400 of file AliasAnalysis.h.

References getModRefInfo().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const InvokeInst I,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for invokes) - A convenience wrapper.

Definition at line 406 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( const LoadInst L,
const Location Loc 
)

getModRefInfo (for loads) - Return information about whether a particular load modifies or reads the specified memory location.

Definition at line 287 of file AliasAnalysis.cpp.

References alias(), getLocation(), llvm::LoadInst::isUnordered(), ModRef, NoModRef, and Ref.

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const LoadInst L,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for loads) - A convenience wrapper.

Definition at line 416 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( const StoreInst S,
const Location Loc 
)

getModRefInfo (for stores) - Return information about whether a particular store modifies or reads the specified memory location.

Definition at line 302 of file AliasAnalysis.cpp.

References alias(), getLocation(), llvm::StoreInst::isUnordered(), Mod, ModRef, NoModRef, and pointsToConstantMemory().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const StoreInst S,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for stores) - A convenience wrapper.

Definition at line 425 of file AliasAnalysis.h.

References getModRefInfo().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const FenceInst S,
const Location Loc 
) [inline]

getModRefInfo (for fences) - Return information about whether a particular store modifies or reads the specified memory location.

Definition at line 431 of file AliasAnalysis.h.

References ModRef.

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const FenceInst S,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for fences) - A convenience wrapper.

Definition at line 438 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( const AtomicCmpXchgInst CX,
const Location Loc 
)

getModRefInfo (for cmpxchges) - Return information about whether a particular cmpxchg modifies or reads the specified memory location.

Definition at line 338 of file AliasAnalysis.cpp.

References alias(), getLocation(), llvm::AtomicCmpXchgInst::getOrdering(), ModRef, llvm::Monotonic, and NoModRef.

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const AtomicCmpXchgInst CX,
const Value P,
unsigned  Size 
) [inline]

getModRefInfo (for cmpxchges) - A convenience wrapper.

Definition at line 447 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( const AtomicRMWInst RMW,
const Location Loc 
)

getModRefInfo (for atomicrmws) - Return information about whether a particular atomicrmw modifies or reads the specified memory location.

Definition at line 351 of file AliasAnalysis.cpp.

References alias(), getLocation(), llvm::AtomicRMWInst::getOrdering(), ModRef, llvm::Monotonic, and NoModRef.

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const AtomicRMWInst RMW,
const Value P,
unsigned  Size 
) [inline]

getModRefInfo (for atomicrmws) - A convenience wrapper.

Definition at line 457 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( const VAArgInst I,
const Location Loc 
)

getModRefInfo (for va_args) - Return information about whether a particular va_arg modifies or reads the specified memory location.

Definition at line 322 of file AliasAnalysis.cpp.

References alias(), getLocation(), ModRef, NoModRef, and pointsToConstantMemory().

ModRefResult llvm::AliasAnalysis::getModRefInfo ( const VAArgInst I,
const Value P,
uint64_t  Size 
) [inline]

getModRefInfo (for va_args) - A convenience wrapper.

Definition at line 467 of file AliasAnalysis.h.

References getModRefInfo().

AliasAnalysis::ModRefResult AliasAnalysis::getModRefInfo ( ImmutableCallSite  CS1,
ImmutableCallSite  CS2 
) [virtual]
const TargetLibraryInfo* llvm::AliasAnalysis::getTargetLibraryInfo ( ) const [inline]

getTargetLibraryInfo - Return a pointer to the current TargetLibraryInfo object, or null if no TargetLibraryInfo object is available.

Definition at line 94 of file AliasAnalysis.h.

References TLI.

Referenced by GetLocation(), getLocForRead(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), and getPointerSize().

uint64_t AliasAnalysis::getTypeStoreSize ( Type Ty)

getTypeStoreSize - Return the DataLayout store size for the given type, if known, or a conservative value otherwise.

Definition at line 499 of file AliasAnalysis.cpp.

References llvm::DataLayout::getTypeStoreSize(), TD, and UnknownSize.

Referenced by llvm::AliasSetTracker::add(), llvm::FindAvailableLoadedValue(), getLocation(), llvm::AliasSetTracker::remove(), and underlyingObjectsAlias().

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 484 of file AliasAnalysis.cpp.

References llvm::Pass::getAnalysis(), llvm::Pass::getAnalysisIfAvailable(), TD, and TLI.

Referenced by llvm::LibCallAliasAnalysis::runOnFunction().

bool llvm::AliasAnalysis::isMustAlias ( const Location LocA,
const Location LocB 
) [inline]

isMustAlias - A convenience wrapper.

Definition at line 203 of file AliasAnalysis.h.

References alias(), and MustAlias.

Referenced by llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), and isPossibleSelfRead().

bool llvm::AliasAnalysis::isMustAlias ( const Value V1,
const Value V2 
) [inline]

isMustAlias - A convenience wrapper.

Definition at line 208 of file AliasAnalysis.h.

References alias(), and MustAlias.

bool llvm::AliasAnalysis::isNoAlias ( const Location LocA,
const Location LocB 
) [inline]

isNoAlias - A trivial helper function to check to see if the specified pointers are no-alias.

Definition at line 187 of file AliasAnalysis.h.

References alias(), and NoAlias.

Referenced by callCapturesBefore(), getModRefInfo(), isNoAlias(), and isPossibleSelfRead().

bool llvm::AliasAnalysis::isNoAlias ( const Value V1,
uint64_t  V1Size,
const Value V2,
uint64_t  V2Size 
) [inline]

isNoAlias - A convenience wrapper.

Definition at line 192 of file AliasAnalysis.h.

References isNoAlias().

bool llvm::AliasAnalysis::isNoAlias ( const Value V1,
const Value V2 
) [inline]

isNoAlias - A convenience wrapper.

Definition at line 198 of file AliasAnalysis.h.

References isNoAlias().

static bool llvm::AliasAnalysis::onlyAccessesArgPointees ( ModRefBehavior  MRB) [inline, static]

onlyAccessesArgPointees - Return true if functions with the specified behavior are known to read and write at most from objects pointed to by their pointer-typed arguments (with arbitrary offsets).

Definition at line 338 of file AliasAnalysis.h.

References Anywhere, and ArgumentPointees.

Referenced by llvm::objcarc::CanAlterRefCount(), and getModRefInfo().

bool llvm::AliasAnalysis::onlyReadsMemory ( ImmutableCallSite  CS) [inline]

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 315 of file AliasAnalysis.h.

References getModRefBehavior().

Referenced by llvm::objcarc::CanAlterRefCount(), llvm::MemoryDependenceAnalysis::getDependency(), getModRefInfo(), llvm::MemoryDependenceAnalysis::getNonLocalCallDependency(), and onlyReadsMemory().

bool llvm::AliasAnalysis::onlyReadsMemory ( const Function F) [inline]

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 323 of file AliasAnalysis.h.

References getModRefBehavior(), and onlyReadsMemory().

static bool llvm::AliasAnalysis::onlyReadsMemory ( ModRefBehavior  MRB) [inline, static]

onlyReadsMemory - Return true if functions with the specified behavior are known to only read from non-volatile memory (or not access memory at all).

Definition at line 330 of file AliasAnalysis.h.

References Mod.

bool AliasAnalysis::pointsToConstantMemory ( const Location Loc,
bool  OrLocal = false 
) [virtual]

pointsToConstantMemory - If the specified memory location is known to be constant, return true. If OrLocal is true and the specified memory location is known to be "local" (derived from an alloca), return true. Otherwise return false.

Definition at line 56 of file AliasAnalysis.cpp.

References pointsToConstantMemory().

Referenced by getMemCmpLoad(), getModRefInfo(), llvm::MemoryDependenceAnalysis::getPointerDependencyFrom(), llvm::MachineInstr::isInvariantLoad(), llvm::objcarc::IsPotentialRetainableObjPtr(), and pointsToConstantMemory().

bool llvm::AliasAnalysis::pointsToConstantMemory ( const Value P,
bool  OrLocal = false 
) [inline]

pointsToConstantMemory - A convenient wrapper.

Definition at line 220 of file AliasAnalysis.h.

References pointsToConstantMemory().

void llvm::AliasAnalysis::replaceWithNewValue ( Value Old,
Value New 
) [inline]

replaceWithNewValue - This method is the obvious combination of the two above, and it provided as a helper to simplify client code.

Definition at line 551 of file AliasAnalysis.h.

References copyValue(), and deleteValue().


Member Data Documentation

char AliasAnalysis::ID = 0 [static]
const DataLayout* llvm::AliasAnalysis::TD [protected]

Definition at line 59 of file AliasAnalysis.h.

Referenced by getTargetLibraryInfo(), and InitializeAliasAnalysis().

uint64_t const llvm::AliasAnalysis::UnknownSize = ~UINT64_C(0) [static]

UnknownSize - This is a special value which can be used with the size arguments in alias queries to indicate that the caller does not know the sizes of the potential memory references.

Definition at line 84 of file AliasAnalysis.h.

Referenced by llvm::AliasSetTracker::add(), alias(), getLocation(), getLocationForDest(), getLocationForSource(), getLocForWrite(), getModRefInfo(), getObjectSize(), getPointerSize(), getTypeStoreSize(), isObjectSize(), isObjectSmallerThan(), isOverwrite(), and llvm::AliasSetTracker::remove().


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