class Attribute
Declaration
class Attribute { /* full declaration omitted */ };
Description
Functions, function parameters, and return types can have attributes to indicate how they should be treated by optimizations and code generation. This class represents one of those attributes. It's light-weight and should be passed around by-value.
Declared at: llvm/include/llvm/IR/Attributes.h:65
Member Variables
- private llvm::AttributeImpl* pImpl = nullptr
- public static const unsigned int NumIntAttrKinds = LastIntAttr - FirstIntAttr + 1
- public static const unsigned int NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1
Method Overview
- private Attribute(llvm::AttributeImpl * A)
- public Attribute()
- public void Profile(llvm::FoldingSetNodeID & ID) const
- public static bool canUseAsFnAttr(llvm::Attribute::AttrKind Kind)
- public static bool canUseAsParamAttr(llvm::Attribute::AttrKind Kind)
- public static bool canUseAsRetAttr(llvm::Attribute::AttrKind Kind)
- public static llvm::Attribute fromRawPointer(void * RawPtr)
- public static llvm::Attribute get(llvm::LLVMContext & Context, llvm::Attribute::AttrKind Kind, uint64_t Val = 0)
- public static llvm::Attribute get(llvm::LLVMContext & Context, llvm::StringRef Kind, llvm::StringRef Val = llvm::StringRef())
- public static llvm::Attribute get(llvm::LLVMContext & Context, llvm::Attribute::AttrKind Kind, llvm::Type * Ty)
- public llvm::MaybeAlign getAlignment() const
- public llvm::AllocFnKind getAllocKind() const
- public std::pair<unsigned int, Optional<unsigned int>> getAllocSizeArgs() const
- public std::string getAsString(bool InAttrGrp = false) const
- public static Attribute::AttrKind getAttrKindFromName(llvm::StringRef AttrName)
- public uint64_t getDereferenceableBytes() const
- public uint64_t getDereferenceableOrNullBytes() const
- public Attribute::AttrKind getKindAsEnum() const
- public llvm::StringRef getKindAsString() const
- public static llvm::StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)
- public void * getRawPointer() const
- public llvm::MaybeAlign getStackAlignment() const
- public llvm::UWTableKind getUWTableKind() const
- public Optional<unsigned int> getVScaleRangeMax() const
- public unsigned int getVScaleRangeMin() const
- public bool getValueAsBool() const
- public uint64_t getValueAsInt() const
- public llvm::StringRef getValueAsString() const
- public llvm::Type * getValueAsType() const
- public static llvm::Attribute getWithAlignment(llvm::LLVMContext & Context, llvm::Align Alignment)
- public static llvm::Attribute getWithAllocSizeArgs(llvm::LLVMContext & Context, unsigned int ElemSizeArg, const Optional<unsigned int> & NumElemsArg)
- public static llvm::Attribute getWithByRefType(llvm::LLVMContext & Context, llvm::Type * Ty)
- public static llvm::Attribute getWithByValType(llvm::LLVMContext & Context, llvm::Type * Ty)
- public static llvm::Attribute getWithDereferenceableBytes(llvm::LLVMContext & Context, uint64_t Bytes)
- public static llvm::Attribute getWithDereferenceableOrNullBytes(llvm::LLVMContext & Context, uint64_t Bytes)
- public static llvm::Attribute getWithInAllocaType(llvm::LLVMContext & Context, llvm::Type * Ty)
- public llvm::Attribute getWithNewType(llvm::LLVMContext & Context, llvm::Type * ReplacementTy)
- public static llvm::Attribute getWithPreallocatedType(llvm::LLVMContext & Context, llvm::Type * Ty)
- public static llvm::Attribute getWithStackAlignment(llvm::LLVMContext & Context, llvm::Align Alignment)
- public static llvm::Attribute getWithStructRetType(llvm::LLVMContext & Context, llvm::Type * Ty)
- public static llvm::Attribute getWithUWTableKind(llvm::LLVMContext & Context, llvm::UWTableKind Kind)
- public static llvm::Attribute getWithVScaleRangeArgs(llvm::LLVMContext & Context, unsigned int MinValue, unsigned int MaxValue)
- public bool hasAttribute(llvm::StringRef Val) const
- public bool hasAttribute(llvm::Attribute::AttrKind Val) const
- public bool hasParentContext(llvm::LLVMContext & C) const
- public static bool isEnumAttrKind(llvm::Attribute::AttrKind Kind)
- public bool isEnumAttribute() const
- public static bool isExistingAttribute(llvm::StringRef Name)
- public static bool isIntAttrKind(llvm::Attribute::AttrKind Kind)
- public bool isIntAttribute() const
- public bool isStringAttribute() const
- public static bool isTypeAttrKind(llvm::Attribute::AttrKind Kind)
- public bool isTypeAttribute() const
- public bool isValid() const
Methods
¶Attribute(llvm::AttributeImpl* A)
Attribute(llvm::AttributeImpl* A)
Declared at: llvm/include/llvm/IR/Attributes.h:114
Parameters
¶Attribute()
Attribute()
Declared at: llvm/include/llvm/IR/Attributes.h:117
¶void Profile(llvm::FoldingSetNodeID& ID) const
void Profile(llvm::FoldingSetNodeID& ID) const
Declared at: llvm/include/llvm/IR/Attributes.h:261
Parameters
¶static bool canUseAsFnAttr(
llvm::Attribute::AttrKind Kind)
static bool canUseAsFnAttr(
llvm::Attribute::AttrKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:107
Parameters
- llvm::Attribute::AttrKind Kind
¶static bool canUseAsParamAttr(
llvm::Attribute::AttrKind Kind)
static bool canUseAsParamAttr(
llvm::Attribute::AttrKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:108
Parameters
- llvm::Attribute::AttrKind Kind
¶static bool canUseAsRetAttr(
llvm::Attribute::AttrKind Kind)
static bool canUseAsRetAttr(
llvm::Attribute::AttrKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:109
Parameters
- llvm::Attribute::AttrKind Kind
¶static llvm::Attribute fromRawPointer(
void* RawPtr)
static llvm::Attribute fromRawPointer(
void* RawPtr)
Description
Get an attribute from a raw pointer created by getRawPointer.
Declared at: llvm/include/llvm/IR/Attributes.h:269
Parameters
- void* RawPtr
¶static llvm::Attribute get(
llvm::LLVMContext& Context,
llvm::Attribute::AttrKind Kind,
uint64_t Val = 0)
static llvm::Attribute get(
llvm::LLVMContext& Context,
llvm::Attribute::AttrKind Kind,
uint64_t Val = 0)
Description
Return a uniquified Attribute object.
Declared at: llvm/include/llvm/IR/Attributes.h:124
Parameters
- llvm::LLVMContext& Context
- llvm::Attribute::AttrKind Kind
- uint64_t Val = 0
¶static llvm::Attribute get(
llvm::LLVMContext& Context,
llvm::StringRef Kind,
llvm::StringRef Val = llvm::StringRef())
static llvm::Attribute get(
llvm::LLVMContext& Context,
llvm::StringRef Kind,
llvm::StringRef Val = llvm::StringRef())
Declared at: llvm/include/llvm/IR/Attributes.h:125
Parameters
- llvm::LLVMContext& Context
- llvm::StringRef Kind
- llvm::StringRef Val = llvm::StringRef()
¶static llvm::Attribute get(
llvm::LLVMContext& Context,
llvm::Attribute::AttrKind Kind,
llvm::Type* Ty)
static llvm::Attribute get(
llvm::LLVMContext& Context,
llvm::Attribute::AttrKind Kind,
llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Attributes.h:127
Parameters
- llvm::LLVMContext& Context
- llvm::Attribute::AttrKind Kind
- llvm::Type* Ty
¶llvm::MaybeAlign getAlignment() const
llvm::MaybeAlign getAlignment() const
Description
Returns the alignment field of an attribute as a byte alignment value.
Declared at: llvm/include/llvm/IR/Attributes.h:216
¶llvm::AllocFnKind getAllocKind() const
llvm::AllocFnKind getAllocKind() const
Declared at: llvm/include/llvm/IR/Attributes.h:245
¶std::pair<unsigned int, Optional<unsigned int>>
getAllocSizeArgs() const
std::pair<unsigned int, Optional<unsigned int>>
getAllocSizeArgs() const
Description
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
Declared at: llvm/include/llvm/IR/Attributes.h:232
¶std::string getAsString(
bool InAttrGrp = false) const
std::string getAsString(
bool InAttrGrp = false) const
Description
The Attribute is converted to a string of equivalent mnemonic. This is, presumably, for writing out the mnemonics for the assembly writer.
Declared at: llvm/include/llvm/IR/Attributes.h:249
Parameters
- bool InAttrGrp = false
¶static Attribute::AttrKind getAttrKindFromName(
llvm::StringRef AttrName)
static Attribute::AttrKind getAttrKindFromName(
llvm::StringRef AttrName)
Declared at: llvm/include/llvm/IR/Attributes.h:156
Parameters
- llvm::StringRef AttrName
¶uint64_t getDereferenceableBytes() const
uint64_t getDereferenceableBytes() const
Description
Returns the number of dereferenceable bytes from the dereferenceable attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:224
¶uint64_t getDereferenceableOrNullBytes() const
uint64_t getDereferenceableOrNullBytes() const
Description
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:228
¶Attribute::AttrKind getKindAsEnum() const
Attribute::AttrKind getKindAsEnum() const
Description
Return the attribute's kind as an enum (Attribute::AttrKind). This requires the attribute to be an enum, integer, or type attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:192
¶llvm::StringRef getKindAsString() const
llvm::StringRef getKindAsString() const
Description
Return the attribute's kind as a string. This requires the attribute to be a string attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:204
¶static llvm::StringRef getNameFromAttrKind(
Attribute::AttrKind AttrKind)
static llvm::StringRef getNameFromAttrKind(
Attribute::AttrKind AttrKind)
Declared at: llvm/include/llvm/IR/Attributes.h:158
Parameters
- Attribute::AttrKind AttrKind
¶void* getRawPointer() const
void* getRawPointer() const
Description
Return a raw pointer that uniquely identifies this attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:264
¶llvm::MaybeAlign getStackAlignment() const
llvm::MaybeAlign getStackAlignment() const
Description
Returns the stack alignment field of an attribute as a byte alignment value.
Declared at: llvm/include/llvm/IR/Attributes.h:220
¶llvm::UWTableKind getUWTableKind() const
llvm::UWTableKind getUWTableKind() const
Declared at: llvm/include/llvm/IR/Attributes.h:242
¶Optional<unsigned int> getVScaleRangeMax() const
Optional<unsigned int> getVScaleRangeMax() const
Description
Returns the maximum value for the vscale_range attribute or None when unknown.
Declared at: llvm/include/llvm/IR/Attributes.h:239
¶unsigned int getVScaleRangeMin() const
unsigned int getVScaleRangeMin() const
Description
Returns the minimum value for the vscale_range attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:235
¶bool getValueAsBool() const
bool getValueAsBool() const
Description
Return the attribute's value as a boolean. This requires that the attribute be a string attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:200
¶uint64_t getValueAsInt() const
uint64_t getValueAsInt() const
Description
Return the attribute's value as an integer. This requires that the attribute be an integer attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:196
¶llvm::StringRef getValueAsString() const
llvm::StringRef getValueAsString() const
Description
Return the attribute's value as a string. This requires the attribute to be a string attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:208
¶llvm::Type* getValueAsType() const
llvm::Type* getValueAsType() const
Description
Return the attribute's value as a Type. This requires the attribute to be a type attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:212
¶static llvm::Attribute getWithAlignment(
llvm::LLVMContext& Context,
llvm::Align Alignment)
static llvm::Attribute getWithAlignment(
llvm::LLVMContext& Context,
llvm::Align Alignment)
Description
Return a uniquified Attribute object that has the specific alignment set.
Declared at: llvm/include/llvm/IR/Attributes.h:131
Parameters
- llvm::LLVMContext& Context
- llvm::Align Alignment
¶static llvm::Attribute getWithAllocSizeArgs(
llvm::LLVMContext& Context,
unsigned int ElemSizeArg,
const Optional<unsigned int>& NumElemsArg)
static llvm::Attribute getWithAllocSizeArgs(
llvm::LLVMContext& Context,
unsigned int ElemSizeArg,
const Optional<unsigned int>& NumElemsArg)
Declared at: llvm/include/llvm/IR/Attributes.h:137
Parameters
- llvm::LLVMContext& Context
- unsigned int ElemSizeArg
- const Optional<unsigned int>& NumElemsArg
¶static llvm::Attribute getWithByRefType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
static llvm::Attribute getWithByRefType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Attributes.h:144
Parameters
- llvm::LLVMContext& Context
- llvm::Type* Ty
¶static llvm::Attribute getWithByValType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
static llvm::Attribute getWithByValType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Attributes.h:142
Parameters
- llvm::LLVMContext& Context
- llvm::Type* Ty
¶static llvm::Attribute
getWithDereferenceableBytes(
llvm::LLVMContext& Context,
uint64_t Bytes)
static llvm::Attribute
getWithDereferenceableBytes(
llvm::LLVMContext& Context,
uint64_t Bytes)
Declared at: llvm/include/llvm/IR/Attributes.h:133
Parameters
- llvm::LLVMContext& Context
- uint64_t Bytes
¶static llvm::Attribute
getWithDereferenceableOrNullBytes(
llvm::LLVMContext& Context,
uint64_t Bytes)
static llvm::Attribute
getWithDereferenceableOrNullBytes(
llvm::LLVMContext& Context,
uint64_t Bytes)
Declared at: llvm/include/llvm/IR/Attributes.h:135
Parameters
- llvm::LLVMContext& Context
- uint64_t Bytes
¶static llvm::Attribute getWithInAllocaType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
static llvm::Attribute getWithInAllocaType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Attributes.h:146
Parameters
- llvm::LLVMContext& Context
- llvm::Type* Ty
¶llvm::Attribute getWithNewType(
llvm::LLVMContext& Context,
llvm::Type* ReplacementTy)
llvm::Attribute getWithNewType(
llvm::LLVMContext& Context,
llvm::Type* ReplacementTy)
Description
For a typed attribute, return the equivalent attribute with the type changed to \p ReplacementTy.
Declared at: llvm/include/llvm/IR/Attributes.h:151
Parameters
- llvm::LLVMContext& Context
- llvm::Type* ReplacementTy
¶static llvm::Attribute getWithPreallocatedType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
static llvm::Attribute getWithPreallocatedType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Attributes.h:145
Parameters
- llvm::LLVMContext& Context
- llvm::Type* Ty
¶static llvm::Attribute getWithStackAlignment(
llvm::LLVMContext& Context,
llvm::Align Alignment)
static llvm::Attribute getWithStackAlignment(
llvm::LLVMContext& Context,
llvm::Align Alignment)
Declared at: llvm/include/llvm/IR/Attributes.h:132
Parameters
- llvm::LLVMContext& Context
- llvm::Align Alignment
¶static llvm::Attribute getWithStructRetType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
static llvm::Attribute getWithStructRetType(
llvm::LLVMContext& Context,
llvm::Type* Ty)
Declared at: llvm/include/llvm/IR/Attributes.h:143
Parameters
- llvm::LLVMContext& Context
- llvm::Type* Ty
¶static llvm::Attribute getWithUWTableKind(
llvm::LLVMContext& Context,
llvm::UWTableKind Kind)
static llvm::Attribute getWithUWTableKind(
llvm::LLVMContext& Context,
llvm::UWTableKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:147
Parameters
- llvm::LLVMContext& Context
- llvm::UWTableKind Kind
¶static llvm::Attribute getWithVScaleRangeArgs(
llvm::LLVMContext& Context,
unsigned int MinValue,
unsigned int MaxValue)
static llvm::Attribute getWithVScaleRangeArgs(
llvm::LLVMContext& Context,
unsigned int MinValue,
unsigned int MaxValue)
Declared at: llvm/include/llvm/IR/Attributes.h:140
Parameters
- llvm::LLVMContext& Context
- unsigned int MinValue
- unsigned int MaxValue
¶bool hasAttribute(llvm::StringRef Val) const
bool hasAttribute(llvm::StringRef Val) const
Description
Return true if the target-dependent attribute is present.
Declared at: llvm/include/llvm/IR/Attributes.h:188
Parameters
- llvm::StringRef Val
¶bool hasAttribute(
llvm::Attribute::AttrKind Val) const
bool hasAttribute(
llvm::Attribute::AttrKind Val) const
Description
Return true if the attribute is present.
Declared at: llvm/include/llvm/IR/Attributes.h:185
Parameters
- llvm::Attribute::AttrKind Val
¶bool hasParentContext(llvm::LLVMContext& C) const
bool hasParentContext(llvm::LLVMContext& C) const
Description
Return true if this attribute belongs to the LLVMContext.
Declared at: llvm/include/llvm/IR/Attributes.h:252
Parameters
¶static bool isEnumAttrKind(
llvm::Attribute::AttrKind Kind)
static bool isEnumAttrKind(
llvm::Attribute::AttrKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:97
Parameters
- llvm::Attribute::AttrKind Kind
¶bool isEnumAttribute() const
bool isEnumAttribute() const
Description
Return true if the attribute is an Attribute::AttrKind type.
Declared at: llvm/include/llvm/IR/Attributes.h:169
¶static bool isExistingAttribute(
llvm::StringRef Name)
static bool isExistingAttribute(
llvm::StringRef Name)
Description
Return true if the provided string matches the IR name of an attribute. example: "noalias" return true but not "NoAlias"
Declared at: llvm/include/llvm/IR/Attributes.h:162
Parameters
- llvm::StringRef Name
¶static bool isIntAttrKind(
llvm::Attribute::AttrKind Kind)
static bool isIntAttrKind(
llvm::Attribute::AttrKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:100
Parameters
- llvm::Attribute::AttrKind Kind
¶bool isIntAttribute() const
bool isIntAttribute() const
Description
Return true if the attribute is an integer attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:172
¶bool isStringAttribute() const
bool isStringAttribute() const
Description
Return true if the attribute is a string (target-dependent) attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:176
¶static bool isTypeAttrKind(
llvm::Attribute::AttrKind Kind)
static bool isTypeAttrKind(
llvm::Attribute::AttrKind Kind)
Declared at: llvm/include/llvm/IR/Attributes.h:103
Parameters
- llvm::Attribute::AttrKind Kind
¶bool isTypeAttribute() const
bool isTypeAttribute() const
Description
Return true if the attribute is a type attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:179
¶bool isValid() const
bool isValid() const
Description
Return true if the attribute is any kind of attribute.
Declared at: llvm/include/llvm/IR/Attributes.h:182