16 #ifndef LLVM_ANALYSIS_MEMORYLOCATION_H 17 #define LLVM_ANALYSIS_MEMORYLOCATION_H 28 class MemTransferInst;
30 class AtomicMemTransferInst;
31 class AtomicMemIntrinsic;
32 class AnyMemTransferInst;
33 class AnyMemIntrinsic;
34 class TargetLibraryInfo;
63 Unknown = ~uint64_t(0),
64 ImpreciseBit = uint64_t(1) << 63,
65 MapEmpty = Unknown - 1,
66 MapTombstone = Unknown - 2,
69 MaxValue = (MapTombstone - 1) & ~ImpreciseBit,
76 enum DirectConstruction { Direct };
78 constexpr
LocationSize(uint64_t Raw, DirectConstruction): Value(Raw) {}
80 static_assert(Unknown & ImpreciseBit,
"Unknown is imprecise by definition.");
89 : Value(Raw > MaxValue ? Unknown : Raw) {}
91 static LocationSize
precise(uint64_t Value) {
return LocationSize(Value); }
99 return LocationSize(Value | ImpreciseBit, Direct);
103 return LocationSize(Unknown, Direct);
108 return LocationSize(MapTombstone, Direct);
111 return LocationSize(MapEmpty, Direct);
128 assert(
hasValue() &&
"Getting value from an unknown LocationSize!");
129 return Value & ~ImpreciseBit;
135 return (Value & ImpreciseBit) == 0;
142 return Value == Other.Value;
146 return !(*
this == Other);
158 uint64_t
toRaw()
const {
return Value; }
180 enum : uint64_t { UnknownSize = ~UINT64_C(0) };
211 return get(cast<LoadInst>(Inst));
213 return get(cast<StoreInst>(Inst));
214 case Instruction::VAArg:
215 return get(cast<VAArgInst>(Inst));
216 case Instruction::AtomicCmpXchg:
217 return get(cast<AtomicCmpXchgInst>(Inst));
218 case Instruction::AtomicRMW:
219 return get(cast<AtomicRMWInst>(Inst));
241 return getForArgument(Call, ArgIdx, &TLI);
247 : Ptr(Ptr), Size(Size), AATags(AATags) {}
268 return Ptr == Other.
Ptr && Size == Other.
Size && AATags == Other.
AATags;
bool operator==(const LocationSize &Other) const
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
This class represents lattice values for constants.
static bool isEqual(const LocationSize &LHS, const LocationSize &RHS)
an instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
MemoryLocation getWithNewPtr(const Value *NewPtr) const
static constexpr LocationSize unknown()
static LocationSize precise(uint64_t Value)
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
static Optional< MemoryLocation > getOrNone(const Instruction *Inst)
static LocationSize getEmptyKey()
#define LLVM_UNLIKELY(EXPR)
static constexpr LocationSize mapTombstone()
bool operator!=(const LocationSize &Other) const
static LocationSize getTombstoneKey()
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
An instruction for storing to memory.
uint64_t getValue() const
MemoryLocation getWithoutAATags() const
MemoryLocation getWithNewSize(LocationSize NewSize) const
LocationSize unionWith(LocationSize Other) const
static constexpr LocationSize mapEmpty()
LocationSize Size
The maximum size of the location, in address-units, or UnknownSize if the size is not known...
bool operator==(const MemoryLocation &Other) const
MemoryLocation(const Value *Ptr=nullptr, LocationSize Size=LocationSize::unknown(), const AAMDNodes &AATags=AAMDNodes())
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
constexpr LocationSize(uint64_t Raw)
const Value * Ptr
The address of the start of the location.
Representation for a specific memory location.
This is the common base class for memset/memcpy/memmove.
static unsigned getHashValue(const LocationSize &Val)
Provides information about what library functions are available for the current target.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
static bool isEqual(const MemoryLocation &LHS, const MemoryLocation &RHS)
void print(raw_ostream &OS) const
This class wraps the llvm.memcpy/memmove intrinsics.
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
static LocationSize upperBound(uint64_t Value)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
LLVM Value Representation.
This class implements an extremely fast bulk output stream that can only output to a stream...
static MemoryLocation getForArgument(const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo &TLI)
static MemoryLocation getTombstoneKey()
static MemoryLocation getEmptyKey()
static unsigned getHashValue(const MemoryLocation &Val)