64 "Attempting to pack a reserved value");
66 return uint64_t(ElemSizeArg) << 32 |
70 static std::pair<unsigned, Optional<unsigned>>
73 unsigned ElemSizeArg = Num >> 32;
77 NumElemsArg = NumElems;
78 return std::make_pair(ElemSizeArg, NumElemsArg);
98 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
118 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
127 assert(Align <= 0x40000000 &&
"Alignment too large.");
134 assert(Align <= 0x100 &&
"Alignment too large.");
140 assert(Bytes &&
"Bytes must be non-zero.");
141 return get(
Context, Dereferenceable, Bytes);
146 assert(Bytes &&
"Bytes must be non-zero.");
147 return get(
Context, DereferenceableOrNull, Bytes);
153 assert(!(ElemSizeArg == 0 && NumElemsArg && *NumElemsArg == 0) &&
154 "Invalid allocsize arguments -- given allocsize(0, 0)");
175 if (!pImpl)
return None;
177 "Invalid attribute type to get the kind as an enum!");
182 if (!pImpl)
return 0;
184 "Expected the attribute to be an integer attribute!");
191 "Invalid attribute type to get the kind as a string!");
198 "Invalid attribute type to get the value as a string!");
213 "Trying to get alignment from non-alignment attribute!");
219 "Trying to get alignment from non-alignment attribute!");
225 "Trying to get dereferenceable bytes from "
226 "non-dereferenceable attribute!");
232 "Trying to get dereferenceable bytes from "
233 "non-dereferenceable attribute!");
239 "Trying to get allocsize args from non-allocsize attribute");
244 if (!pImpl)
return "";
247 return "sanitize_address";
249 return "alwaysinline";
263 return "inaccessiblememonly";
264 if (
hasAttribute(Attribute::InaccessibleMemOrArgMemOnly))
265 return "inaccessiblemem_or_argmemonly";
287 return "noduplicate";
289 return "noimplicitfloat";
293 return "nonlazybind";
317 return "returns_twice";
321 return "speculatable";
333 return "sanitize_thread";
335 return "sanitize_memory";
351 Result += (InAttrGrp) ?
"=" :
" ";
356 auto AttrWithBytesToString = [&](
const char *
Name) {
371 return AttrWithBytesToString(
"alignstack");
374 return AttrWithBytesToString(
"dereferenceable");
377 return AttrWithBytesToString(
"dereferenceable_or_null");
384 std::string Result =
"allocsize(";
385 Result +=
utostr(ElemSize);
388 Result +=
utostr(*NumElems);
404 if (AttrVal.empty())
return Result;
422 if (!pImpl && !A.pImpl)
return false;
423 if (!pImpl)
return true;
424 if (!A.pImpl)
return false;
425 return *pImpl < *A.pImpl;
435 void EnumAttributeImpl::anchor() {}
437 void IntAttributeImpl::anchor() {}
439 void StringAttributeImpl::anchor() {}
605 : std::pair<unsigned, Optional<unsigned>>(0, 0);
609 return SetNode ? SetNode->
getAsString(InAttrGrp) :
"";
613 return SetNode ? SetNode->
begin() :
nullptr;
617 return SetNode ? SetNode->
end() :
nullptr;
620 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
633 : AvailableAttrs(0), NumAttrs(Attrs.size()) {
635 std::copy(Attrs.
begin(), Attrs.
end(), getTrailingObjects<Attribute>());
654 std::sort(SortedAttrs.begin(), SortedAttrs.end());
667 void *Mem = ::operator
new(totalSizeToAlloc<Attribute>(SortedAttrs.size()));
686 case Attribute::Alignment:
689 case Attribute::StackAlignment:
692 case Attribute::Dereferenceable:
696 case Attribute::DereferenceableOrNull:
700 case Attribute::AllocSize: {
712 for (
const auto &TDA : B.
td_attrs())
769 std::pair<unsigned, Optional<unsigned>>
774 return std::make_pair(0, 0);
798 return static_cast<int>(Index) + 1;
803 : AvailableFunctionAttrs(0),
Context(C), NumAttrSets(Sets.size()) {
804 assert(!Sets.
empty() &&
"pointless AttributeListImpl");
807 std::copy(Sets.
begin(), Sets.
end(), getTrailingObjects<AttributeSet>());
811 sizeof(AvailableFunctionAttrs) * CHAR_BIT,
812 "Too many attributes");
814 "function should be stored in slot 0");
827 for (
const auto &Set : Sets)
831 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
843 assert(!AttrSets.
empty() &&
"pointless AttributeListImpl");
851 pImpl->AttrsLists.FindNodeOrInsertPos(ID, InsertPoint);
857 void *Mem = ::operator
new(
858 AttributeListImpl::totalSizeToAlloc<AttributeSet>(AttrSets.
size()));
860 pImpl->AttrsLists.InsertNode(PA, InsertPoint);
869 ArrayRef<std::pair<unsigned, Attribute>> Attrs) {
875 [](
const std::pair<unsigned, Attribute> &LHS,
876 const std::pair<unsigned, Attribute> &RHS) {
877 return LHS.first < RHS.first;
878 }) &&
"Misordered Attributes list!");
880 [](
const std::pair<unsigned, Attribute> &Pair) {
883 "Pointless attribute!");
889 E = Attrs.
end(); I !=
E; ) {
890 unsigned Index = I->first;
892 while (I !=
E && I->first == Index) {
900 return get(
C, AttrPairVec);
905 ArrayRef<std::pair<unsigned, AttributeSet>> Attrs) {
911 [](
const std::pair<unsigned, AttributeSet> &LHS,
912 const std::pair<unsigned, AttributeSet> &RHS) {
913 return LHS.first < RHS.first;
915 "Misordered Attributes list!");
917 [](
const std::pair<unsigned, AttributeSet> &Pair) {
918 return !Pair.second.hasAttributes();
920 "Pointless attribute!");
922 unsigned MaxIndex = Attrs.
back().first;
925 for (
auto Pair : Attrs)
937 unsigned NumSets = 0;
938 for (
size_t I = ArgAttrs.
size(); I != 0; --
I) {
1002 if (Attrs.
size() == 1)
1005 unsigned MaxSize = 0;
1014 for (
unsigned I = 0; I < MaxSize; ++
I) {
1017 CurBuilder.
merge(
List.getAttributes(I - 1));
1021 return getImpl(C, NewAttrSets);
1060 assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
1061 "Attempt to change alignment!");
1066 if (Index >= AttrSets.
size())
1067 AttrSets.
resize(Index + 1);
1083 if (MaxIndex >= AttrSets.
size())
1084 AttrSets.
resize(MaxIndex + 1);
1086 for (
unsigned ArgNo : ArgNos) {
1124 if (Index >= AttrSets.
size())
1125 AttrSets.
resize(Index + 1);
1135 unsigned WithoutIndex)
const {
1148 uint64_t Bytes)
const {
1156 uint64_t Bytes)
const {
1164 unsigned ElemSizeArg,
1203 return pImpl && pImpl->hasFnAttribute(Kind);
1216 unsigned *Index)
const {
1217 if (!pImpl)
return false;
1259 std::pair<unsigned, Optional<unsigned>>
1272 return pImpl->begin()[Index];
1276 return pImpl ? pImpl->
begin() :
nullptr;
1280 return pImpl ? pImpl->
end() :
nullptr;
1288 return pImpl ? pImpl->NumAttrSets : 0;
1291 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1322 TargetDepAttrs.clear();
1323 Alignment = StackAlignment = DerefBytes = DerefOrNullBytes = 0;
1329 assert(Val != Attribute::Alignment && Val != Attribute::StackAlignment &&
1330 Val != Attribute::Dereferenceable && Val != Attribute::AllocSize &&
1331 "Adding integer attribute without adding a value!");
1345 if (Kind == Attribute::Alignment)
1347 else if (Kind == Attribute::StackAlignment)
1349 else if (Kind == Attribute::Dereferenceable)
1351 else if (Kind == Attribute::DereferenceableOrNull)
1353 else if (Kind == Attribute::AllocSize)
1359 TargetDepAttrs[
A] = V;
1367 if (Val == Attribute::Alignment)
1369 else if (Val == Attribute::StackAlignment)
1371 else if (Val == Attribute::Dereferenceable)
1373 else if (Val == Attribute::DereferenceableOrNull)
1374 DerefOrNullBytes = 0;
1375 else if (Val == Attribute::AllocSize)
1387 std::map<std::string, std::string>::iterator I = TargetDepAttrs.find(A);
1388 if (I != TargetDepAttrs.end())
1389 TargetDepAttrs.erase(I);
1398 if (Align == 0)
return *
this;
1401 assert(Align <= 0x40000000 &&
"Alignment too large.");
1403 Attrs[Attribute::Alignment] =
true;
1410 if (Align == 0)
return *
this;
1413 assert(Align <= 0x100 &&
"Alignment too large.");
1415 Attrs[Attribute::StackAlignment] =
true;
1416 StackAlignment =
Align;
1421 if (Bytes == 0)
return *
this;
1423 Attrs[Attribute::Dereferenceable] =
true;
1432 Attrs[Attribute::DereferenceableOrNull] =
true;
1433 DerefOrNullBytes = Bytes;
1444 assert(RawArgs &&
"Invalid allocsize arguments -- given allocsize(0, 0)");
1446 Attrs[Attribute::AllocSize] =
true;
1449 AllocSizeArgs = RawArgs;
1456 Alignment = B.Alignment;
1458 if (!StackAlignment)
1459 StackAlignment = B.StackAlignment;
1462 DerefBytes = B.DerefBytes;
1464 if (!DerefOrNullBytes)
1465 DerefOrNullBytes = B.DerefOrNullBytes;
1468 AllocSizeArgs = B.AllocSizeArgs;
1473 TargetDepAttrs[I.first] = I.second;
1483 if (B.StackAlignment)
1489 if (B.DerefOrNullBytes)
1490 DerefOrNullBytes = 0;
1492 if (B.AllocSizeArgs)
1498 TargetDepAttrs.erase(I.first);
1505 if ((Attrs & B.Attrs).any())
1517 return TargetDepAttrs.find(A) != TargetDepAttrs.end();
1521 return !Attrs.none() || !TargetDepAttrs.empty();
1528 if (Attr.isEnumAttribute() || Attr.isIntAttribute()) {
1529 if (
contains(Attr.getKindAsEnum()))
1532 assert(Attr.isStringAttribute() &&
"Invalid attribute kind!");
1533 return contains(Attr.getKindAsString());
1541 return Alignment != 0;
1545 if (Attrs != B.Attrs)
1549 E = TargetDepAttrs.end(); I !=
E; ++
I)
1550 if (B.TargetDepAttrs.find(I->first) == B.TargetDepAttrs.end())
1553 return Alignment == B.Alignment && StackAlignment == B.StackAlignment &&
1554 DerefBytes == B.DerefBytes;
1584 return Incompatible;
1587 template<
typename AttrClass>
1598 template<
typename AttrClass>
1600 if (AttrClass::isSet(Caller, AttrClass::getKind()) &&
1601 !AttrClass::isSet(Callee, AttrClass::getKind()))
1602 AttrClass::set(Caller, AttrClass::getKind(),
false);
1610 template<
typename AttrClass>
1612 if (!AttrClass::isSet(Caller, AttrClass::getKind()) &&
1613 AttrClass::isSet(Callee, AttrClass::getKind()))
1614 AttrClass::set(Caller, AttrClass::getKind(),
true);
1630 Caller.
addFnAttr(Attribute::StackProtectReq);
1631 }
else if (Callee.
hasFnAttribute(Attribute::StackProtectStrong) &&
1634 Caller.
addFnAttr(Attribute::StackProtectStrong);
1638 Caller.
addFnAttr(Attribute::StackProtect);
1656 uint64_t CalleeStackProbeSize;
1661 uint64_t CallerStackProbeSize;
1665 if (CallerStackProbeSize > CalleeStackProbeSize) {
1674 #define GET_ATTR_COMPAT_FUNC
1675 #include "AttributesCompatFunc.inc"
1679 return hasCompatibleFnAttrs(Caller, Callee);
1684 mergeFnAttrs(Caller, Callee);
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
std::enable_if< std::numeric_limits< T >::is_signed, bool >::type getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
void push_back(const T &Elt)
uint64_t getDereferenceableBytes() const
std::string getAsString(bool InAttrGrp) const
static constexpr unsigned attrIdxToArrayIdx(unsigned Index)
Map from AttributeList index to the internal array index.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
FoldingSet< AttributeImpl > AttrsSet
static void adjustCallerStackProbeSize(Function &Caller, const Function &Callee)
If the inlined function defines the size of guard region on the stack, then ensure that the calling f...
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
static std::pair< unsigned, Optional< unsigned > > unpackAllocSizeArgs(uint64_t Num)
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
uint64_t getDereferenceableOrNullBytes(unsigned Index) const
Get the number of dereferenceable_or_null bytes (or zero if unknown).
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align)
Return a uniquified Attribute object that has the specific alignment set.
unsigned getStackAlignment() const
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)
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
uint64_t getAlignment() const
Retrieve the alignment attribute, if it exists.
unsigned getRetAlignment() const
Return the alignment of the return value.
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.
unsigned getAlignment() const
friend class AttributeSet
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
unsigned getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
The two locations do not alias at all.
static AttributeSetNode * get(LLVMContext &C, const AttrBuilder &B)
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
AttributeListImpl(LLVMContext &C, ArrayRef< AttributeSet > Sets)
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
void reserve(size_type N)
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.
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
bool areInlineCompatible(const Function &Caller, const Function &Callee)
StringRef getKindAsString() const
Return the attribute's kind as a string.
AttributeSet getParamAttributes(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
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...
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
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)
AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
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)
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
uint64_t getDereferenceableBytes() const
unsigned getNumAttributes() const
Return the number of attributes in this set.
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.
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
AttrBuilder & remove(const AttrBuilder &B)
Remove the attributes from the builder.
AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
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
AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align)
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
bool operator==(const AttrBuilder &B)
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
void Profile(FoldingSetNodeID &ID) const
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
static AttributeSet get(LLVMContext &C, const AttrBuilder &B)
std::map< std::string, std::string >::const_iterator td_const_iterator
constexpr bool isPowerOf2_32(uint32_t Value)
Return true if the argument is a power of two > 0.
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
unsigned index_end() const
static void adjustCallerStackProbes(Function &Caller, const Function &Callee)
If the inlined function required stack probes, then ensure that the calling function has those too...
friend class AttributeListImpl
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Retrieve the allocsize args, if the allocsize attribute exists.
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
AttributeList addAllocSizeAttr(LLVMContext &C, unsigned Index, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Add the allocsize attribute to the attribute set at the given index.
static const unsigned AllocSizeNumElemsNotPresent
unsigned getAlignment() const
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
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
unsigned getStackAlignment(unsigned Index) const
Get the stack alignment.
bool isPointerTy() const
True if this is an instance of PointerType.
unsigned index_begin() const
Use these to iterate over the valid attribute indices.
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute...
AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
AttributeList addAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
bool isIntAttribute() const
unsigned getNumAttrSets() const
bool hasAttribute(Attribute::AttrKind Kind) const
LLVMContextImpl *const pImpl
const T & back() const
back - Get the last element.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. ...
bool hasAttribute(Attribute::AttrKind A) const
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.
uint64_t getValueAsInt() const
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs(unsigned Index) const
Get the allocsize argument numbers (or pair(0, 0) if unknown).
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
std::string getAsString(bool InAttrGrp=false) const
AttrBuilder & removeAttributes(AttributeList A, uint64_t WithoutIndex)
Remove the attributes from the builder.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool hasAttributes() const
Return true if attributes exists in this set.
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
AttributeSet getFnAttributes() const
The function attributes are returned.
static void setOR(Function &Caller, const Function &Callee)
Compute the logical OR of the attributes of the caller and the callee.
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.
unsigned getNumAttributes() const
Return the number of attributes this AttributeList contains.
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
bool isIntegerTy() const
True if this is an instance of IntegerType.
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 hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
llvm_unreachable("Unknown RegBank!")
AttributeList removeAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
void removeAttributes(unsigned i, const AttrBuilder &Attrs)
removes the attributes from the list of attributes.
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.
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
friend class AttributeList
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
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()=default
AttributeSet is a trivially copyable value type.
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())
AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
A raw_ostream that writes to an std::string.
uint64_t getDereferenceableOrNullBytes() const
unsigned getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
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
LLVMContext & getContext() const
Retrieve the LLVM context.
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
StringRef - Represent a constant reference to a string, i.e.
AttributeSet removeAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes from this set.
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...
AttrBuilder & addAlignmentAttr(unsigned Align)
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute...
void sort(Policy policy, RandomAccessIterator Start, RandomAccessIterator End, const Comparator &Comp=Comparator())
static uint64_t packAllocSizeArgs(unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
Attribute getAttribute(Attribute::AttrKind Kind) const
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr)
This lazily constructs the LazyValueInfoImpl.
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
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...