Represents a single IR attribute on a function, parameter, or return value.
Declared in <llvm/IR/Attributes.h>
class Attribute;
Functions, function parameters, and return types can have attributes to indicate how they should be treated by optimizations and code generation. It's light-weight and should be passed around by-value.
| Name | Description |
|---|---|
AttrKind | This enumeration lists the attributes that can be associated with parameters, function results, or the function itself. |
| Name | Description |
|---|---|
Attribute [constructor] | Construct an empty attribute that compares equal to a default-constructed Attribute and has no kind or value. |
Profile | Profile this attribute into ID for FoldingSet uniquing. |
cmpKind | Used to sort attribute by kind. |
getAlignment | Returns the alignment field of an attribute as a byte alignment value. |
getAllocKind | Returns the allocator function kind. |
getAllocSizeArgs | Returns the argument numbers for the allocsize attribute. |
getAsString | The Attribute is converted to a string of equivalent mnemonic. This is, presumably, for writing out the mnemonics for the assembly writer. |
getCaptureInfo | Returns information from captures attribute. |
getDeadOnReturnInfo | Return dead-on-return information from this attribute. |
getDenormalFPEnv | Returns denormal_fpenv. |
getDereferenceableBytes | Returns the number of dereferenceable bytes from the dereferenceable attribute. |
getDereferenceableOrNullBytes | Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute. |
getInitializes | Returns the value of the initializes attribute. |
getKindAsEnum | Return the attribute's kind as an enum (Attribute::AttrKind). This requires the attribute be representable as an enum (see: hasKindAsEnum). |
getKindAsString | Return the attribute's kind as a string. This requires the attribute to be a string attribute. |
getMemoryEffects | Returns memory effects. |
getNoFPClass | Return the FPClassTest for nofpclass |
getRange | Returns the value of the range attribute. |
getRawPointer | Return a raw pointer that uniquely identifies this attribute. |
getStackAlignment | Returns the stack alignment field of an attribute as a byte alignment value. |
getUWTableKind | Returns the unwind table kind. |
getVScaleRangeMax | Returns the maximum value for the vscale_range attribute or std::nullopt when unknown. |
getVScaleRangeMin | Returns the minimum value for the vscale_range attribute. |
getValueAsBool | Return the attribute's value as a boolean. This requires that the attribute be a string attribute. |
getValueAsConstantRange | Return the attribute's value as a ConstantRange. This requires the attribute to be a ConstantRange attribute. |
getValueAsConstantRangeList | Return the attribute's value as a ConstantRange array. This requires the attribute to be a ConstantRangeList attribute. |
getValueAsInt | Return the attribute's value as an integer. This requires that the attribute be an integer attribute. |
getValueAsString | Return the attribute's value as a string. This requires the attribute to be a string attribute. |
getValueAsType | Return the attribute's value as a Type. This requires the attribute to be a type attribute. |
getWithNewType | For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy. |
hasAttribute | hasAttribute overloads |
hasKindAsEnum | Returns true if the attribute's kind can be represented as an enum (Enum, Integer, Type, ConstantRange, or ConstantRangeList attribute). |
hasParentContext | Return true if this attribute belongs to the LLVMContext. |
isConstantRangeAttribute | Return true if the attribute is a ConstantRange attribute. |
isConstantRangeListAttribute | Return true if the attribute is a ConstantRangeList attribute. |
isEnumAttribute | Return true if the attribute is an Attribute::AttrKind type. |
isIntAttribute | Return true if the attribute is an integer attribute. |
isStringAttribute | Return true if the attribute is a string (target-dependent) attribute. |
isTypeAttribute | Return true if the attribute is a type attribute. |
isValid | Return true if the attribute is any kind of attribute. |
operator== | Return true if both attributes refer to the same uniquified value. |
operator!= | Return true if the attributes refer to different uniquified values. |
operator< | Less-than operator. Useful for sorting the attributes list. |
| Name | Description |
|---|---|
canUseAsFnAttr | Return true if Kind may be used as a function attribute. |
canUseAsParamAttr | Return true if Kind may be used as a parameter attribute. |
canUseAsRetAttr | Return true if Kind may be used as a return-value attribute. |
fromRawPointer | Get an attribute from a raw pointer created by getRawPointer. |
get | get overloads |
getAttrKindFromName | Return the enum attribute kind corresponding to IR name AttrName. |
getNameFromAttrKind | Return the IR spelling of AttrKind (for example, noalias). |
getWithAlignment | Return a uniquified Attribute object that has the specific alignment set. |
getWithAllocKind | Return a uniquified allockind attribute with allocator kind Kind. |
getWithAllocSizeArgs | Return a uniquified allocsize attribute for the given argument indexes. |
getWithByRefType | Return a uniquified byref attribute carrying the referenced pointee type. |
getWithByValType | Return a uniquified byval attribute carrying the structure type passed by value in the caller's stack frame. |
getWithCaptureInfo | Return a uniquified captures attribute with capture info CI. |
getWithDeadOnReturnInfo | Return a uniquified dead_on_return attribute describing how many bytes of the pointed-to object become dead when the pointer is returned. |
getWithDereferenceableBytes | Return a uniquified dereferenceable attribute for Bytes bytes. |
getWithDereferenceableOrNullBytes | Return a uniquified dereferenceable_or_null attribute for Bytes bytes. |
getWithInAllocaType | Return a uniquified inalloca attribute carrying the allocated type. |
getWithMemoryEffects | Return a uniquified memory attribute encoding effects ME. |
getWithNoFPClass | Return a uniquified nofpclass attribute excluding classes in Mask. |
getWithPreallocatedType | Return a uniquified preallocated attribute carrying the allocated type. |
getWithStackAlignment | Return a uniquified alignstack attribute with stack alignment Alignment. |
getWithStructRetType | Return a uniquified sret attribute carrying the structure return type. |
getWithUWTableKind | Return a uniquified uwtable attribute with unwind-table kind Kind. |
getWithVScaleRangeArgs | Return a uniquified vscale_range attribute for the given min/max. |
intersectMustPreserve | Return true if intersecting sets must preserve this attribute kind. |
intersectWithAnd | Return true if intersecting sets combine this kind with bitwise AND. |
intersectWithCustom | Return true if intersecting two attribute sets with this kind requires a custom rule rather than bitwise and, minimum, or preservation. |
intersectWithMin | Return true if intersecting sets combine this kind by taking the minimum. |
isConstantRangeAttrKind | Return true if Kind is a ConstantRange attribute kind. |
isConstantRangeListAttrKind | Return true if Kind is a ConstantRangeList attribute kind. |
isEnumAttrKind | Return true if Kind is an enum (flag) attribute kind. |
isExistingAttribute | Return true if the provided string matches the IR name of an attribute. |
isIntAttrKind | Return true if Kind is an integer-valued attribute kind. |
isTypeAttrKind | Return true if Kind is a type-valued attribute kind. |
| Name | Description |
|---|---|
NumIntAttrKinds | Number of integer-valued attribute kinds. |
NumTypeAttrKinds | Number of type-valued attribute kinds. |
| Name | Description |
|---|---|
isStatepointDirectiveAttr | Return true if the Attr is an attribute that is a statepoint directive. |
unwrap | Unwrap an opaque C API attribute reference. |
wrap | Wrap an Attribute as an opaque C API reference. |