15#ifndef LLVM_ANALYSIS_MEMORYLOCATION_H
16#define LLVM_ANALYSIS_MEMORYLOCATION_H
32class AtomicCmpXchgInst;
33class AtomicMemTransferInst;
34class AtomicMemIntrinsic;
36class AnyMemTransferInst;
38class TargetLibraryInfo;
72 AfterPointer = (BeforeOrAfterPointer - 1) & ~ScalableBit,
73 MapEmpty = BeforeOrAfterPointer - 2,
74 MapTombstone = BeforeOrAfterPointer - 3,
78 MaxValue = (MapTombstone - 1) & ~(ImpreciseBit | ScalableBit),
85 enum DirectConstruction { Direct };
89 :
Value(Raw > MaxValue ? AfterPointer
90 : Raw | (Scalable ? ScalableBit :
uint64_t(0))) {}
92 static_assert(AfterPointer & ImpreciseBit,
93 "AfterPointer is imprecise by definition.");
94 static_assert(BeforeOrAfterPointer & ImpreciseBit,
95 "BeforeOrAfterPointer is imprecise by definition.");
96 static_assert(~(MaxValue & ScalableBit),
"Max value don't have bit 62 set");
106 :
Value(Raw > MaxValue ? AfterPointer : Raw) {}
124 if (
Value.isScalable())
155 if (
Value == BeforeOrAfterPointer ||
Other.Value == BeforeOrAfterPointer)
157 if (
Value == AfterPointer ||
Other.Value == AfterPointer)
166 return Value != AfterPointer &&
Value != BeforeOrAfterPointer;
171 assert(
hasValue() &&
"Getting value from an unknown LocationSize!");
172 assert((
Value & ~(ImpreciseBit | ScalableBit)) < MaxValue &&
173 "Scalable bit of value should be masked");
#define LLVM_UNLIKELY(EXPR)
This file defines DenseMapInfo traits for DenseMap.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
An instruction that atomically checks whether a specified value is in a memory location,...
an instruction that atomically reads a memory location, combines it with another value,...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
An instruction for reading from memory.
static LocationSize precise(uint64_t Value)
static constexpr LocationSize mapEmpty()
static LocationSize upperBound(TypeSize Value)
bool mayBeBeforePointer() const
Whether accesses before the base pointer are possible.
bool operator==(const TypeSize &Other) const
static constexpr LocationSize beforeOrAfterPointer()
Any location before or after the base pointer (but still within the underlying object).
TypeSize getValue() const
void print(raw_ostream &OS) const
bool operator!=(const TypeSize &Other) const
bool operator!=(const LocationSize &Other) const
static constexpr LocationSize afterPointer()
Any location after the base pointer (but still within the underlying object).
LocationSize unionWith(LocationSize Other) const
static LocationSize upperBound(uint64_t Value)
constexpr LocationSize(uint64_t Raw)
static constexpr LocationSize mapTombstone()
bool operator==(const LocationSize &Other) const
static LocationSize precise(TypeSize Value)
This is the common base class for memset/memcpy/memmove.
This class wraps the llvm.memcpy/memmove intrinsics.
Representation for a specific memory location.
MemoryLocation getWithNewSize(LocationSize NewSize) const
MemoryLocation getWithoutAATags() const
static MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
static MemoryLocation getForArgument(const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo &TLI)
static MemoryLocation getForSource(const MemTransferInst *MTI)
Return a location representing the source of a memory transfer.
void print(raw_ostream &OS) const
LocationSize Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known.
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 underl...
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 objec...
static MemoryLocation get(const Instruction *Inst)
MemoryLocation getWithNewPtr(const Value *NewPtr) const
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
const Value * Ptr
The address of the start of the location.
MemoryLocation(const Value *Ptr, LocationSize Size, const AAMDNodes &AATags=AAMDNodes())
static MemoryLocation getForDest(const MemIntrinsic *MI)
Return a location representing the destination of a memory set or transfer.
bool operator==(const MemoryLocation &Other) const
static std::optional< MemoryLocation > getOrNone(const Instruction *Inst)
static MemoryLocation getForArgument(const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo *TLI)
Return a location representing a particular argument of a call.
An instruction for storing to memory.
Provides information about what library functions are available for the current target.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
LLVM Value Representation.
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
static LocationSize getTombstoneKey()
static bool isEqual(const LocationSize &LHS, const LocationSize &RHS)
static unsigned getHashValue(const LocationSize &Val)
static LocationSize getEmptyKey()
static MemoryLocation getTombstoneKey()
static MemoryLocation getEmptyKey()
static bool isEqual(const MemoryLocation &LHS, const MemoryLocation &RHS)
static unsigned getHashValue(const MemoryLocation &Val)
An information struct used to provide DenseMap with the various necessary components for a given valu...