10 const unsigned AttrEscapedIndex = 0;
11 const unsigned AttrUnknownIndex = 1;
12 const unsigned AttrGlobalIndex = 2;
13 const unsigned AttrCallerIndex = 3;
14 const unsigned AttrFirstArgIndex = 4;
16 const unsigned AttrMaxNumArgs = AttrLastArgIndex - AttrFirstArgIndex;
21 const AliasAttr AttrNone = 0;
22 const AliasAttr AttrEscaped = 1 << AttrEscapedIndex;
23 const AliasAttr AttrUnknown = 1 << AttrUnknownIndex;
24 const AliasAttr AttrGlobal = 1 << AttrGlobalIndex;
25 const AliasAttr AttrCaller = 1 << AttrCallerIndex;
26 const AliasAttr ExternalAttrMask = AttrEscaped | AttrUnknown | AttrGlobal;
37 return Attr.test(AttrUnknownIndex) || Attr.test(AttrCallerIndex);
44 if (ArgNum >= AttrMaxNumArgs)
48 return AliasAttr(1ULL << (ArgNum + AttrFirstArgIndex));
52 if (isa<GlobalValue>(Val))
55 if (
auto *Arg = dyn_cast<Argument>(&Val))
59 if (!Arg->hasNoAliasAttr() && Arg->getType()->isPointerTy())
65 return Attr.reset(AttrEscapedIndex)
66 .reset(AttrUnknownIndex)
67 .reset(AttrCallerIndex)
77 auto Index = IValue.
Index;
Optional< InstantiatedValue > instantiateInterfaceValue(InterfaceValue IValue, CallSite CS)
static const unsigned NumAliasAttrs
The number of attributes that AliasAttr should contain.
We use ExternalRelation to describe an externally visible aliasing relations between parameters/retur...
This is the result of instantiating InterfaceValue at a particular callsite.
We use ExternalAttribute to describe an externally visible AliasAttrs for parameters/return value...
We use InterfaceValue to describe parameters/return value, as well as potential memory locations that...
static AliasAttr argNumberToAttr(unsigned ArgNum)
AliasAttrs getAttrEscaped()
AttrEscaped represent whether the said pointer comes from a known source but escapes to the unknown w...
Optional< InstantiatedAttr > instantiateExternalAttribute(ExternalAttribute EAttr, CallSite CS)
bool hasUnknownAttr(AliasAttrs Attr)
bool isGlobalOrArgAttr(AliasAttrs Attr)
bool isPointerTy() const
True if this is an instance of PointerType.
AliasAttrs getAttrUnknown()
AttrUnknown represent whether the said pointer comes from a source not known to alias analyses (such ...
InstrTy * getInstruction() const
ValTy * getArgument(unsigned ArgNo) const
AliasAttrs getExternallyVisibleAttrs(AliasAttrs Attr)
Given an AliasAttrs, return a new AliasAttrs that only contains attributes meaningful to the caller...
Type * getType() const
All values are typed, get the type of this value.
This file defines various utility types and functions useful to summary-based alias analysis...
AliasAttrs getGlobalOrArgAttrFromValue(const Value &Val)
AttrGlobal represent whether the said pointer is a global value.
bool hasUnknownOrCallerAttr(AliasAttrs Attr)
std::bitset< NumAliasAttrs > AliasAttrs
These are attributes that an alias analysis can use to mark certain special properties of a given poi...
bool hasCallerAttr(AliasAttrs Attr)
AliasAttrs getAttrCaller()
AttrCaller represent whether the said pointer comes from a source not known to the current function b...
This is the result of instantiating ExternalRelation at a particular callsite.
bool hasEscapedAttr(AliasAttrs Attr)
LLVM Value Representation.
AliasAttrs getAttrNone()
Attr represent whether the said pointer comes from an unknown source (such as opaque memory or an int...
Optional< InstantiatedRelation > instantiateExternalRelation(ExternalRelation ERelation, CallSite CS)
This is the result of instantiating ExternalAttribute at a particular callsite.