15#ifndef LLVM_LIB_IR_ATTRIBUTEIMPL_H
16#define LLVM_LIB_IR_ATTRIBUTEIMPL_H
124 if (!Values.
empty())
ID.AddString(Values);
143 ID.AddInteger(Val.
size());
144 for (
auto &CR : Val) {
145 CR.getLower().Profile(
ID);
146 CR.getUpper().Profile(
ID);
151static_assert(std::is_trivially_destructible<AttributeImpl>::value,
152 "AttributeImpl should be trivially destructible");
172 "Can't create a None attribute!");
185 "Wrong kind for int attribute!");
193 private TrailingObjects<StringAttributeImpl, char> {
194 friend TrailingObjects;
202 ValSize(Val.
size()) {
206 TrailingString[KindSize] =
'\0';
207 llvm::copy(Val, &TrailingString[KindSize + 1]);
208 TrailingString[KindSize + 1 + ValSize] =
'\0';
246 private TrailingObjects<ConstantRangeListAttributeImpl, ConstantRange> {
247 friend TrailingObjects;
275 uint8_t AvailableAttrs[16] = {};
277 "Too many attributes");
281 return AvailableAttrs[Kind / 8] & (1 << (Kind % 8));
285 AvailableAttrs[Kind / 8] |= 1 << (Kind % 8);
293class AttributeSetNode final
295 private TrailingObjects<AttributeSetNode, Attribute> {
296 friend TrailingObjects;
312 AttributeSetNode &
operator=(
const AttributeSetNode &) =
delete;
314 void operator delete(
void *p) { ::operator
delete(p); }
324 return AvailableAttrs.hasAttribute(Kind);
336 std::optional<std::pair<unsigned, std::optional<unsigned>>>
getAllocSizeArgs()
358 for (
const auto &Attr : AttrList)
369 private TrailingObjects<AttributeListImpl, AttributeSet> {
371 friend TrailingObjects;
374 unsigned NumAttrSets;
390 return AvailableFunctionAttrs.hasAttribute(Kind);
397 unsigned *Index =
nullptr)
const;
410static_assert(std::is_trivially_destructible<AttributeListImpl>::value,
411 "AttributeListImpl should be trivially destructible");
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This file defines the DenseMap class.
This file defines a hash set that can be used to remove duplication of nodes in a graph.
This header defines support for implementing classes that have some trailing object (or arrays of obj...
LLVM_ABI 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
This class represents a single, uniqued attribute.
int cmp(const AttributeImpl &AI, bool KindOnly) const
Used to sort attributes.
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
const AttributeSet * iterator
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(ArrayRef< AttributeSet > Sets)
AttributeListImpl & operator=(const AttributeListImpl &)=delete
friend class AttributeList
AttributeListImpl(const AttributeListImpl &)=delete
This class represents a group of attributes that apply to one element: function, return type,...
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
CaptureInfo getCaptureInfo() const
unsigned getVScaleRangeMin() const
MaybeAlign getAlignment() const
MemoryEffects getMemoryEffects() const
UWTableKind getUWTableKind() const
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
const Attribute * iterator
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
This class holds the attributes for a particular argument, parameter, function, or return value.
Functions, function parameters, and return types can have attributes to indicate how they should be t...
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)
Represents which components of the pointer may be captured in which location.
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)
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.
static constexpr std::enable_if_t< std::is_same_v< Foo< TrailingTys... >, Foo< Tys... > >, size_t > totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t >::type... Counts)
Returns the total size of an object if it were allocated with the given trailing object counts.
const T * getTrailingObjects() const
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.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ 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.
FoldingSetBase::Node FoldingSetNode
MemoryEffectsBase< IRMemLocation > MemoryEffects
Summary of how a function affects memory in the program.
auto uninitialized_copy(R &&Src, IterTy Dst)
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt copy(R &&Range, OutputIt Out)
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.