47 "Attempting to pack a reserved value");
49 return uint64_t(ElemSizeArg) << 32 |
53 static std::pair<unsigned, Optional<unsigned>>
55 unsigned NumElems = Num & std::numeric_limits<unsigned>::max();
56 unsigned ElemSizeArg = Num >> 32;
60 NumElemsArg = NumElems;
61 return std::make_pair(ElemSizeArg, NumElemsArg);
81 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
101 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
110 assert(Align <= 0x40000000 &&
"Alignment too large.");
111 return get(
Context, Alignment, Align);
117 assert(Align <= 0x100 &&
"Alignment too large.");
118 return get(
Context, StackAlignment, Align);
123 assert(Bytes &&
"Bytes must be non-zero.");
124 return get(
Context, Dereferenceable, Bytes);
129 assert(Bytes &&
"Bytes must be non-zero.");
130 return get(
Context, DereferenceableOrNull, Bytes);
136 assert(!(ElemSizeArg == 0 && NumElemsArg && *NumElemsArg == 0) &&
137 "Invalid allocsize arguments -- given allocsize(0, 0)");
158 if (!pImpl)
return None;
160 "Invalid attribute type to get the kind as an enum!");
165 if (!pImpl)
return 0;
167 "Expected the attribute to be an integer attribute!");
174 "Invalid attribute type to get the kind as a string!");
181 "Invalid attribute type to get the value as a string!");
196 "Trying to get alignment from non-alignment attribute!");
202 "Trying to get alignment from non-alignment attribute!");
208 "Trying to get dereferenceable bytes from "
209 "non-dereferenceable attribute!");
215 "Trying to get dereferenceable bytes from "
216 "non-dereferenceable attribute!");
222 "Trying to get allocsize args from non-allocsize attribute");
227 if (!pImpl)
return "";
230 return "sanitize_address";
232 return "alwaysinline";
246 return "inaccessiblememonly";
247 if (
hasAttribute(Attribute::InaccessibleMemOrArgMemOnly))
248 return "inaccessiblemem_or_argmemonly";
270 return "noduplicate";
272 return "noimplicitfloat";
276 return "nonlazybind";
300 return "returns_twice";
314 return "sanitize_thread";
316 return "sanitize_memory";
332 Result += (InAttrGrp) ?
"=" :
" ";
337 auto AttrWithBytesToString = [&](
const char *
Name) {
352 return AttrWithBytesToString(
"alignstack");
355 return AttrWithBytesToString(
"dereferenceable");
358 return AttrWithBytesToString(
"dereferenceable_or_null");
365 std::string Result =
"allocsize(";
366 Result +=
utostr(ElemSize);
369 Result +=
utostr(*NumElems);
385 if (AttrVal.empty())
return Result;
403 if (!pImpl && !A.pImpl)
return false;
404 if (!pImpl)
return true;
405 if (!A.pImpl)
return false;
406 return *pImpl < *A.pImpl;
415 void EnumAttributeImpl::anchor() {}
416 void IntAttributeImpl::anchor() {}
417 void StringAttributeImpl::anchor() {}
489 std::sort(SortedAttrs.begin(), SortedAttrs.end());
502 void *Mem = ::operator
new(totalSizeToAlloc<Attribute>(SortedAttrs.size()));
562 std::pair<unsigned, Optional<unsigned>>
567 return std::make_pair(0, 0);
575 Str +=
I->getAsString(InAttrGrp);
585 AttributeSet(const_cast<AttributeSetImpl *>(
this)).dump();
594 ArrayRef<std::pair<unsigned, AttributeSetNode*> > Attrs) {
606 void *Mem = ::operator
new(
607 AttributeSetImpl::totalSizeToAlloc<IndexAttrPair>(Attrs.size()));
609 pImpl->
AttrsLists.InsertNode(PA, InsertPoint);
617 ArrayRef<std::pair<unsigned, Attribute> > Attrs){
622 assert(std::is_sorted(Attrs.begin(), Attrs.end(),
623 [](
const std::pair<unsigned, Attribute> &LHS,
624 const std::pair<unsigned, Attribute> &RHS) {
625 return LHS.first < RHS.first;
626 }) &&
"Misordered Attributes list!");
628 [](
const std::pair<unsigned, Attribute> &Pair) {
631 "Pointless attribute!");
637 E = Attrs.end();
I !=
E; ) {
638 unsigned Index =
I->first;
640 while (
I !=
E &&
I->first == Index) {
648 return getImpl(C, AttrPairVec);
675 case Attribute::Alignment:
678 case Attribute::StackAlignment:
681 case Attribute::Dereferenceable:
685 case Attribute::DereferenceableOrNull:
689 case Attribute::AllocSize: {
701 for (
const auto &TDA : B.
td_attrs())
704 return get(
C, Attrs);
712 return get(
C, Attrs);
720 return get(
C, Attrs);
725 if (Attrs.
size() == 1)
return Attrs[0];
735 for (
unsigned I = 1,
E = Attrs.
size();
I !=
E; ++
I) {
739 ANVI = AttrNodeVec.
begin(), ANVE;
743 ANVE = AttrNodeVec.
end();
744 while (ANVI != ANVE && ANVI->first <= AI->first)
746 ANVI = AttrNodeVec.
insert(ANVI, *AI) + 1;
750 return getImpl(C, AttrNodeVec);
756 return addAttributes(C, Index, AttributeSet::get(C, Index, Kind));
763 return addAttributes(C, Index, AttributeSet::get(C, Index, B));
769 unsigned I = 0,
E = pImpl ? pImpl->getNumSlots() : 0;
770 auto IdxI = Indices.
begin(), IdxE = Indices.
end();
773 while (I !=
E && IdxI != IdxE) {
777 AttrSet.
emplace_back(AttributeSet::get(C, std::make_pair(*IdxI++, A)));
791 AttrSet.
emplace_back(AttributeSet::get(C, std::make_pair(*IdxI++, A)));
793 return get(
C, AttrSet);
798 if (!pImpl)
return Attrs;
799 if (!Attrs.pImpl)
return *
this;
806 assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
807 "Attempt to change alignment!");
812 uint64_t NumAttrs = pImpl->getNumSlots();
814 uint64_t LastIndex = 0;
815 for (
unsigned I = 0,
E = NumAttrs;
I !=
E; ++
I) {
831 IE = Attrs.pImpl->
end(
I); II !=
IE; ++II)
836 AttrSet.
push_back(AttributeSet::get(C, Index, B));
839 for (
unsigned I = LastIndex,
E = NumAttrs;
I <
E; ++
I)
842 return get(
C, AttrSet);
860 if (!Attrs.pImpl)
return *
this;
865 "Attempt to change alignment!");
869 uint64_t NumAttrs = pImpl->getNumSlots();
871 uint64_t LastIndex = 0;
872 for (
unsigned I = 0,
E = NumAttrs;
I !=
E; ++
I) {
891 AttrSet.push_back(AttributeSet::get(C, Index, B));
894 for (
unsigned I = LastIndex,
E = NumAttrs;
I <
E; ++
I)
897 return get(
C, AttrSet);
910 uint64_t NumAttrs = pImpl->getNumSlots();
912 uint64_t LastIndex = 0;
913 for (
unsigned I = 0,
E = NumAttrs;
I !=
E; ++
I) {
927 AttrSet.push_back(AttributeSet::get(C, Index, B));
930 for (
unsigned I = LastIndex,
E = NumAttrs;
I <
E; ++
I)
933 return get(
C, AttrSet);
937 uint64_t Bytes)
const {
940 return addAttributes(C, Index, AttributeSet::get(C, Index, B));
945 uint64_t Bytes)
const {
948 return addAttributes(C, Index, AttributeSet::get(C, Index, B));
953 unsigned ElemSizeArg,
957 return addAttributes(C, Index, AttributeSet::get(C, Index, B));
965 return pImpl->getContext();
970 AttributeSet::get(pImpl->getContext(),
978 AttributeSet::get(pImpl->getContext(),
987 AttributeSet::get(pImpl->getContext(),
1010 return pImpl && pImpl->hasFnAttribute(Kind);
1018 unsigned *Index)
const {
1019 if (!pImpl)
return false;
1021 for (
unsigned I = 0,
E = pImpl->getNumSlots();
I !=
E; ++
I)
1023 IE = pImpl->end(
I); II !=
IE; ++II)
1024 if (II->hasAttribute(Attr)) {
1025 if (Index) *Index = pImpl->getSlotIndex(
I);
1064 std::pair<unsigned, Optional<unsigned>>
1072 return ASN ? ASN->
getAsString(InAttrGrp) : std::string(
"");
1076 if (!pImpl)
return nullptr;
1079 for (
unsigned I = 0,
E = pImpl->getNumSlots();
I !=
E; ++
I)
1080 if (pImpl->getSlotIndex(
I) == Index)
1081 return pImpl->getSlotNode(
I);
1089 return pImpl->begin(Slot);
1095 return pImpl->end(Slot);
1103 return pImpl ? pImpl->getNumSlots() : 0;
1108 "Slot # out of range!");
1109 return pImpl->getSlotIndex(Slot);
1114 "Slot # out of range!");
1115 return pImpl->getSlotAttributes(Slot);
1139 : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
1140 DerefOrNullBytes(0), AllocSizeArgs(0) {
1148 IE = pImpl->
end(
I); II !=
IE; ++II)
1157 TargetDepAttrs.clear();
1158 Alignment = StackAlignment = DerefBytes = DerefOrNullBytes = 0;
1164 assert(Val != Attribute::Alignment && Val != Attribute::StackAlignment &&
1165 Val != Attribute::Dereferenceable && Val != Attribute::AllocSize &&
1166 "Adding integer attribute without adding a value!");
1180 if (Kind == Attribute::Alignment)
1182 else if (Kind == Attribute::StackAlignment)
1184 else if (Kind == Attribute::Dereferenceable)
1186 else if (Kind == Attribute::DereferenceableOrNull)
1188 else if (Kind == Attribute::AllocSize)
1194 TargetDepAttrs[
A] = V;
1202 if (Val == Attribute::Alignment)
1204 else if (Val == Attribute::StackAlignment)
1206 else if (Val == Attribute::Dereferenceable)
1208 else if (Val == Attribute::DereferenceableOrNull)
1209 DerefOrNullBytes = 0;
1210 else if (Val == Attribute::AllocSize)
1217 unsigned Slot = ~0U;
1224 assert(Slot != ~0U &&
"Couldn't find index in AttributeSet!");
1240 std::map<std::string, std::string>::iterator
I = TargetDepAttrs.find(A);
1241 if (I != TargetDepAttrs.end())
1242 TargetDepAttrs.erase(I);
1251 if (Align == 0)
return *
this;
1254 assert(Align <= 0x40000000 &&
"Alignment too large.");
1256 Attrs[Attribute::Alignment] =
true;
1263 if (Align == 0)
return *
this;
1266 assert(Align <= 0x100 &&
"Alignment too large.");
1268 Attrs[Attribute::StackAlignment] =
true;
1269 StackAlignment = Align;
1274 if (Bytes == 0)
return *
this;
1276 Attrs[Attribute::Dereferenceable] =
true;
1285 Attrs[Attribute::DereferenceableOrNull] =
true;
1286 DerefOrNullBytes = Bytes;
1297 assert(RawArgs &&
"Invalid allocsize arguments -- given allocsize(0, 0)");
1299 Attrs[Attribute::AllocSize] =
true;
1302 AllocSizeArgs = RawArgs;
1309 Alignment = B.Alignment;
1311 if (!StackAlignment)
1312 StackAlignment = B.StackAlignment;
1315 DerefBytes = B.DerefBytes;
1317 if (!DerefOrNullBytes)
1318 DerefOrNullBytes = B.DerefOrNullBytes;
1321 AllocSizeArgs = B.AllocSizeArgs;
1326 TargetDepAttrs[
I.first] =
I.second;
1336 if (B.StackAlignment)
1342 if (B.DerefOrNullBytes)
1343 DerefOrNullBytes = 0;
1345 if (B.AllocSizeArgs)
1351 TargetDepAttrs.erase(
I.first);
1358 if ((Attrs & B.Attrs).any())
1370 return TargetDepAttrs.find(A) != TargetDepAttrs.end();
1374 return !Attrs.none() || !TargetDepAttrs.empty();
1378 unsigned Slot = ~0U;
1385 assert(Slot != ~0U &&
"Couldn't find the index!");
1390 if (Attrs[
I->getKindAsEnum()])
1394 return TargetDepAttrs.find(Attr.
getKindAsString())!=TargetDepAttrs.end();
1402 return Alignment != 0;
1406 if (Attrs != B.Attrs)
1410 E = TargetDepAttrs.end();
I !=
E; ++
I)
1411 if (B.TargetDepAttrs.find(
I->first) == B.TargetDepAttrs.end())
1414 return Alignment == B.Alignment && StackAlignment == B.StackAlignment &&
1415 DerefBytes == B.DerefBytes;
1445 return Incompatible;
1448 template<
typename AttrClass>
1459 template<
typename AttrClass>
1461 if (AttrClass::isSet(Caller, AttrClass::getKind()) &&
1462 !AttrClass::isSet(Callee, AttrClass::getKind()))
1463 AttrClass::set(Caller, AttrClass::getKind(),
false);
1471 template<
typename AttrClass>
1473 if (!AttrClass::isSet(Caller, AttrClass::getKind()) &&
1474 AttrClass::isSet(Callee, AttrClass::getKind()))
1475 AttrClass::set(Caller, AttrClass::getKind(),
true);
1494 Caller.
addFnAttr(Attribute::StackProtectReq);
1495 }
else if (Callee.
hasFnAttribute(Attribute::StackProtectStrong) &&
1498 Caller.
addFnAttr(Attribute::StackProtectStrong);
1502 Caller.
addFnAttr(Attribute::StackProtect);
1505 #define GET_ATTR_COMPAT_FUNC
1506 #include "AttributesCompatFunc.inc"
1510 return hasCompatibleFnAttrs(Caller, Callee);
1516 mergeFnAttrs(Caller, Callee);
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
void push_back(const T &Elt)
uint64_t getDereferenceableBytes() const
std::string getAsString(bool InAttrGrp) const
AttributeSet addAllocSizeAttr(LLVMContext &C, unsigned Index, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Add the allocsize attribute to the attribute set at the given index.
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function. ...
FoldingSet< AttributeImpl > AttrsSet
static std::pair< unsigned, Optional< unsigned > > unpackAllocSizeArgs(uint64_t Num)
AttributeSet getParamAttributes(unsigned Index) const
The attributes for the specified index are returned.
unsigned getStackAlignment(unsigned Index) const
Get the stack alignment.
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align)
Return a uniquified Attribute object that has the specific alignment set.
void PrintEscapedString(StringRef Name, raw_ostream &Out)
PrintEscapedString - Print each character of the specified string, escaping it if it is not printable...
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
uint64_t getAlignment() const
Retrieve the alignment attribute, if it exists.
uint64_t getDereferenceableOrNullBytes() const
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
AttributeSet getSlotAttributes(unsigned Slot) const
Retrieve the attributes for the given "slot" in the AttrNode list.
iterator begin(unsigned Slot) const
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
unsigned getParamAlignment(unsigned Index) const
Return the alignment for the specified function parameter.
unsigned getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
The two locations do not alias at all.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
void Profile(FoldingSetNodeID &ID) const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
bool hasAlignmentAttr() const
Return true if the builder has an alignment attribute.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
bool areInlineCompatible(const Function &Caller, const Function &Callee)
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
bool hasAttributes() const
void removeAttributes(unsigned i, AttributeSet Attrs)
removes the attributes from the list of attributes.
StringRef getKindAsString() const
Return the attribute's kind as a string.
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute...
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
FoldingSet< AttributeSetImpl > AttrsLists
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly...
AttrBuilder & addAllocSizeAttr(unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
This turns one (or two) ints into the form used internally in Attribute.
This file contains the simple types necessary to represent the attributes associated with functions a...
Attribute::AttrKind getKindAsEnum() const
No attributes have been set.
void AddInteger(signed I)
AttributeSet addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
friend class AttributeSet
bool operator<(const AttributeImpl &AI) const
Used when sorting the attributes.
uint64_t getDereferenceableBytes() const
Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is return...
static bool isEqual(const Function &Caller, const Function &Callee)
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs(unsigned Index) const
Get the allocsize argument numbers (or pair(0, 0) if unknown).
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
static std::string utostr(uint64_t X, bool isNeg=false)
unsigned getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
iterator end(unsigned Slot) const
AttrBuilder & remove(const AttrBuilder &B)
Remove the attributes from the builder.
static GCRegistry::Add< OcamlGC > B("ocaml","ocaml 3.10-compatible GC")
AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
size_t size() const
size - Get the array size.
StringRef getKindAsString() const
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align)
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
unsigned getNumSlots() const
Return the number of slots used in this attribute list.
bool operator==(const AttrBuilder &B)
constexpr bool isPowerOf2_32(uint32_t Value)
isPowerOf2_32 - This function returns true if the argument is a power of two > 0. ...
iterator begin(unsigned Slot) const
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
bool isStringAttribute() const
AttributeSet getSlotAttributes(unsigned Slot) const
Return the attributes at the given slot.
AttributeSet addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Retrieve the allocsize args, if the allocsize attribute exists.
unsigned getSlotIndex(unsigned Slot) const
Get the index of the given "slot" in the AttrNodes list.
static const unsigned AllocSizeNumElemsNotPresent
unsigned getAlignment() const
uint64_t getDereferenceableOrNullBytes(unsigned Index) const
Get the number of dereferenceable_or_null bytes (or zero if unknown).
This file defines various helper methods and classes used by LLVMContextImpl for creating and managin...
bool overlaps(const AttrBuilder &B) const
Return true if the builder has any attribute that's in the specified builder.
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
bool empty() const
empty - Check if the array is empty.
Sentinal value useful for loops.
static void setAND(Function &Caller, const Function &Callee)
Compute the logical AND of the attributes of the caller and the callee.
StringRef getValueAsString() const
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool isPointerTy() const
True if this is an instance of PointerType.
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute...
bool isIntAttribute() const
bool hasAttribute(Attribute::AttrKind Kind) const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVMContextImpl *const pImpl
bool hasAttribute(Attribute::AttrKind A) const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeSet::FunctionIndex, Kind) but may be faster.
static void adjustCallerSSPLevel(Function &Caller, const Function &Callee)
If the inlined function had a higher stack protection level than the calling function, then bump up the caller's stack protection level.
LLVMContext & getContext() const
Retrieve the LLVM context.
uint64_t getValueAsInt() const
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
iterator end(unsigned Slot) const
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
static void setOR(Function &Caller, const Function &Callee)
Compute the logical OR of the attributes of the caller and the callee.
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
void mergeAttributesForInlining(Function &Caller, const Function &Callee)
Merge caller's and callee's attributes.
AttributeSet removeAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Remove the specified attributes at the specified index from this attribute list.
friend class AttributeSetImpl
bool isIntegerTy() const
True if this is an instance of IntegerType.
static AttributeSetNode * get(LLVMContext &C, ArrayRef< Attribute > Attrs)
std::map< std::string, std::string >::const_iterator td_const_iterator
unsigned getStackAlignment() const
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
iterator insert(iterator I, T &&Elt)
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
AttributeSet removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
void emplace_back(ArgTypes &&...Args)
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
unsigned getSlotIndex(unsigned Slot) const
Return the index for the given slot.
AttributeSet addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
bool hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
ArrayRef< Attribute >::iterator iterator
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
bool isEnumAttribute() const
void AddString(StringRef String)
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
uint64_t getDereferenceableOrNullBytes() const
AttributeSet getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
AttrBuilder & removeAttributes(AttributeSet A, uint64_t Index)
Remove the attributes from the builder.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
StringRef getValueAsString() const
Return the attribute's value as a string.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
A raw_ostream that writes to an std::string.
LLVM Value Representation.
bool hasAttributes() const
Return true if the builder has IR-level attributes.
AttrBuilder typeIncompatible(Type *Ty)
Which attributes cannot be applied to a type.
AttrBuilder & addStackAlignmentAttr(unsigned Align)
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attri...
FoldingSet< AttributeSetNode > AttrsSetNodes
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
StringRef - Represent a constant reference to a string, i.e.
AttrBuilder & addAlignmentAttr(unsigned Align)
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute...
static uint64_t packAllocSizeArgs(unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Attribute getAttribute(Attribute::AttrKind Kind) const
unsigned getNumSlots() const
Return the number of slots used in this attribute list.
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr)
This lazily constructs the LazyValueInfoImpl.
AttributeSet addAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Add attributes to the attribute set at the given index.
std::pair< unsigned, AttributeSetNode * > IndexAttrPair
static GCRegistry::Add< ErlangGC > A("erlang","erlang-compatible garbage collector")
uint64_t getStackAlignment() const
Retrieve the stack alignment attribute, if it exists.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
AttributeSet getFnAttributes() const
The function attributes are returned.