27 #include "llvm/Config/llvm-config.h" 64 "Attempting to pack a reserved value");
66 return uint64_t(ElemSizeArg) << 32 |
67 NumElemsArg.
getValueOr(AllocSizeNumElemsNotPresent);
70 static std::pair<unsigned, Optional<unsigned>>
73 unsigned ElemSizeArg = Num >> 32;
76 if (NumElems != AllocSizeNumElemsNotPresent)
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.");
146 assert(Bytes &&
"Bytes must be non-zero.");
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!");
189 if (!pImpl)
return {};
191 "Invalid attribute type to get the kind as a string!");
196 if (!pImpl)
return {};
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 "sanitize_hwaddress";
251 return "alwaysinline";
265 return "inaccessiblememonly";
267 return "inaccessiblemem_or_argmemonly";
289 return "noduplicate";
291 return "noimplicitfloat";
295 return "nonlazybind";
309 return "optforfuzzing";
323 return "returns_twice";
327 return "speculative_load_hardening";
329 return "speculatable";
339 return "shadowcallstack";
345 return "sanitize_thread";
347 return "sanitize_memory";
363 Result += (InAttrGrp) ?
"=" :
" ";
368 auto AttrWithBytesToString = [&](
const char *
Name) {
383 return AttrWithBytesToString(
"alignstack");
386 return AttrWithBytesToString(
"dereferenceable");
389 return AttrWithBytesToString(
"dereferenceable_or_null");
396 std::string Result =
"allocsize(";
397 Result +=
utostr(ElemSize);
400 Result +=
utostr(*NumElems);
416 if (AttrVal.empty())
return Result;
434 if (!pImpl && !A.pImpl)
return false;
435 if (!pImpl)
return true;
436 if (!A.pImpl)
return false;
437 return *pImpl < *A.pImpl;
447 void EnumAttributeImpl::anchor() {}
449 void IntAttributeImpl::anchor() {}
451 void StringAttributeImpl::anchor() {}
538 if (!hasAttributes())
545 for (
const auto I : *
this)
575 return SetNode ? SetNode->getNumAttributes() : 0;
579 return SetNode ? SetNode->hasAttribute(Kind) :
false;
583 return SetNode ? SetNode->hasAttribute(Kind) :
false;
587 return SetNode ? SetNode->getAttribute(Kind) :
Attribute();
591 return SetNode ? SetNode->getAttribute(Kind) :
Attribute();
595 return SetNode ? SetNode->getAlignment() : 0;
599 return SetNode ? SetNode->getStackAlignment() : 0;
603 return SetNode ? SetNode->getDereferenceableBytes() : 0;
607 return SetNode ? SetNode->getDereferenceableOrNullBytes() : 0;
611 return SetNode ? SetNode->getAllocSizeArgs()
612 : std::pair<unsigned, Optional<unsigned>>(0, 0);
616 return SetNode ? SetNode->getAsString(InAttrGrp) :
"";
620 return SetNode ? SetNode->begin() :
nullptr;
624 return SetNode ? SetNode->end() :
nullptr;
627 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 640 : AvailableAttrs(0), NumAttrs(Attrs.
size()) {
642 llvm::copy(Attrs, getTrailingObjects<Attribute>());
644 for (
const auto I : *
this) {
645 if (!
I.isStringAttribute()) {
646 AvailableAttrs |= ((uint64_t)1) <<
I.getKindAsEnum();
663 for (
const auto Attr : SortedAttrs)
674 void *Mem = ::operator
new(totalSizeToAlloc<Attribute>(SortedAttrs.size()));
719 for (
const auto &TDA : B.
td_attrs())
726 for (
const auto I : *
this)
727 if (
I.hasAttribute(Kind))
734 for (
const auto I : *
this)
735 if (
I.hasAttribute(Kind))
742 for (
const auto I : *
this)
743 if (
I.hasAttribute(Kind))
749 for (
const auto I : *
this)
751 return I.getAlignment();
756 for (
const auto I : *
this)
758 return I.getStackAlignment();
763 for (
const auto I : *
this)
765 return I.getDereferenceableBytes();
770 for (
const auto I : *
this)
772 return I.getDereferenceableOrNullBytes();
776 std::pair<unsigned, Optional<unsigned>>
778 for (
const auto I : *
this)
780 return I.getAllocSizeArgs();
781 return std::make_pair(0, 0);
789 Str +=
I->getAsString(InAttrGrp);
808 : AvailableFunctionAttrs(0),
Context(C), NumAttrSets(Sets.
size()) {
809 assert(!Sets.
empty() &&
"pointless AttributeListImpl");
812 llvm::copy(Sets, getTrailingObjects<AttributeSet>());
816 sizeof(AvailableFunctionAttrs) * CHAR_BIT,
817 "Too many attributes");
819 "function should be stored in slot 0");
820 for (
const auto I : Sets[0]) {
821 if (!
I.isStringAttribute())
822 AvailableFunctionAttrs |= 1ULL <<
I.getKindAsEnum();
832 for (
const auto &Set : Sets)
836 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 848 assert(!AttrSets.
empty() &&
"pointless AttributeListImpl");
856 pImpl->AttrsLists.FindNodeOrInsertPos(ID, InsertPoint);
862 void *Mem = ::operator
new(
863 AttributeListImpl::totalSizeToAlloc<AttributeSet>(AttrSets.
size()));
865 pImpl->AttrsLists.InsertNode(PA, InsertPoint);
874 ArrayRef<std::pair<unsigned, Attribute>> Attrs) {
880 [](
const std::pair<unsigned, Attribute> &LHS,
881 const std::pair<unsigned, Attribute> &RHS) {
882 return LHS.first < RHS.first;
883 }) &&
"Misordered Attributes list!");
885 [](
const std::pair<unsigned, Attribute> &Pair) {
888 "Pointless attribute!");
894 E = Attrs.
end();
I !=
E; ) {
895 unsigned Index =
I->first;
897 while (
I !=
E &&
I->first == Index) {
905 return get(
C, AttrPairVec);
910 ArrayRef<std::pair<unsigned, AttributeSet>> Attrs) {
916 [](
const std::pair<unsigned, AttributeSet> &LHS,
917 const std::pair<unsigned, AttributeSet> &RHS) {
918 return LHS.first < RHS.first;
920 "Misordered Attributes list!");
922 [](
const std::pair<unsigned, AttributeSet> &Pair) {
923 return !Pair.second.hasAttributes();
925 "Pointless attribute!");
927 unsigned MaxIndex = Attrs.
back().first;
930 if (MaxIndex == FunctionIndex && Attrs.
size() > 1)
931 MaxIndex = Attrs[Attrs.
size() - 2].first;
934 for (
const auto Pair : Attrs)
946 unsigned NumSets = 0;
947 for (
size_t I = ArgAttrs.
size();
I != 0; --
I) {
948 if (ArgAttrs[
I - 1].hasAttributes()) {
994 for (
const auto K : Kinds)
1002 for (
const auto K : Kinds)
1011 if (Attrs.
size() == 1)
1014 unsigned MaxSize = 0;
1015 for (
const auto List : Attrs)
1023 for (
unsigned I = 0;
I < MaxSize; ++
I) {
1025 for (
const auto List : Attrs)
1030 return getImpl(C, NewAttrSets);
1035 if (hasAttribute(Index, Kind))
return *
this;
1038 return addAttributes(C, Index, B);
1046 return addAttributes(C, Index, B);
1053 return addAttributes(C, Index, B);
1069 assert((!OldAlign || !NewAlign || OldAlign == NewAlign) &&
1070 "Attempt to change alignment!");
1075 if (Index >= AttrSets.
size())
1076 AttrSets.
resize(Index + 1);
1092 if (MaxIndex >= AttrSets.
size())
1093 AttrSets.
resize(MaxIndex + 1);
1095 for (
unsigned ArgNo : ArgNos) {
1107 if (!hasAttribute(Index, Kind))
return *
this;
1113 AttrSets[
Index] = AttrSets[
Index].removeAttribute(C, Kind);
1120 if (!hasAttribute(Index, Kind))
return *
this;
1126 AttrSets[
Index] = AttrSets[
Index].removeAttribute(C, Kind);
1139 if (Index >= AttrSets.
size())
1140 AttrSets.
resize(Index + 1);
1142 AttrSets[
Index] = AttrSets[
Index].removeAttributes(C, AttrsToRemove);
1148 unsigned WithoutIndex)
const {
1152 if (WithoutIndex >= getNumAttrSets())
1161 uint64_t Bytes)
const {
1164 return addAttributes(C, Index, B);
1169 uint64_t Bytes)
const {
1172 return addAttributes(C, Index, B);
1177 unsigned ElemSizeArg,
1181 return addAttributes(C, Index, B);
1216 return pImpl && pImpl->hasFnAttribute(Kind);
1225 return hasAttribute(ArgNo + FirstArgIndex, Kind);
1229 unsigned *
Index)
const {
1230 if (!pImpl)
return false;
1232 for (
unsigned I = index_begin(),
E = index_end();
I !=
E; ++
I) {
1233 if (hasAttribute(
I, Attr)) {
1272 std::pair<unsigned, Optional<unsigned>>
1283 if (!pImpl || Index >= getNumAttrSets())
1285 return pImpl->begin()[
Index];
1289 return pImpl ? pImpl->
begin() :
nullptr;
1293 return pImpl ? pImpl->
end() :
nullptr;
1301 return pImpl ? pImpl->NumAttrSets : 0;
1304 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) 1308 for (
unsigned i = index_begin(), e = index_end(); i != e; ++i) {
1310 dbgs() <<
" { " << i <<
" => " << getAsString(i) <<
" }\n";
1324 for (
const auto &
A : AS)
1329 for (
const auto &
A : AS)
1335 TargetDepAttrs.clear();
1336 Alignment = StackAlignment = DerefBytes = DerefOrNullBytes = 0;
1344 "Adding integer attribute without adding a value!");
1372 TargetDepAttrs[
A] = V;
1387 DerefOrNullBytes = 0;
1400 auto I = TargetDepAttrs.find(A);
1401 if (
I != TargetDepAttrs.end())
1402 TargetDepAttrs.erase(
I);
1411 if (Align == 0)
return *
this;
1414 assert(Align <= 0x40000000 &&
"Alignment too large.");
1423 if (Align == 0)
return *
this;
1426 assert(Align <= 0x100 &&
"Alignment too large.");
1429 StackAlignment =
Align;
1434 if (Bytes == 0)
return *
this;
1446 DerefOrNullBytes = Bytes;
1457 assert(RawArgs &&
"Invalid allocsize arguments -- given allocsize(0, 0)");
1462 AllocSizeArgs = RawArgs;
1469 Alignment = B.Alignment;
1471 if (!StackAlignment)
1472 StackAlignment = B.StackAlignment;
1475 DerefBytes = B.DerefBytes;
1477 if (!DerefOrNullBytes)
1478 DerefOrNullBytes = B.DerefOrNullBytes;
1481 AllocSizeArgs = B.AllocSizeArgs;
1486 TargetDepAttrs[
I.first] =
I.second;
1496 if (B.StackAlignment)
1502 if (B.DerefOrNullBytes)
1503 DerefOrNullBytes = 0;
1505 if (B.AllocSizeArgs)
1511 TargetDepAttrs.erase(
I.first);
1518 if ((Attrs & B.Attrs).any())
1522 for (
const auto &
I : td_attrs())
1530 return TargetDepAttrs.find(A) != TargetDepAttrs.end();
1534 return !Attrs.none() || !TargetDepAttrs.
empty();
1540 for (
const auto Attr : AS) {
1541 if (Attr.isEnumAttribute() || Attr.isIntAttribute()) {
1542 if (
contains(Attr.getKindAsEnum()))
1545 assert(Attr.isStringAttribute() &&
"Invalid attribute kind!");
1546 return contains(Attr.getKindAsString());
1554 return Alignment != 0;
1558 if (Attrs != B.Attrs)
1562 E = TargetDepAttrs.end();
I !=
E; ++
I)
1563 if (B.TargetDepAttrs.find(
I->first) == B.TargetDepAttrs.end())
1566 return Alignment == B.Alignment && StackAlignment == B.StackAlignment &&
1567 DerefBytes == B.DerefBytes;
1597 return Incompatible;
1600 template<
typename AttrClass>
1611 template<
typename AttrClass>
1613 if (AttrClass::isSet(Caller, AttrClass::getKind()) &&
1614 !AttrClass::isSet(Callee, AttrClass::getKind()))
1615 AttrClass::set(Caller, AttrClass::getKind(),
false);
1623 template<
typename AttrClass>
1625 if (!AttrClass::isSet(Caller, AttrClass::getKind()) &&
1626 AttrClass::isSet(Callee, AttrClass::getKind()))
1627 AttrClass::set(Caller, AttrClass::getKind(),
true);
1669 uint64_t CalleeStackProbeSize;
1674 uint64_t CallerStackProbeSize;
1678 if (CallerStackProbeSize > CalleeStackProbeSize) {
1700 uint64_t CallerVectorWidth;
1704 uint64_t CalleeVectorWidth;
1708 if (CallerVectorWidth < CalleeVectorWidth)
1727 #define GET_ATTR_COMPAT_FUNC 1728 #include "AttributesCompatFunc.inc" 1732 return hasCompatibleFnAttrs(Caller, Callee);
1737 mergeFnAttrs(Caller, Callee);
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Retrieve the allocsize args, if the allocsize attribute exists.
unsigned getStackAlignment() const
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
const_iterator end(StringRef path)
Get end iterator over path.
constexpr char Align[]
Key for Kernel::Arg::Metadata::mAlign.
static constexpr unsigned attrIdxToArrayIdx(unsigned Index)
Map from AttributeList index to the internal array index.
StringRef getKindAsString() const
Return the attribute's kind as a string.
bool hasAttribute(Attribute::AttrKind A) const
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
const T & back() const
back - Get the last element.
FoldingSet< AttributeImpl > AttrsSet
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
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...
static std::pair< unsigned, Optional< unsigned > > unpackAllocSizeArgs(uint64_t Num)
This class represents lattice values for constants.
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute...
unsigned getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align)
Return a uniquified Attribute object that has the specific alignment set.
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
void push_back(const T &Elt)
unsigned getAlignment() const
constexpr T getValueOr(U &&value) const LLVM_LVALUE_FUNCTION
void printEscapedString(StringRef Name, raw_ostream &Out)
Print each character of the specified string, escaping it if it is not printable or if it is an escap...
Attribute getAttribute(Attribute::AttrKind Kind) const
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
static AttributeSetNode * get(LLVMContext &C, const AttrBuilder &B)
AttributeListImpl(LLVMContext &C, ArrayRef< AttributeSet > Sets)
unsigned getRetAlignment() const
Return the alignment of the return value.
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
std::string getAsString(bool InAttrGrp) const
void reserve(size_type N)
uint64_t getDereferenceableBytes() const
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
return AArch64::GPR64RegClass contains(Reg)
void Profile(FoldingSetNodeID &ID) const
bool areInlineCompatible(const Function &Caller, const Function &Callee)
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
uint64_t getDereferenceableOrNullBytes() const
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...
amdgpu Simplify well known AMD library false Value Value const Twine & Name
uint64_t getDereferenceableOrNullBytes() const
bool hasAttributes() const
Return true if the builder has IR-level attributes.
bool hasAlignmentAttr() const
Return true if the builder has an alignment attribute.
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
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...
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool isIntegerTy() const
True if this is an instance of IntegerType.
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...
bool isIntAttribute() const
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...
No attributes have been set.
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
void AddInteger(signed I)
bool hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
LLVMContext & getContext() const
Retrieve the LLVM context.
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
unsigned getStackAlignment() const
uint64_t getStackAlignment() const
Retrieve the stack alignment attribute, if it exists.
static bool isEqual(const Function &Caller, const Function &Callee)
LLVM_NODISCARD AttributeList removeAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
AttributeSet getParamAttributes(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
LLVM_NODISCARD LLVM_ATTRIBUTE_ALWAYS_INLINE bool empty() const
empty - Check if the string is empty.
uint64_t getDereferenceableOrNullBytes(unsigned Index) const
Get the number of dereferenceable_or_null bytes (or zero if unknown).
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
AttrBuilder & remove(const AttrBuilder &B)
Remove the attributes from the builder.
LLVM_NODISCARD AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
constexpr char Attrs[]
Key for Kernel::Metadata::mAttrs.
AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
amdgpu Simplify well known AMD library false Value * Callee
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align)
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
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...
unsigned getStackAlignment(unsigned Index) const
Get the stack alignment.
bool operator==(const AttrBuilder &B)
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LLVM_NODISCARD AttributeList addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
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.
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
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.
static void adjustCallerStackProbes(Function &Caller, const Function &Callee)
If the inlined function required stack probes, then ensure that the calling function has those too...
size_t size() const
size - Get the array size.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool isStringAttribute() const
bool isPointerTy() const
True if this is an instance of PointerType.
LLVM_NODISCARD AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
uint64_t getAlignment() const
Retrieve the alignment attribute, if it exists.
LLVM_NODISCARD 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 getNumAttributes() const
Return the number of attributes in this set.
This file defines various helper methods and classes used by LLVMContextImpl for creating and managin...
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
Attribute::AttrKind getKindAsEnum() const
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
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.
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...
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
uint64_t getDereferenceableBytes() const
StringRef getKindAsString() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
LLVMContextImpl *const pImpl
LLVM_NODISCARD AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
void sort(IteratorTy Start, IteratorTy End)
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.
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.
std::string getAsString(bool InAttrGrp=false) const
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).
auto size(R &&Range, typename std::enable_if< std::is_same< typename std::iterator_traits< decltype(Range.begin())>::iterator_category, std::random_access_iterator_tag >::value, void >::type *=nullptr) -> decltype(std::distance(Range.begin(), Range.end()))
Get the size of a range.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
unsigned getAlignment() const
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
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...
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs(unsigned Index) const
Get the allocsize argument numbers (or pair(0, 0) if unknown).
bool overlaps(const AttrBuilder &B) const
Return true if the builder has any attribute that's in the specified builder.
std::string utostr(uint64_t X, bool isNeg=false)
static void adjustNullPointerValidAttr(Function &Caller, const Function &Callee)
If the inlined function has "null-pointer-is-valid=true" attribute, set this attribute in the caller ...
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 getNumAttrSets() const
bool isEnumAttribute() const
iterator insert(iterator I, T &&Elt)
uint64_t getDereferenceableOrNullBytes() const
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
bool hasAttribute(Attribute::AttrKind Kind) const
void removeAttributes(unsigned i, const AttrBuilder &Attrs)
removes the attributes from the list of attributes.
unsigned getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
LLVM_NODISCARD AttributeList addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
unsigned getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
LLVM_NODISCARD AttributeList addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
void emplace_back(ArgTypes &&... Args)
StringRef getValueAsString() const
Return the attribute's value as a string.
LLVM_NODISCARD AttributeList removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
friend class AttributeList
void AddString(StringRef String)
uint64_t getValueAsInt() const
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
StringRef getValueAsString() const
void removeFnAttr(Attribute::AttrKind Kind)
Remove function attributes from this function.
LLVM_NODISCARD AttributeSet removeAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const
Remove the specified attributes from this set.
LLVM_NODISCARD AttributeList addAttributes(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
static void adjustMinLegalVectorWidth(Function &Caller, const Function &Callee)
If the inlined function defines a min legal vector width, then ensure the calling function has the sa...
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. ...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool hasAttributes() const
Return true if attributes exists in this set.
A raw_ostream that writes to an std::string.
LLVM Value Representation.
AttrBuilder typeIncompatible(Type *Ty)
Which attributes cannot be applied to a type.
AttributeSet getFnAttributes() const
The function attributes are returned.
AttrBuilder & addStackAlignmentAttr(unsigned Align)
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attri...
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
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)
bool nullPointerIsDefined() const
Check if null pointer dereferencing is considered undefined behavior for the function.
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const DataLayout *DL, DominatorTree *DT=nullptr)
This lazily constructs the LazyValueInfoImpl.
OutputIt copy(R &&Range, OutputIt Out)
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
bool empty() const
empty - Check if the array is empty.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...