Go to the documentation of this file.
15 #ifndef LLVM_LIB_IR_ATTRIBUTEIMPL_H
16 #define LLVM_LIB_IR_ATTRIBUTEIMPL_H
91 if (Val)
ID.AddInteger(Val);
96 if (!Values.
empty())
ID.AddString(Values);
106 static_assert(std::is_trivially_destructible<AttributeImpl>::value,
107 "AttributeImpl should be trivially destructible");
127 "Can't create a None attribute!");
140 "Wrong kind for int attribute!");
153 size_t numTrailingObjects(OverloadToken<char>)
const {
154 return KindSize + 1 + ValSize + 1;
160 ValSize(Val.
size()) {
161 char *TrailingString = getTrailingObjects<char>();
164 TrailingString[KindSize] =
'\0';
165 llvm::copy(Val, &TrailingString[KindSize + 1]);
166 TrailingString[KindSize + 1 + ValSize] =
'\0';
170 return StringRef(getTrailingObjects<char>(), KindSize);
173 return StringRef(getTrailingObjects<char>() + KindSize + 1, ValSize);
177 return TrailingObjects::totalSizeToAlloc<char>(
Kind.size() + 1 +
194 uint8_t AvailableAttrs[12] = {};
196 "Too many attributes");
200 return AvailableAttrs[
Kind / 8] & (1 << (
Kind % 8));
204 AvailableAttrs[
Kind / 8] |= 1 << (
Kind % 8);
233 void operator delete(
void *
p) { ::operator
delete(
p); }
272 for (
const auto &Attr : AttrList)
288 unsigned NumAttrSets;
295 size_t numTrailingObjects(OverloadToken<AttributeSet>) {
return NumAttrSets; }
314 unsigned *
Index =
nullptr)
const;
327 static_assert(std::is_trivially_destructible<AttributeListImpl>::value,
328 "AttributeListImpl should be trivially destructible");
332 #endif // LLVM_LIB_IR_ATTRIBUTEIMPL_H
@ EndAttrKinds
Sentinal value useful for loops.
EnumAttributeImpl(Attribute::AttrKind Kind)
This is an optimization pass for GlobalISel generic memory operations.
Type * getTypeValue() const
unsigned getNumAttributes() const
Return the number of attributes this AttributeList contains.
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, uint64_t Val)
static bool isIntAttrKind(AttrKind Kind)
AttributeImpl & operator=(const AttributeImpl &)=delete
TypeAttributeImpl(Attribute::AttrKind Kind, Type *Ty)
The instances of the Type class are immutable: once they are created, they are never changed.
OutputIt copy(R &&Range, OutputIt Out)
bool hasAttribute(Attribute::AttrKind Kind) const
uint64_t getDereferenceableBytes() const
AttributeImpl(AttrEntryKind KindID)
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, Type *Ty)
AttributeSetNode & operator=(const AttributeSetNode &)=delete
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the AttributeSet or the FunctionIndex has an enum attribute of the given kind.
the resulting code requires compare and branches when and if * p
MaybeAlign getAlignment() const
AttributeListImpl & operator=(const AttributeListImpl &)=delete
(vector float) vec_cmpeq(*A, *B) C
bool isEnumAttribute() const
StringRef getKindAsString() const
bool hasAttribute(Attribute::AttrKind A) const
Attribute::AttrKind getKindAsEnum() const
bool isIntAttribute() const
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
bool hasAttribute(Attribute::AttrKind Kind) const
StringRef getStringKind() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
constexpr LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
This is an important class for using LLVM in a threaded context.
Type * getAttributeType(Attribute::AttrKind Kind) const
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
void Profile(FoldingSetNodeID &ID) const
StringRef getValueAsString() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
uint64_t getDereferenceableOrNullBytes() const
bool isTypeAttribute() const
MaybeAlign getStackAlignment() const
static void Profile(FoldingSetNodeID &ID, StringRef Kind, StringRef Values)
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
bool operator<(const AttributeImpl &AI) const
Used when sorting the attributes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
StringRef - Represent a constant reference to a string, i.e.
Node - This class is used to maintain the singly linked bucket list in a folding set.
Attribute::AttrKind getEnumKind() const
Attribute getAttribute(Attribute::AttrKind Kind) const
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
UWTableKind getUWTableKind() const
void Profile(FoldingSetNodeID &ID) const
static size_t totalSizeToAlloc(StringRef Kind, StringRef Val)
uint64_t getValue() const
constexpr LLVM_NODISCARD size_t size() const
size - Get the string size.
bool getValueAsBool() const
AttributeListImpl(ArrayRef< AttributeSet > Sets)
IntAttributeImpl(Attribute::AttrKind Kind, uint64_t Val)
static void Profile(FoldingSetNodeID &ID, ArrayRef< Attribute > AttrList)
StringRef getStringValue() const
See the file comment for details on the usage of the TrailingObjects type.
bool hasAttributes() const
StringAttributeImpl(StringRef Kind, StringRef Val=StringRef())
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
std::string getAsString(bool InAttrGrp) const
void addAttribute(Attribute::AttrKind Kind)
Optional< unsigned > getVScaleRangeMax() const
Type * getValueAsType() const
void Profile(FoldingSetNodeID &ID) const
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 isStringAttribute() const
uint64_t getValueAsInt() const
static AttributeSetNode * get(LLVMContext &C, const AttrBuilder &B)
unsigned getVScaleRangeMin() const
EnumAttributeImpl(AttrEntryKind ID, Attribute::AttrKind Kind)
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs() const