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

Methods

Attribute(llvm::AttributeImpl* A)

Declared at: llvm/include/llvm/IR/Attributes.h:114

Parameters

llvm::AttributeImpl* A

Attribute()

Declared at: llvm/include/llvm/IR/Attributes.h:117

void Profile(llvm::FoldingSetNodeID& ID) const

Declared at: llvm/include/llvm/IR/Attributes.h:261

Parameters

llvm::FoldingSetNodeID& ID

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)

Declared at: llvm/include/llvm/IR/Attributes.h:108

Parameters

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)

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)

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())

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)

Declared at: llvm/include/llvm/IR/Attributes.h:127

Parameters

llvm::LLVMContext& Context
llvm::Attribute::AttrKind Kind
llvm::Type* Ty

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

Declared at: llvm/include/llvm/IR/Attributes.h:245

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

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)

Declared at: llvm/include/llvm/IR/Attributes.h:156

Parameters

llvm::StringRef AttrName

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

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

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

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)

Declared at: llvm/include/llvm/IR/Attributes.h:158

Parameters

Attribute::AttrKind AttrKind

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

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

Declared at: llvm/include/llvm/IR/Attributes.h:242

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

Description

Returns the minimum value for the vscale_range attribute.

Declared at: llvm/include/llvm/IR/Attributes.h:235

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

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

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

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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

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

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

Description

Return true if this attribute belongs to the LLVMContext.

Declared at: llvm/include/llvm/IR/Attributes.h:252

Parameters

llvm::LLVMContext& C

static bool isEnumAttrKind(
    llvm::Attribute::AttrKind Kind)

Declared at: llvm/include/llvm/IR/Attributes.h:97

Parameters

llvm::Attribute::AttrKind Kind

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)

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)

Declared at: llvm/include/llvm/IR/Attributes.h:100

Parameters

llvm::Attribute::AttrKind Kind

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

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)

Declared at: llvm/include/llvm/IR/Attributes.h:103

Parameters

llvm::Attribute::AttrKind Kind

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

Description

Return true if the attribute is any kind of attribute.

Declared at: llvm/include/llvm/IR/Attributes.h:182