15#ifndef LLVM_LIB_IR_ATTRIBUTEIMPL_H
16#define LLVM_LIB_IR_ATTRIBUTEIMPL_H
121 if (!Values.
empty())
ID.AddString(Values);
140 ID.AddInteger(Val.
size());
141 for (
auto &CR : Val) {
142 CR.getLower().Profile(
ID);
143 CR.getUpper().Profile(
ID);
148static_assert(std::is_trivially_destructible<AttributeImpl>::value,
149 "AttributeImpl should be trivially destructible");
169 "Can't create a None attribute!");
182 "Wrong kind for int attribute!");
195 size_t numTrailingObjects(OverloadToken<char>)
const {
196 return KindSize + 1 + ValSize + 1;
202 ValSize(Val.
size()) {
203 char *TrailingString = getTrailingObjects<char>();
206 TrailingString[KindSize] =
'\0';
207 llvm::copy(Val, &TrailingString[KindSize + 1]);
208 TrailingString[KindSize + 1 + ValSize] =
'\0';
212 return StringRef(getTrailingObjects<char>(), KindSize);
215 return StringRef(getTrailingObjects<char>() + KindSize + 1, ValSize);
219 return TrailingObjects::totalSizeToAlloc<char>(Kind.size() + 1 +
246 private TrailingObjects<ConstantRangeListAttributeImpl, ConstantRange> {
250 size_t numTrailingObjects(OverloadToken<ConstantRange>)
const {
return Size; }
257 ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
258 std::uninitialized_copy(Val.
begin(), Val.
end(), TrailingCR);
262 ConstantRange *TrailingCR = getTrailingObjects<ConstantRange>();
263 for (
unsigned I = 0;
I != Size; ++
I)
268 return ArrayRef(getTrailingObjects<ConstantRange>(), Size);
272 return TrailingObjects::totalSizeToAlloc<ConstantRange>(Val.
size());
278 uint8_t AvailableAttrs[12] = {};
280 "Too many attributes");
284 return AvailableAttrs[Kind / 8] & (1 << (Kind % 8));
288 AvailableAttrs[Kind / 8] |= 1 << (Kind % 8);
317 void operator delete(
void *p) { ::operator
delete(p); }
339 std::optional<std::pair<unsigned, std::optional<unsigned>>>
getAllocSizeArgs()
360 for (
const auto &Attr : AttrList)
376 unsigned NumAttrSets;
383 size_t numTrailingObjects(OverloadToken<AttributeSet>) {
return NumAttrSets; }
402 unsigned *
Index =
nullptr)
const;
415static_assert(std::is_trivially_destructible<AttributeListImpl>::value,
416 "AttributeListImpl should be trivially destructible");
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file defines the DenseMap class.
This file defines a hash set that can be used to remove duplication of nodes in a graph.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This header defines support for implementing classes that have some trailing object (or arrays of obj...
void Profile(FoldingSetNodeID &id) const
Used to insert APInt objects, or objects that contain APInt objects, into FoldingSets.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
void addAttribute(Attribute::AttrKind Kind)
bool hasAttribute(Attribute::AttrKind Kind) const
bool isConstantRangeAttribute() const
bool hasAttribute(Attribute::AttrKind A) const
void Profile(FoldingSetNodeID &ID) const
Type * getValueAsType() const
Attribute::AttrKind getKindAsEnum() const
static void Profile(FoldingSetNodeID &ID, StringRef Kind, StringRef Values)
bool operator<(const AttributeImpl &AI) const
Used when sorting the attributes.
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, uint64_t Val)
AttributeImpl & operator=(const AttributeImpl &)=delete
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind)
uint64_t getValueAsInt() const
bool isIntAttribute() const
bool isTypeAttribute() const
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, ArrayRef< ConstantRange > Val)
AttributeImpl(AttrEntryKind KindID)
AttributeImpl(const AttributeImpl &)=delete
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, Type *Ty)
bool getValueAsBool() const
StringRef getKindAsString() const
StringRef getValueAsString() const
bool isEnumAttribute() const
ArrayRef< ConstantRange > getValueAsConstantRangeList() const
bool isConstantRangeListAttribute() const
@ ConstantRangeListAttrEntry
bool isStringAttribute() const
static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, const ConstantRange &CR)
const ConstantRange & getValueAsConstantRange() 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 hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the AttributeSet or the FunctionIndex has an enum attribute of the given kind.
AttributeListImpl & operator=(const AttributeListImpl &)=delete
AttributeListImpl(const AttributeListImpl &)=delete
MaybeAlign getStackAlignment() const
uint64_t getDereferenceableOrNullBytes() const
std::optional< unsigned > getVScaleRangeMax() const
bool hasAttribute(Attribute::AttrKind Kind) const
Type * getAttributeType(Attribute::AttrKind Kind) const
AllocFnKind getAllocKind() const
unsigned getVScaleRangeMin() const
MaybeAlign getAlignment() const
MemoryEffects getMemoryEffects() const
UWTableKind getUWTableKind() const
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
uint64_t getDereferenceableBytes() const
unsigned getNumAttributes() const
Return the number of attributes this AttributeList contains.
AttributeSetNode & operator=(const AttributeSetNode &)=delete
static void Profile(FoldingSetNodeID &ID, ArrayRef< Attribute > AttrList)
void Profile(FoldingSetNodeID &ID) const
AttributeSetNode(const AttributeSetNode &)=delete
std::string getAsString(bool InAttrGrp) const
static AttributeSetNode * get(LLVMContext &C, const AttrBuilder &B)
bool hasAttributes() const
FPClassTest getNoFPClass() const
Attribute getAttribute(Attribute::AttrKind Kind) const
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
@ None
No attributes have been set.
@ EndAttrKinds
Sentinel value useful for loops.
static bool isIntAttrKind(AttrKind Kind)
static bool isEnumAttrKind(AttrKind Kind)
const ConstantRange & getConstantRangeValue() const
ConstantRangeAttributeImpl(Attribute::AttrKind Kind, const ConstantRange &CR)
ArrayRef< ConstantRange > getConstantRangeListValue() const
static size_t totalSizeToAlloc(ArrayRef< ConstantRange > Val)
~ConstantRangeListAttributeImpl()
ConstantRangeListAttributeImpl(Attribute::AttrKind Kind, ArrayRef< ConstantRange > Val)
This class represents a range of values.
const APInt & getLower() const
Return the lower value for this range.
const APInt & getUpper() const
Return the upper value for this range.
EnumAttributeImpl(AttrEntryKind ID, Attribute::AttrKind Kind)
Attribute::AttrKind getEnumKind() const
EnumAttributeImpl(Attribute::AttrKind Kind)
Node - This class is used to maintain the singly linked bucket list in a folding set.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
IntAttributeImpl(Attribute::AttrKind Kind, uint64_t Val)
uint64_t getValue() const
This is an important class for using LLVM in a threaded context.
StringAttributeImpl(StringRef Kind, StringRef Val=StringRef())
StringRef getStringKind() const
StringRef getStringValue() const
static size_t totalSizeToAlloc(StringRef Kind, StringRef Val)
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
constexpr size_t size() const
size - Get the string size.
See the file comment for details on the usage of the TrailingObjects type.
Type * getTypeValue() const
TypeAttributeImpl(Attribute::AttrKind Kind, Type *Ty)
The instances of the Type class are immutable: once they are created, they are never changed.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
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.
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
OutputIt copy(R &&Range, OutputIt Out)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.