class AttrBuilder

Declaration

class AttrBuilder { /* full declaration omitted */ };

Description

This class is used in conjunction with the Attribute::get method to create an Attribute object. The object itself is uniquified. The Builder's value, however, is not. So this can be used as a quick way to test for equality, presence of attributes, etc.

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

Member Variables

private llvm::LLVMContext& Ctx
private SmallVector<llvm::Attribute, 8> Attrs

Method Overview

Methods

AttrBuilder(const llvm::AttrBuilder&)

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

Parameters

const llvm::AttrBuilder&

AttrBuilder(llvm::AttrBuilder&&)

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

Parameters

llvm::AttrBuilder&&

AttrBuilder(llvm::LLVMContext& Ctx,
            const llvm::Attribute& A)

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

Parameters

llvm::LLVMContext& Ctx
const llvm::Attribute& A

AttrBuilder(llvm::LLVMContext& Ctx,
            llvm::AttributeSet AS)

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

Parameters

llvm::LLVMContext& Ctx
llvm::AttributeSet AS

AttrBuilder(llvm::LLVMContext& Ctx)

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

Parameters

llvm::LLVMContext& Ctx

inline llvm::AttrBuilder& addAlignmentAttr(
    unsigned int Align)

Description

This turns an int alignment (which must be a power of 2) into the form used internally in Attribute. This call has no effect if Align is 0. Deprecated, use the version using a MaybeAlign.

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

Parameters

unsigned int Align

llvm::AttrBuilder& addAlignmentAttr(
    llvm::MaybeAlign Align)

Description

This turns an alignment into the form used internally in Attribute. This call has no effect if Align is not set.

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

Parameters

llvm::MaybeAlign Align

llvm::AttrBuilder& addAllocKindAttr(
    llvm::AllocFnKind Kind)

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

Parameters

llvm::AllocFnKind Kind

llvm::AttrBuilder& addAllocSizeAttr(
    unsigned int ElemSizeArg,
    const Optional<unsigned int>& NumElemsArg)

Description

This turns one (or two) ints into the form used internally in Attribute.

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

Parameters

unsigned int ElemSizeArg
const Optional<unsigned int>& NumElemsArg

llvm::AttrBuilder& addAllocSizeAttrFromRawRepr(
    uint64_t RawAllocSizeRepr)

Description

Add an allocsize attribute, using the representation returned by Attribute.getIntValue().

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

Parameters

uint64_t RawAllocSizeRepr

llvm::AttrBuilder& addAttribute(
    llvm::StringRef A,
    llvm::StringRef V = llvm::StringRef())

Description

Add the target-dependent attribute to the builder.

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

Parameters

llvm::StringRef A
llvm::StringRef V = llvm::StringRef()

llvm::AttrBuilder& addAttribute(llvm::Attribute A)

Description

Add the Attribute object to the builder.

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

Parameters

llvm::Attribute A

llvm::AttrBuilder& addAttribute(
    Attribute::AttrKind Val)

Description

Add an attribute to the builder.

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

Parameters

Attribute::AttrKind Val

llvm::AttrBuilder& addByRefAttr(llvm::Type* Ty)

Description

This turns a byref type into the form used internally in Attribute.

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

Parameters

llvm::Type* Ty

llvm::AttrBuilder& addByValAttr(llvm::Type* Ty)

Description

This turns a byval type into the form used internally in Attribute.

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

Parameters

llvm::Type* Ty

llvm::AttrBuilder& addDereferenceableAttr(
    uint64_t Bytes)

Description

This turns the number of dereferenceable bytes into the form used internally in Attribute.

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

Parameters

uint64_t Bytes

llvm::AttrBuilder& addDereferenceableOrNullAttr(
    uint64_t Bytes)

Description

This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute.

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

Parameters

uint64_t Bytes

llvm::AttrBuilder& addInAllocaAttr(llvm::Type* Ty)

Description

This turns an inalloca type into the form used internally in Attribute.

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

Parameters

llvm::Type* Ty

llvm::AttrBuilder& addPreallocatedAttr(
    llvm::Type* Ty)

Description

This turns a preallocated type into the form used internally in Attribute.

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

Parameters

llvm::Type* Ty

llvm::AttrBuilder& addRawIntAttr(
    Attribute::AttrKind Kind,
    uint64_t Value)

Description

Add integer attribute with raw value (packed/encoded if necessary).

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

Parameters

Attribute::AttrKind Kind
uint64_t Value

inline llvm::AttrBuilder& addStackAlignmentAttr(
    unsigned int Align)

Description

This turns an int stack alignment (which must be a power of 2) into the form used internally in Attribute. This call has no effect if Align is 0. Deprecated, use the version using a MaybeAlign.

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

Parameters

unsigned int Align

llvm::AttrBuilder& addStackAlignmentAttr(
    llvm::MaybeAlign Align)

Description

This turns a stack alignment into the form used internally in Attribute. This call has no effect if Align is not set.

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

Parameters

llvm::MaybeAlign Align

llvm::AttrBuilder& addStructRetAttr(
    llvm::Type* Ty)

Description

This turns a sret type into the form used internally in Attribute.

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

Parameters

llvm::Type* Ty

llvm::AttrBuilder& addTypeAttr(
    Attribute::AttrKind Kind,
    llvm::Type* Ty)

Description

Add a type attribute with the given type.

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

Parameters

Attribute::AttrKind Kind
llvm::Type* Ty

llvm::AttrBuilder& addUWTableAttr(
    llvm::UWTableKind Kind)

Description

This turns the unwind table kind into the form used internally in Attribute.

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

Parameters

llvm::UWTableKind Kind

llvm::AttrBuilder& addVScaleRangeAttr(
    unsigned int MinValue,
    Optional<unsigned int> MaxValue)

Description

This turns two ints into the form used internally in Attribute.

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

Parameters

unsigned int MinValue
Optional<unsigned int> MaxValue

llvm::AttrBuilder& addVScaleRangeAttrFromRawRepr(
    uint64_t RawVScaleRangeRepr)

Description

Add a vscale_range attribute, using the representation returned by Attribute.getIntValue().

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

Parameters

uint64_t RawVScaleRangeRepr

ArrayRef<llvm::Attribute> attrs() const

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

void clear()

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

bool contains(Attribute::AttrKind A) const

Description

Return true if the builder has the specified attribute.

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

Parameters

Attribute::AttrKind A

bool contains(llvm::StringRef A) const

Description

Return true if the builder has the specified target-dependent attribute.

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

Parameters

llvm::StringRef A

llvm::MaybeAlign getAlignment() const

Description

Retrieve the alignment attribute, if it exists.

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

std::pair<unsigned int, Optional<unsigned int>>
getAllocSizeArgs() const

Description

Retrieve the allocsize args, if the allocsize attribute exists. If it doesn't exist, pair(0, 0) is returned.

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

llvm::Attribute getAttribute(
    Attribute::AttrKind Kind) const

Description

Return Attribute with the given Kind. The returned attribute will be invalid if the Kind is not present in the builder.

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

Parameters

Attribute::AttrKind Kind

llvm::Attribute getAttribute(
    llvm::StringRef Kind) const

Description

Return Attribute with the given Kind. The returned attribute will be invalid if the Kind is not present in the builder.

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

Parameters

llvm::StringRef Kind

llvm::Type* getByRefType() const

Description

Retrieve the byref type.

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

llvm::Type* getByValType() const

Description

Retrieve the byval type.

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

uint64_t getDereferenceableBytes() const

Description

Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is returned otherwise).

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

uint64_t getDereferenceableOrNullBytes() const

Description

Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists (zero is returned otherwise).

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

llvm::Type* getInAllocaType() const

Description

Retrieve the inalloca type.

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

llvm::Type* getPreallocatedType() const

Description

Retrieve the preallocated type.

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

uint64_t getRawIntAttr(
    Attribute::AttrKind Kind) const

Description

Return raw (possibly packed/encoded) value of integer attribute or 0 if not set.

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

Parameters

Attribute::AttrKind Kind

llvm::MaybeAlign getStackAlignment() const

Description

Retrieve the stack alignment attribute, if it exists.

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

llvm::Type* getStructRetType() const

Description

Retrieve the sret type.

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

llvm::Type* getTypeAttr(
    Attribute::AttrKind Kind) const

Description

Retrieve type for the given type attribute.

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

Parameters

Attribute::AttrKind Kind

Optional<unsigned int> getVScaleRangeMax() const

Description

Retrieve the maximum value of 'vscale_range' or None when unknown.

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

unsigned int getVScaleRangeMin() const

Description

Retrieve the minimum value of 'vscale_range'.

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

bool hasAlignmentAttr() const

Description

Return true if the builder has an alignment attribute.

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

bool hasAttributes() const

Description

Return true if the builder has IR-level attributes.

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

llvm::AttrBuilder& merge(
    const llvm::AttrBuilder& B)

Description

Add the attributes from the builder. Attributes in the passed builder overwrite attributes in this builder if they have the same key.

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

Parameters

const llvm::AttrBuilder& B

bool overlaps(const llvm::AttributeMask& AM) const

Description

Return true if the builder has any attribute that's in the specified builder.

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

Parameters

const llvm::AttributeMask& AM

llvm::AttrBuilder& remove(
    const llvm::AttributeMask& AM)

Description

Remove the attributes from the builder.

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

Parameters

const llvm::AttributeMask& AM

llvm::AttrBuilder& removeAttribute(
    llvm::Attribute A)

Description

Remove the target-dependent attribute from the builder.

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

Parameters

llvm::Attribute A

llvm::AttrBuilder& removeAttribute(
    llvm::StringRef A)

Description

Remove the target-dependent attribute from the builder.

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

Parameters

llvm::StringRef A

llvm::AttrBuilder& removeAttribute(
    Attribute::AttrKind Val)

Description

Remove an attribute from the builder.

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

Parameters

Attribute::AttrKind Val