11const unsigned AttrEscapedIndex = 0;
12const unsigned AttrUnknownIndex = 1;
13const unsigned AttrGlobalIndex = 2;
14const unsigned AttrCallerIndex = 3;
15const unsigned AttrFirstArgIndex = 4;
17const unsigned AttrMaxNumArgs = AttrLastArgIndex - AttrFirstArgIndex;
22const AliasAttr AttrNone = 0;
23const AliasAttr AttrEscaped = 1 << AttrEscapedIndex;
24const AliasAttr AttrUnknown = 1 << AttrUnknownIndex;
25const AliasAttr AttrGlobal = 1 << AttrGlobalIndex;
26const AliasAttr AttrCaller = 1 << AttrCallerIndex;
27const AliasAttr ExternalAttrMask = AttrEscaped | AttrUnknown | AttrGlobal;
38 return Attr.test(AttrUnknownIndex) || Attr.test(AttrCallerIndex);
45 if (ArgNum >= AttrMaxNumArgs)
49 return AliasAttr(1ULL << (ArgNum + AttrFirstArgIndex));
53 if (isa<GlobalValue>(Val))
56 if (
auto *
Arg = dyn_cast<Argument>(&Val))
60 if (!
Arg->hasNoAliasAttr() &&
Arg->getType()->isPointerTy())
66 return Attr.reset(AttrEscapedIndex)
67 .reset(AttrUnknownIndex)
68 .reset(AttrCallerIndex)
76std::optional<InstantiatedValue>
79 auto *V = (
Index == 0) ? &Call : Call.getArgOperand(
Index - 1);
80 if (V->getType()->isPointerTy())
85std::optional<InstantiatedRelation>
96std::optional<InstantiatedAttr>
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
This file defines various utility types and functions useful to summary-based alias analysis.
BlockVerifier::State From
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
LLVM Value Representation.
std::optional< InstantiatedValue > instantiateInterfaceValue(InterfaceValue IValue, CallBase &Call)
AliasAttrs getExternallyVisibleAttrs(AliasAttrs Attr)
Given an AliasAttrs, return a new AliasAttrs that only contains attributes meaningful to the caller.
bool hasUnknownOrCallerAttr(AliasAttrs Attr)
AliasAttrs getAttrCaller()
AttrCaller represent whether the said pointer comes from a source not known to the current function b...
std::optional< InstantiatedRelation > instantiateExternalRelation(ExternalRelation ERelation, CallBase &Call)
bool hasEscapedAttr(AliasAttrs Attr)
std::bitset< NumAliasAttrs > AliasAttrs
These are attributes that an alias analysis can use to mark certain special properties of a given poi...
AliasAttrs getAttrNone()
Attr represent whether the said pointer comes from an unknown source (such as opaque memory or an int...
std::optional< InstantiatedAttr > instantiateExternalAttribute(ExternalAttribute EAttr, CallBase &Call)
bool hasCallerAttr(AliasAttrs Attr)
AliasAttrs getGlobalOrArgAttrFromValue(const Value &Val)
AttrGlobal represent whether the said pointer is a global value.
static const unsigned NumAliasAttrs
The number of attributes that AliasAttr should contain.
bool isGlobalOrArgAttr(AliasAttrs Attr)
AliasAttrs getAttrUnknown()
AttrUnknown represent whether the said pointer comes from a source not known to alias analyses (such ...
bool hasUnknownAttr(AliasAttrs Attr)
AliasAttrs getAttrEscaped()
AttrEscaped represent whether the said pointer comes from a known source but escapes to the unknown w...
static AliasAttr argNumberToAttr(unsigned ArgNum)
This is an optimization pass for GlobalISel generic memory operations.
We use ExternalAttribute to describe an externally visible AliasAttrs for parameters/return value.
We use ExternalRelation to describe an externally visible aliasing relations between parameters/retur...
This is the result of instantiating ExternalAttribute at a particular callsite.
This is the result of instantiating ExternalRelation at a particular callsite.
This is the result of instantiating InterfaceValue at a particular call.
We use InterfaceValue to describe parameters/return value, as well as potential memory locations that...