LLVM: llvm::MemoryLocation Class Reference (original) (raw)

Representation for a specific memory location. More...

#include "[llvm/Analysis/MemoryLocation.h](MemoryLocation%5F8h%5Fsource.html)"

Public Types
enum : uint64_t { UnknownSize = ~UINT64_C(0) }
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. More...
Public Member Functions
void print (raw_ostream &OS) const
MemoryLocation ()
MemoryLocation (const Value *Ptr, LocationSize Size, const AAMDNodes &AATags=AAMDNodes())
MemoryLocation (const Value *Ptr, TypeSize Size, const AAMDNodes &AATags=AAMDNodes())
MemoryLocation (const Value *Ptr, uint64_t Size, const AAMDNodes &AATags=AAMDNodes())
MemoryLocation getWithNewPtr (const Value *NewPtr) const
MemoryLocation getWithNewSize (LocationSize NewSize) const
MemoryLocation getWithNewSize (uint64_t NewSize) const
MemoryLocation getWithNewSize (TypeSize NewSize) const
MemoryLocation getWithoutAATags () const
bool operator== (const MemoryLocation &Other) const
Static Public Member Functions
static LLVM_ABI MemoryLocation get (const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
static LLVM_ABI MemoryLocation get (const StoreInst *SI)
static LLVM_ABI MemoryLocation get (const VAArgInst *VI)
static LLVM_ABI MemoryLocation get (const AtomicCmpXchgInst *CXI)
static LLVM_ABI MemoryLocation get (const AtomicRMWInst *RMWI)
static MemoryLocation get (const Instruction *Inst)
static LLVM_ABI std::optional< MemoryLocation > getOrNone (const Instruction *Inst)
static LLVM_ABI MemoryLocation getForSource (const MemTransferInst *MTI)
Return a location representing the source of a memory transfer.
static LLVM_ABI MemoryLocation getForSource (const AnyMemTransferInst *MTI)
static LLVM_ABI MemoryLocation getForDest (const MemIntrinsic *MI)
Return a location representing the destination of a memory set or transfer.
static LLVM_ABI MemoryLocation getForDest (const AnyMemIntrinsic *MI)
static LLVM_ABI std::optional< MemoryLocation > getForDest (const CallBase *CI, const TargetLibraryInfo &TLI)
static LLVM_ABI MemoryLocation getForArgument (const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo *TLI)
Return a location representing a particular argument of a call.
static MemoryLocation getForArgument (const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo &TLI)
static MemoryLocation getAfter (const Value *Ptr, const AAMDNodes &AATags=AAMDNodes())
Return a location that may access any location after Ptr, while remaining within the underlying object.
static MemoryLocation getBeforeOrAfter (const Value *Ptr, const AAMDNodes &AATags=AAMDNodes())
Return a location that may access any location before or after Ptr, while remaining within the underlying object.
Public Attributes
const Value * Ptr
The address of the start of the location.
LocationSize Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known.
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of information is unavailable).

Representation for a specific memory location.

This abstraction can be used to represent a specific location in memory. The goal of the location is to represent enough information to describe abstract aliasing, modification, and reference behaviors of whatever value(s) are stored in memory at the particular location.

The primary user of this interface is LLVM's Alias Analysis, but other memory analyses such as MemoryDependence can use it as well.

Definition at line 217 of file MemoryLocation.h.

anonymous enum

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.

Enumerator
UnknownSize

Definition at line 222 of file MemoryLocation.h.

llvm::MemoryLocation::MemoryLocation ( ) inline

Definition at line 289 of file MemoryLocation.h.

References Ptr, and Size.

Referenced by get(), get(), get(), get(), get(), get(), getAfter(), getBeforeOrAfter(), getForArgument(), getForArgument(), getForDest(), getForDest(), getForSource(), getForSource(), getWithNewPtr(), getWithNewSize(), getWithNewSize(), getWithNewSize(), getWithoutAATags(), and operator==().

MemoryLocation() [2/4]

MemoryLocation() [3/4]

MemoryLocation() [4/4]

get() [1/6]

get() [2/6]

get() [3/6]

get() [4/6]

Return a location with information about the memory reference by the given instruction.

Definition at line 36 of file MemoryLocation.cpp.

References DL, llvm::Instruction::getAAMetadata(), llvm::Instruction::getDataLayout(), llvm::LoadInst::getPointerOperand(), llvm::Value::getType(), MemoryLocation(), and llvm::LocationSize::precise().

Referenced by llvm::AliasSetTracker::add(), llvm::AliasSetTracker::add(), llvm::AliasSetTracker::add(), canMoveAboveCall(), canSkipClobberingStore(), collectMemAccessInfo(), llvm::DependenceInfo::depends(), findArgParts(), llvm::FindAvailableLoadedValue(), llvm::FindAvailableLoadedValue(), findSafeStoreForStoreStrongContraction(), foldLoadsRecursive(), GetLocation(), getLocation(), llvm::AAResults::getModRefInfo(), llvm::AAResults::getModRefInfo(), llvm::AAResults::getModRefInfo(), llvm::AAResults::getModRefInfo(), llvm::AAResults::getModRefInfo(), llvm::AAResults::getModRefInfo(), llvm::MemoryDependenceResults::getNonLocalPointerDependency(), getOrNone(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), llvm::hasPartialIVCondition(), llvm::AMDGPU::isClobberedInFunction(), isSafeToMove(), isUseTriviallyOptimizableToLiveOnEntry(), memoryIsNotModifiedBetween(), noConflictingReadWrites(), and writeToAlloca().

get() [5/6]

get() [6/6]

getAfter()

getBeforeOrAfter()

Return a location that may access any location before or after Ptr, while remaining within the underlying object.

Definition at line 285 of file MemoryLocation.h.

References AATags, llvm::LocationSize::beforeOrAfterPointer(), MemoryLocation(), and Ptr.

Referenced by addArgLocs(), llvm::AAResults::alias(), llvm::objcarc::ObjCARCAAResult::alias(), llvm::AAResults::callCapturesBefore(), foldConsecutiveStores(), getForArgument(), getForDest(), llvm::BasicAAResult::getModRefInfo(), llvm::AAResults::getModRefInfoMask(), llvm::objcarc::ObjCARCAAResult::getModRefInfoMask(), hasLoopCarriedMemDep(), llvm::AAResults::isNoAlias(), llvm::AAResults::pointsToConstantMemory(), llvm::BatchAAResults::pointsToConstantMemory(), and underlyingObjectsAlias().

getForArgument() [1/2]

getForArgument() [2/2]

Return a location representing a particular argument of a call.

Definition at line 181 of file MemoryLocation.cpp.

References AATags, llvm::LocationSize::afterPointer(), assert(), Call, llvm::cast(), DL, llvm::dyn_cast(), F, getAfter(), getBeforeOrAfter(), getKnownTypeFromMaskedOp(), llvm::TargetLibraryInfo::getLibFunc(), llvm::TargetLibraryInfo::has(), II, llvm::isa(), MemoryLocation(), llvm::LocationSize::precise(), Size, and llvm::LocationSize::upperBound().

Referenced by llvm::AliasSetTracker::add(), getForArgument(), getForDest(), getForDest(), getForSource(), GetLocation(), llvm::AAResults::getModRefInfo(), llvm::BasicAAResult::getModRefInfo(), and isArgUnmodifiedByAllCalls().

getForDest() [1/3]

getForDest() [2/3]

Definition at line 114 of file MemoryLocation.cpp.

References llvm::CallBase::arg_size(), llvm::Instruction::getAAMetadata(), llvm::CallBase::getArgOperand(), getBeforeOrAfter(), getForArgument(), llvm::CallBase::getMemoryEffects(), llvm::Value::getType(), llvm::CallBase::hasOperandBundles(), llvm::Type::isPointerTy(), llvm::MemoryEffectsBase< LocationEnum >::onlyAccessesArgPointees(), llvm::CallBase::onlyReadsMemory(), and llvm::MemoryEffectsBase< IRMemLocation >::writeOnly().

getForDest() [3/3]

Return a location representing the destination of a memory set or transfer.

Definition at line 104 of file MemoryLocation.cpp.

References llvm::cast(), getForDest(), MemoryLocation(), and MI.

Referenced by llvm::AliasSetTracker::add(), llvm::AliasSetTracker::add(), getForDest(), llvm::AA::isPotentiallyAffectedByBarrier(), isRemovableWrite(), memoryIsNotModifiedBetween(), SoleWriteToDeadLocal(), and writeToAlloca().

getForSource() [1/2]

getForSource() [2/2]

getOrNone()

getWithNewPtr()

getWithNewSize() [1/3]

getWithNewSize() [2/3]

getWithNewSize() [3/3]

getWithoutAATags()

MemoryLocation llvm::MemoryLocation::getWithoutAATags ( ) const inline

operator==()

print()

void llvm::MemoryLocation::print ( raw_ostream & OS) const inline

AATags

The metadata nodes which describes the aliasing of the location (each member is null if that kind of information is unavailable).

Definition at line 238 of file MemoryLocation.h.

Referenced by llvm::objcarc::ObjCARCAAResult::alias(), llvm::SCEVAAResult::alias(), llvm::ScopedNoAliasAAResult::alias(), llvm::TypeBasedAAResult::alias(), canHoistOrSinkWithNoAliasCheck(), collectMemAccessInfo(), getAfter(), getBeforeOrAfter(), getForArgument(), llvm::DenseMapInfo< MemoryLocation >::getHashValue(), llvm::VPlanTransforms::hoistInvariantLoads(), MemoryLocation(), MemoryLocation(), MemoryLocation(), operator==(), and underlyingObjectsAlias().

Ptr

The address of the start of the location.

Definition at line 225 of file MemoryLocation.h.

Referenced by llvm::AAResults::alias(), llvm::AMDGPUAAResult::alias(), llvm::BasicAAResult::alias(), llvm::GlobalsAAResult::alias(), llvm::NVPTXAAResult::alias(), llvm::objcarc::ObjCARCAAResult::alias(), llvm::SCEVAAResult::alias(), llvm::AAResults::callCapturesBefore(), collectMemAccessInfo(), getAfter(), llvm::AliasSetTracker::getAliasSetFor(), getBeforeOrAfter(), llvm::MemoryDependenceResults::getDependency(), llvm::DenseMapInfo< MemoryLocation >::getHashValue(), llvm::AliasSet::getPointers(), llvm::MemoryDependenceResults::getSimplePointerDependencyFrom(), memoryIsNotModifiedBetween(), MemoryLocation(), MemoryLocation(), MemoryLocation(), MemoryLocation(), operator==(), llvm::AliasSet::print(), print(), and underlyingObjectsAlias().

Size

The maximum size of the location, in address-units, or UnknownSize if the size is not known.

Note that an unknown size does not mean the pointer aliases the entire virtual address space, because there are restrictions on stepping out of one object and into another. See http://llvm.org/docs/LangRef.html#pointeraliasing

Definition at line 234 of file MemoryLocation.h.

Referenced by llvm::AAResults::alias(), llvm::BasicAAResult::alias(), llvm::objcarc::ObjCARCAAResult::alias(), llvm::SCEVAAResult::alias(), canSkipClobberingStore(), llvm::DependenceInfo::depends(), getForArgument(), llvm::DenseMapInfo< MemoryLocation >::getHashValue(), isPartialOverwrite(), MemoryLocation(), MemoryLocation(), MemoryLocation(), MemoryLocation(), operator==(), llvm::AliasSet::print(), and print().


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