LLVM 22.0.0git
|
Representation for a specific memory location. More...
#include "llvm/Analysis/MemoryLocation.h"
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 216 of file MemoryLocation.h.
anonymous enum : uint64_t |
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 221 of file MemoryLocation.h.
|
inline |
Definition at line 288 of file MemoryLocation.h.
Referenced by get(), get(), get(), get(), get(), get(), getAfter(), getBeforeOrAfter(), getForArgument(), getForArgument(), getForDest(), getForDest(), getForSource(), getForSource(), getWithNewPtr(), getWithNewSize(), getWithNewSize(), getWithNewSize(), getWithoutAATags(), and operator==().
|
inlineexplicit |
Definition at line 290 of file MemoryLocation.h.
|
inlineexplicit |
Definition at line 293 of file MemoryLocation.h.
|
inlineexplicit |
Definition at line 296 of file MemoryLocation.h.
|
static |
Definition at line 59 of file MemoryLocation.cpp.
References DL, llvm::Instruction::getAAMetadata(), llvm::AtomicCmpXchgInst::getCompareOperand(), llvm::Instruction::getDataLayout(), llvm::AtomicCmpXchgInst::getPointerOperand(), llvm::Value::getType(), MemoryLocation(), and llvm::LocationSize::precise().
|
static |
Definition at line 68 of file MemoryLocation.cpp.
References DL, llvm::Instruction::getAAMetadata(), llvm::Instruction::getDataLayout(), llvm::AtomicRMWInst::getPointerOperand(), llvm::Value::getType(), llvm::AtomicRMWInst::getValOperand(), MemoryLocation(), and llvm::LocationSize::precise().
|
inlinestatic |
Definition at line 248 of file MemoryLocation.h.
References getOrNone(), and MemoryLocation().
|
static |
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::DependenceInfo::getSplitIteration(), llvm::hasPartialIVCondition(), llvm::AMDGPU::isClobberedInFunction(), isSafeToMove(), isUseTriviallyOptimizableToLiveOnEntry(), memoryIsNotModifiedBetween(), noConflictingReadWrites(), and writeToAlloca().
|
static |
Definition at line 45 of file MemoryLocation.cpp.
References DL, MemoryLocation(), and llvm::LocationSize::precise().
|
static |
Definition at line 54 of file MemoryLocation.cpp.
References llvm::LocationSize::afterPointer(), and MemoryLocation().
|
inlinestatic |
Return a location that may access any location after Ptr, while remaining within the underlying object.
Definition at line 276 of file MemoryLocation.h.
References AATags, llvm::LocationSize::afterPointer(), MemoryLocation(), and Ptr.
Referenced by getForArgument(), GetLocation(), and llvm::MemoryDependenceResults::getSimplePointerDependencyFrom().
|
inlinestatic |
Return a location that may access any location before or after Ptr, while remaining within the underlying object.
Definition at line 284 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().
|
inlinestatic |
Definition at line 269 of file MemoryLocation.h.
References Call, getForArgument(), and MemoryLocation().
|
static |
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().
|
static |
Definition at line 108 of file MemoryLocation.cpp.
References assert(), getForArgument(), MemoryLocation(), and MI.
|
static |
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().
|
static |
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().
|
static |
Definition at line 99 of file MemoryLocation.cpp.
References assert(), llvm::CallBase::getArgOperand(), getForArgument(), llvm::MemTransferBase< BaseCL >::getRawSource(), and MemoryLocation().
|
static |
Return a location representing the source of a memory transfer.
Definition at line 95 of file MemoryLocation.cpp.
References llvm::cast(), getForSource(), and MemoryLocation().
Referenced by llvm::AliasSetTracker::add(), getForSource(), llvm::AA::isPotentiallyAffectedByBarrier(), and overreadUndefContents().
|
static |
Definition at line 78 of file MemoryLocation.cpp.
References llvm::cast(), get(), and llvm::Instruction::getOpcode().
Referenced by checkFunctionMemoryAccess(), get(), llvm::AAResults::getModRefInfo(), HasAddressTaken(), llvm::AA::isPotentiallyAffectedByBarrier(), and llvm::sandboxir::Utils::memoryLocationGetOrNone().
|
inline |
Definition at line 300 of file MemoryLocation.h.
References MemoryLocation().
Referenced by memoryIsNotModifiedBetween().
|
inline |
Definition at line 306 of file MemoryLocation.h.
References MemoryLocation().
Referenced by getWithNewSize(), and getWithNewSize().
|
inline |
Definition at line 314 of file MemoryLocation.h.
References getWithNewSize(), MemoryLocation(), and llvm::LocationSize::precise().
|
inline |
Definition at line 311 of file MemoryLocation.h.
References getWithNewSize(), MemoryLocation(), and llvm::LocationSize::precise().
|
inline |
Definition at line 318 of file MemoryLocation.h.
References MemoryLocation().
|
inline |
Definition at line 324 of file MemoryLocation.h.
References AATags, MemoryLocation(), llvm::Other, Ptr, and Size.
|
inline |
Definition at line 239 of file MemoryLocation.h.
AAMDNodes llvm::MemoryLocation::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 237 of file MemoryLocation.h.
Referenced by llvm::objcarc::ObjCARCAAResult::alias(), llvm::SCEVAAResult::alias(), llvm::ScopedNoAliasAAResult::alias(), llvm::TypeBasedAAResult::alias(), collectMemAccessInfo(), getAfter(), getBeforeOrAfter(), getForArgument(), llvm::DenseMapInfo< MemoryLocation >::getHashValue(), MemoryLocation(), MemoryLocation(), MemoryLocation(), operator==(), and underlyingObjectsAlias().
The address of the start of the location.
Definition at line 224 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().
LocationSize llvm::MemoryLocation::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 233 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().