LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
llvm::MemoryLocation Class Reference

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 getWithNewPtr (const Value *NewPtr) const
 
MemoryLocation getWithNewSize (LocationSize NewSize) const
 
MemoryLocation getWithoutAATags () const
 
bool operator== (const MemoryLocation &Other) const
 

Static Public Member Functions

static MemoryLocation get (const LoadInst *LI)
 Return a location with information about the memory reference by the given instruction.
 
static MemoryLocation get (const StoreInst *SI)
 
static MemoryLocation get (const VAArgInst *VI)
 
static MemoryLocation get (const AtomicCmpXchgInst *CXI)
 
static MemoryLocation get (const AtomicRMWInst *RMWI)
 
static MemoryLocation get (const Instruction *Inst)
 
static std::optional< MemoryLocationgetOrNone (const Instruction *Inst)
 
static MemoryLocation getForSource (const MemTransferInst *MTI)
 Return a location representing the source of a memory transfer.
 
static MemoryLocation getForSource (const AtomicMemTransferInst *MTI)
 
static MemoryLocation getForSource (const AnyMemTransferInst *MTI)
 
static MemoryLocation getForDest (const MemIntrinsic *MI)
 Return a location representing the destination of a memory set or transfer.
 
static MemoryLocation getForDest (const AtomicMemIntrinsic *MI)
 
static MemoryLocation getForDest (const AnyMemIntrinsic *MI)
 
static std::optional< MemoryLocationgetForDest (const CallBase *CI, const TargetLibraryInfo &TLI)
 
static 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 ValuePtr
 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).
 

Detailed Description

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 227 of file MemoryLocation.h.

Member Enumeration Documentation

◆ anonymous enum

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 232 of file MemoryLocation.h.

Constructor & Destructor Documentation

◆ MemoryLocation() [1/2]

llvm::MemoryLocation::MemoryLocation ( )
inline

Definition at line 299 of file MemoryLocation.h.

Referenced by get(), getAfter(), getBeforeOrAfter(), and getForArgument().

◆ MemoryLocation() [2/2]

llvm::MemoryLocation::MemoryLocation ( const Value Ptr,
LocationSize  Size,
const AAMDNodes AATags = AAMDNodes() 
)
inlineexplicit

Definition at line 301 of file MemoryLocation.h.

Member Function Documentation

◆ get() [1/6]

MemoryLocation MemoryLocation::get ( const AtomicCmpXchgInst CXI)
static

◆ get() [2/6]

MemoryLocation MemoryLocation::get ( const AtomicRMWInst RMWI)
static

◆ get() [3/6]

static MemoryLocation llvm::MemoryLocation::get ( const Instruction Inst)
inlinestatic

Definition at line 259 of file MemoryLocation.h.

References getOrNone().

◆ get() [4/6]

MemoryLocation MemoryLocation::get ( const LoadInst LI)
static

◆ get() [5/6]

MemoryLocation MemoryLocation::get ( const StoreInst SI)
static

Definition at line 45 of file MemoryLocation.cpp.

References DL, MemoryLocation(), and llvm::LocationSize::precise().

◆ get() [6/6]

MemoryLocation MemoryLocation::get ( const VAArgInst VI)
static

Definition at line 54 of file MemoryLocation.cpp.

References llvm::LocationSize::afterPointer(), and MemoryLocation().

◆ getAfter()

static MemoryLocation llvm::MemoryLocation::getAfter ( const Value Ptr,
const AAMDNodes AATags = AAMDNodes() 
)
inlinestatic

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

Definition at line 287 of file MemoryLocation.h.

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

Referenced by getForArgument(), GetLocation(), and llvm::MemoryDependenceResults::getSimplePointerDependencyFrom().

◆ getBeforeOrAfter()

static MemoryLocation llvm::MemoryLocation::getBeforeOrAfter ( const Value Ptr,
const AAMDNodes AATags = AAMDNodes() 
)
inlinestatic

◆ getForArgument() [1/2]

static MemoryLocation llvm::MemoryLocation::getForArgument ( const CallBase Call,
unsigned  ArgIdx,
const TargetLibraryInfo TLI 
)
inlinestatic

Definition at line 280 of file MemoryLocation.h.

References getForArgument().

◆ getForArgument() [2/2]

MemoryLocation MemoryLocation::getForArgument ( const CallBase Call,
unsigned  ArgIdx,
const TargetLibraryInfo TLI 
)
static

◆ getForDest() [1/4]

MemoryLocation MemoryLocation::getForDest ( const AnyMemIntrinsic MI)
static

Definition at line 116 of file MemoryLocation.cpp.

References assert(), getForArgument(), and MI.

◆ getForDest() [2/4]

MemoryLocation MemoryLocation::getForDest ( const AtomicMemIntrinsic MI)
static

Definition at line 112 of file MemoryLocation.cpp.

References getForDest(), and MI.

◆ getForDest() [3/4]

std::optional< MemoryLocation > MemoryLocation::getForDest ( const CallBase CI,
const TargetLibraryInfo TLI 
)
static

◆ getForDest() [4/4]

MemoryLocation MemoryLocation::getForDest ( const MemIntrinsic MI)
static

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

Definition at line 108 of file MemoryLocation.cpp.

References getForDest(), and MI.

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

◆ getForSource() [1/3]

MemoryLocation MemoryLocation::getForSource ( const AnyMemTransferInst MTI)
static

◆ getForSource() [2/3]

MemoryLocation MemoryLocation::getForSource ( const AtomicMemTransferInst MTI)
static

Definition at line 99 of file MemoryLocation.cpp.

References getForSource().

◆ getForSource() [3/3]

MemoryLocation MemoryLocation::getForSource ( const MemTransferInst MTI)
static

Return a location representing the source of a memory transfer.

Definition at line 95 of file MemoryLocation.cpp.

References getForSource().

Referenced by llvm::AliasSetTracker::add(), getForSource(), and llvm::AA::isPotentiallyAffectedByBarrier().

◆ getOrNone()

std::optional< MemoryLocation > MemoryLocation::getOrNone ( const Instruction Inst)
static

◆ getWithNewPtr()

MemoryLocation llvm::MemoryLocation::getWithNewPtr ( const Value NewPtr) const
inline

Definition at line 305 of file MemoryLocation.h.

Referenced by memoryIsNotModifiedBetween().

◆ getWithNewSize()

MemoryLocation llvm::MemoryLocation::getWithNewSize ( LocationSize  NewSize) const
inline

Definition at line 311 of file MemoryLocation.h.

Referenced by foldLoadsRecursive().

◆ getWithoutAATags()

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

Definition at line 317 of file MemoryLocation.h.

◆ operator==()

bool llvm::MemoryLocation::operator== ( const MemoryLocation Other) const
inline

Definition at line 323 of file MemoryLocation.h.

References AATags, llvm::Other, Ptr, and Size.

◆ print()

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

Definition at line 250 of file MemoryLocation.h.

References OS, Ptr, and Size.

Member Data Documentation

◆ AATags

AAMDNodes llvm::MemoryLocation::AATags

◆ Ptr

const Value* llvm::MemoryLocation::Ptr

◆ Size

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 244 of file MemoryLocation.h.

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


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