LLVM 22.0.0git
llvm::Attribute Class Reference

Functions, function parameters, and return types can have attributes to indicate how they should be treated by optimizations and code generation. More...

#include "llvm/IR/Attributes.h"

Public Types

enum  AttrKind { None , EndAttrKinds , EmptyKey , TombstoneKey }
 This enumeration lists the attributes that can be associated with parameters, function results, or the function itself. More...

Public Member Functions

 Attribute ()=default
Attribute getWithNewType (LLVMContext &Context, Type *ReplacementTy)
 For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy.
LLVM_ABI bool isEnumAttribute () const
 Return true if the attribute is an Attribute::AttrKind type.
LLVM_ABI bool isIntAttribute () const
 Return true if the attribute is an integer attribute.
LLVM_ABI bool isStringAttribute () const
 Return true if the attribute is a string (target-dependent) attribute.
LLVM_ABI bool isTypeAttribute () const
 Return true if the attribute is a type attribute.
LLVM_ABI bool isConstantRangeAttribute () const
 Return true if the attribute is a ConstantRange attribute.
LLVM_ABI bool isConstantRangeListAttribute () const
 Return true if the attribute is a ConstantRangeList attribute.
bool isValid () const
 Return true if the attribute is any kind of attribute.
LLVM_ABI bool hasAttribute (AttrKind Val) const
 Return true if the attribute is present.
LLVM_ABI bool hasAttribute (StringRef Val) const
 Return true if the target-dependent attribute is present.
bool hasKindAsEnum () const
 Returns true if the attribute's kind can be represented as an enum (Enum, Integer, Type, ConstantRange, or ConstantRangeList attribute).
LLVM_ABI Attribute::AttrKind getKindAsEnum () const
 Return the attribute's kind as an enum (Attribute::AttrKind).
LLVM_ABI uint64_t getValueAsInt () const
 Return the attribute's value as an integer.
LLVM_ABI bool getValueAsBool () const
 Return the attribute's value as a boolean.
LLVM_ABI StringRef getKindAsString () const
 Return the attribute's kind as a string.
LLVM_ABI StringRef getValueAsString () const
 Return the attribute's value as a string.
LLVM_ABI TypegetValueAsType () const
 Return the attribute's value as a Type.
LLVM_ABI const ConstantRangegetValueAsConstantRange () const
 Return the attribute's value as a ConstantRange.
LLVM_ABI ArrayRef< ConstantRangegetValueAsConstantRangeList () const
 Return the attribute's value as a ConstantRange array.
LLVM_ABI MaybeAlign getAlignment () const
 Returns the alignment field of an attribute as a byte alignment value.
LLVM_ABI MaybeAlign getStackAlignment () const
 Returns the stack alignment field of an attribute as a byte alignment value.
LLVM_ABI uint64_t getDereferenceableBytes () const
 Returns the number of dereferenceable bytes from the dereferenceable attribute.
LLVM_ABI uint64_t getDereferenceableOrNullBytes () const
 Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
LLVM_ABI std::pair< unsigned, std::optional< unsigned > > getAllocSizeArgs () const
 Returns the argument numbers for the allocsize attribute.
LLVM_ABI unsigned getVScaleRangeMin () const
 Returns the minimum value for the vscale_range attribute.
LLVM_ABI std::optional< unsignedgetVScaleRangeMax () const
 Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.
LLVM_ABI UWTableKind getUWTableKind () const
LLVM_ABI AllocFnKind getAllocKind () const
LLVM_ABI MemoryEffects getMemoryEffects () const
 Returns memory effects.
LLVM_ABI CaptureInfo getCaptureInfo () const
 Returns information from captures attribute.
LLVM_ABI FPClassTest getNoFPClass () const
 Return the FPClassTest for nofpclass.
LLVM_ABI const ConstantRangegetRange () const
 Returns the value of the range attribute.
LLVM_ABI ArrayRef< ConstantRangegetInitializes () const
 Returns the value of the initializes attribute.
LLVM_ABI std::string getAsString (bool InAttrGrp=false) const
 The Attribute is converted to a string of equivalent mnemonic.
LLVM_ABI bool hasParentContext (LLVMContext &C) const
 Return true if this attribute belongs to the LLVMContext.
bool operator== (Attribute A) const
 Equality and non-equality operators.
bool operator!= (Attribute A) const
LLVM_ABI int cmpKind (Attribute A) const
 Used to sort attribute by kind.
LLVM_ABI bool operator< (Attribute A) const
 Less-than operator. Useful for sorting the attributes list.
LLVM_ABI void Profile (FoldingSetNodeID &ID) const
void * getRawPointer () const
 Return a raw pointer that uniquely identifies this attribute.

Static Public Member Functions

static bool isEnumAttrKind (AttrKind Kind)
static bool isIntAttrKind (AttrKind Kind)
static bool isTypeAttrKind (AttrKind Kind)
static bool isConstantRangeAttrKind (AttrKind Kind)
static bool isConstantRangeListAttrKind (AttrKind Kind)
static LLVM_ABI bool canUseAsFnAttr (AttrKind Kind)
static LLVM_ABI bool canUseAsParamAttr (AttrKind Kind)
static LLVM_ABI bool canUseAsRetAttr (AttrKind Kind)
static LLVM_ABI bool intersectMustPreserve (AttrKind Kind)
static LLVM_ABI bool intersectWithAnd (AttrKind Kind)
static LLVM_ABI bool intersectWithMin (AttrKind Kind)
static LLVM_ABI bool intersectWithCustom (AttrKind Kind)
static LLVM_ABI Attribute get (LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
 Return a uniquified Attribute object.
static LLVM_ABI Attribute get (LLVMContext &Context, StringRef Kind, StringRef Val=StringRef())
static LLVM_ABI Attribute get (LLVMContext &Context, AttrKind Kind, Type *Ty)
static LLVM_ABI Attribute get (LLVMContext &Context, AttrKind Kind, const ConstantRange &CR)
static LLVM_ABI Attribute get (LLVMContext &Context, AttrKind Kind, ArrayRef< ConstantRange > Val)
static LLVM_ABI Attribute getWithAlignment (LLVMContext &Context, Align Alignment)
 Return a uniquified Attribute object that has the specific alignment set.
static LLVM_ABI Attribute getWithStackAlignment (LLVMContext &Context, Align Alignment)
static LLVM_ABI Attribute getWithDereferenceableBytes (LLVMContext &Context, uint64_t Bytes)
static LLVM_ABI Attribute getWithDereferenceableOrNullBytes (LLVMContext &Context, uint64_t Bytes)
static LLVM_ABI Attribute getWithAllocSizeArgs (LLVMContext &Context, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
static LLVM_ABI Attribute getWithAllocKind (LLVMContext &Context, AllocFnKind Kind)
static LLVM_ABI Attribute getWithVScaleRangeArgs (LLVMContext &Context, unsigned MinValue, unsigned MaxValue)
static LLVM_ABI Attribute getWithByValType (LLVMContext &Context, Type *Ty)
static LLVM_ABI Attribute getWithStructRetType (LLVMContext &Context, Type *Ty)
static LLVM_ABI Attribute getWithByRefType (LLVMContext &Context, Type *Ty)
static LLVM_ABI Attribute getWithPreallocatedType (LLVMContext &Context, Type *Ty)
static LLVM_ABI Attribute getWithInAllocaType (LLVMContext &Context, Type *Ty)
static LLVM_ABI Attribute getWithUWTableKind (LLVMContext &Context, UWTableKind Kind)
static LLVM_ABI Attribute getWithMemoryEffects (LLVMContext &Context, MemoryEffects ME)
static LLVM_ABI Attribute getWithNoFPClass (LLVMContext &Context, FPClassTest Mask)
static LLVM_ABI Attribute getWithCaptureInfo (LLVMContext &Context, CaptureInfo CI)
static LLVM_ABI Attribute::AttrKind getAttrKindFromName (StringRef AttrName)
static LLVM_ABI StringRef getNameFromAttrKind (Attribute::AttrKind AttrKind)
static LLVM_ABI bool isExistingAttribute (StringRef Name)
 Return true if the provided string matches the IR name of an attribute.
static Attribute fromRawPointer (void *RawPtr)
 Get an attribute from a raw pointer created by getRawPointer.

Static Public Attributes

static const unsigned NumIntAttrKinds = LastIntAttr - FirstIntAttr + 1
static const unsigned NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1

Detailed 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.

Definition at line 69 of file Attributes.h.

Member Enumeration Documentation

◆ AttrKind

This enumeration lists the attributes that can be associated with parameters, function results, or the function itself.

Note: The ‘uwtable’ attribute is about the ABI or the user mandating an / entry in the unwind table. The ‘nounwind’ attribute is about an exception passing by the function.

In a theoretical system that uses tables for profiling and SjLj for exceptions, they would be fully independent. In a normal system that uses tables for both, the semantics are:

nil = Needs an entry because an exception might pass by. nounwind = No need for an entry uwtable = Needs an entry because the ABI says so and because an exception might pass by. uwtable + nounwind = Needs an entry because the ABI says so.

Enumerator
None 

No attributes have been set.

EndAttrKinds 

Sentinel value useful for loops.

EmptyKey 

Use as Empty key for DenseMap of AttrKind.

TombstoneKey 

Use as Tombstone key for DenseMap of AttrKind.

Definition at line 88 of file Attributes.h.

Constructor & Destructor Documentation

◆ Attribute()

llvm::Attribute::Attribute ( )
default

References LLVM_ABI.

Referenced by fromRawPointer(), get(), get(), get(), get(), and get().

Member Function Documentation

◆ canUseAsFnAttr()

bool Attribute::canUseAsFnAttr ( AttrKind Kind)
static

Definition at line 785 of file Attributes.cpp.

References FnAttr, and hasAttributeProperty().

Referenced by forceAttributes(), and llvm::ForceFunctionAttrsPass::run().

◆ canUseAsParamAttr()

bool Attribute::canUseAsParamAttr ( AttrKind Kind)
static

Definition at line 789 of file Attributes.cpp.

References hasAttributeProperty(), and ParamAttr.

◆ canUseAsRetAttr()

bool Attribute::canUseAsRetAttr ( AttrKind Kind)
static

Definition at line 793 of file Attributes.cpp.

References hasAttributeProperty(), and RetAttr.

◆ cmpKind()

int Attribute::cmpKind ( Attribute A) const

Used to sort attribute by kind.

Definition at line 739 of file Attributes.cpp.

References A().

◆ fromRawPointer()

Attribute llvm::Attribute::fromRawPointer ( void * RawPtr)
inlinestatic

Get an attribute from a raw pointer created by getRawPointer.

Definition at line 340 of file Attributes.h.

References Attribute().

Referenced by llvm::unwrap().

◆ get() [1/5]

◆ get() [2/5]

◆ get() [3/5]

Attribute Attribute::get ( LLVMContext & Context,
Attribute::AttrKind Kind,
Type * Ty )
static

Definition at line 149 of file Attributes.cpp.

References assert(), Attribute(), and isTypeAttrKind().

◆ get() [4/5]

Attribute Attribute::get ( LLVMContext & Context,
Attribute::AttrKind Kind,
uint64_t Val = 0 )
static

Return a uniquified Attribute object.

Definition at line 95 of file Attributes.cpp.

References assert(), Attribute(), get(), isEnumAttrKind(), and isIntAttrKind().

Referenced by llvm::memprof::addAmbiguousAttribute(), llvm::memprof::CallStackTrie::addSingleAllocTypeAttribute(), CreateGCStatepointCallCommon(), CreateGCStatepointInvokeCommon(), llvm::IRBuilderBase::CreatePreserveArrayAccessIndex(), llvm::IRBuilderBase::CreatePreserveStructAccessIndex(), llvm::AArch64TargetLowering::emitLoadLinked(), llvm::ARMTargetLowering::emitLoadLinked(), llvm::AArch64TargetLowering::emitStoreConditional(), llvm::ARMTargetLowering::emitStoreConditional(), emitTPIDR2Save(), get(), llvm::Attributor::getAttrsFromAssumes(), llvm::IRAttribute< AK, BaseType, AAType >::getDeducedAttributes(), getWithAlignment(), getWithAllocKind(), getWithAllocSizeArgs(), getWithByRefType(), getWithByValType(), getWithCaptureInfo(), getWithDereferenceableBytes(), getWithDereferenceableOrNullBytes(), getWithInAllocaType(), getWithMemoryEffects(), getWithNewType(), getWithNoFPClass(), getWithPreallocatedType(), getWithStackAlignment(), getWithStructRetType(), getWithUWTableKind(), getWithVScaleRangeArgs(), llvm::Attributor::hasAttr(), llvm::inferAttribute(), inferInitializes(), insertCall(), llvm::AANoSync::isImpliedByIR(), llvm::AANoUndef::isImpliedByIR(), llvm::AAWillReturn::isImpliedByIR(), LLVMAddTargetDependentFunctionAttr(), LLVMCreateConstantRangeAttribute(), LLVMCreateEnumAttribute(), LLVMCreateStringAttribute(), LLVMCreateTypeAttribute(), LLVMDIBuilderGetOrCreateArray(), LLVMDIBuilderGetOrCreateTypeArray(), processCallSite(), llvm::InlinerPass::run(), setAllocKind(), llvm::codegen::setFunctionAttributes(), llvm::setInlineRemark(), setParamElementType(), setParamReadNone(), setParamReadOnly(), setParamWriteOnly(), llvm::VFABI::setVectorVariantNames(), and upgradeSingleNVVMAnnotation().

◆ get() [5/5]

Attribute Attribute::get ( LLVMContext & Context,
StringRef Kind,
StringRef Val = StringRef() )
static

◆ getAlignment()

MaybeAlign Attribute::getAlignment ( ) const

Returns the alignment field of an attribute as a byte alignment value.

Definition at line 435 of file Attributes.cpp.

References assert(), and hasAttribute().

Referenced by llvm::AttributeSet::intersectWith().

◆ getAllocKind()

AllocFnKind Attribute::getAllocKind ( ) const

Definition at line 486 of file Attributes.cpp.

References assert(), and hasAttribute().

Referenced by getAsString().

◆ getAllocSizeArgs()

std::pair< unsigned, std::optional< unsigned > > Attribute::getAllocSizeArgs ( ) const

Returns the argument numbers for the allocsize attribute.

Definition at line 462 of file Attributes.cpp.

References assert(), hasAttribute(), and unpackAllocSizeArgs().

Referenced by getAllocationSize(), and getAsString().

◆ getAsString()

◆ getAttrKindFromName()

◆ getCaptureInfo()

CaptureInfo Attribute::getCaptureInfo ( ) const

Returns information from captures attribute.

Definition at line 498 of file Attributes.cpp.

References assert(), llvm::CaptureInfo::createFromIntValue(), and hasAttribute().

Referenced by getAsString(), llvm::AttributeSet::intersectWith(), and llvm::AANoCapture::isImpliedByIR().

◆ getDereferenceableBytes()

uint64_t Attribute::getDereferenceableBytes ( ) const

Returns the number of dereferenceable bytes from the dereferenceable attribute.

Definition at line 447 of file Attributes.cpp.

References assert(), and hasAttribute().

Referenced by tryToMoveFreeBeforeNullTest().

◆ getDereferenceableOrNullBytes()

uint64_t Attribute::getDereferenceableOrNullBytes ( ) const

Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.

Definition at line 454 of file Attributes.cpp.

References assert(), and hasAttribute().

◆ getInitializes()

ArrayRef< ConstantRange > Attribute::getInitializes ( ) const

Returns the value of the initializes attribute.

Definition at line 516 of file Attributes.cpp.

References assert(), and hasAttribute().

Referenced by getAsString().

◆ getKindAsEnum()

Attribute::AttrKind Attribute::getKindAsEnum ( ) const

Return the attribute's kind as an enum (Attribute::AttrKind).

This requires the attribute be representable as an enum (see: hasKindAsEnum).

Definition at line 372 of file Attributes.cpp.

References assert(), hasKindAsEnum(), and None.

Referenced by addIfNotExistent(), getAsString(), getWithNewType(), llvm::AttributeSet::intersectWith(), llvm::AANoCapture::isImpliedByIR(), LLVMGetEnumAttributeKind(), AttributeComparator::operator()(), and AttributeComparator::operator()().

◆ getKindAsString()

StringRef Attribute::getKindAsString ( ) const

Return the attribute's kind as a string.

This requires the attribute to be a string attribute.

Definition at line 393 of file Attributes.cpp.

References assert(), and isStringAttribute().

Referenced by addIfNotExistent(), getAsString(), LLVMGetStringAttributeKind(), AttributeComparator::operator()(), and AttributeComparator::operator()().

◆ getMemoryEffects()

MemoryEffects Attribute::getMemoryEffects ( ) const

◆ getNameFromAttrKind()

StringRef Attribute::getNameFromAttrKind ( Attribute::AttrKind AttrKind)
static

Definition at line 322 of file Attributes.cpp.

References llvm_unreachable, and None.

Referenced by getAsString(), llvm::hasAttributeInAssume(), and printFunctionArgExts().

◆ getNoFPClass()

FPClassTest Attribute::getNoFPClass ( ) const

Return the FPClassTest for nofpclass.

Definition at line 504 of file Attributes.cpp.

References assert(), and hasAttribute().

Referenced by getAsString(), and llvm::AttributeSet::intersectWith().

◆ getRange()

const ConstantRange & Attribute::getRange ( ) const

◆ getRawPointer()

void * llvm::Attribute::getRawPointer ( ) const
inline

Return a raw pointer that uniquely identifies this attribute.

Definition at line 335 of file Attributes.h.

Referenced by llvm::wrap().

◆ getStackAlignment()

MaybeAlign Attribute::getStackAlignment ( ) const

Returns the stack alignment field of an attribute as a byte alignment value.

Definition at line 441 of file Attributes.cpp.

References assert(), and hasAttribute().

◆ getUWTableKind()

UWTableKind Attribute::getUWTableKind ( ) const

Definition at line 480 of file Attributes.cpp.

References assert(), and hasAttribute().

Referenced by getAsString().

◆ getValueAsBool()

bool Attribute::getValueAsBool ( ) const

Return the attribute's value as a boolean.

This requires that the attribute be a string attribute.

Definition at line 386 of file Attributes.cpp.

References assert(), and isStringAttribute().

Referenced by llvm::AMDGPUMachineFunction::AMDGPUMachineFunction(), llvm::TargetLoweringBase::areJTsAllowed(), atomicIgnoresDenormalModeOrFPModeIsFTZ(), llvm::GCNTTIImpl::fpenvIEEEMode(), and simplifySwitchLookup().

◆ getValueAsConstantRange()

const ConstantRange & Attribute::getValueAsConstantRange ( ) const

Return the attribute's value as a ConstantRange.

This requires the attribute to be a ConstantRange attribute.

Definition at line 414 of file Attributes.cpp.

References assert(), and isConstantRangeAttribute().

Referenced by getAsString().

◆ getValueAsConstantRangeList()

ArrayRef< ConstantRange > Attribute::getValueAsConstantRangeList ( ) const

Return the attribute's value as a ConstantRange array.

This requires the attribute to be a ConstantRangeList attribute.

Definition at line 420 of file Attributes.cpp.

References assert(), and isConstantRangeListAttribute().

◆ getValueAsInt()

uint64_t Attribute::getValueAsInt ( ) const

Return the attribute's value as an integer.

This requires that the attribute be an integer attribute.

Definition at line 379 of file Attributes.cpp.

References assert(), and isIntAttribute().

Referenced by getAllocFnKind(), getAsString(), llvm::AttributeSet::intersectWith(), and isEqualOrWorse().

◆ getValueAsString()

StringRef Attribute::getValueAsString ( ) const

Return the attribute's value as a string.

This requires the attribute to be a string attribute.

Definition at line 400 of file Attributes.cpp.

References assert(), and isStringAttribute().

Referenced by llvm::memprof::addAmbiguousAttribute(), addIfNotExistent(), adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), collectMetadataInfo(), llvm::GCNTargetMachine::createMachineScheduler(), llvm::TargetOptions::DisableFramePointerElim(), llvm::SystemZELFFrameLowering::emitPrologue(), llvm::TargetOptions::FramePointerIsReserved(), llvm::getAllocationFamily(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::AMDGPUTargetMachine::getGPUName(), llvm::RISCVMachineFunctionInfo::getInterruptStackKind(), llvm::X86TargetLowering::getStackProbeSymbolName(), llvm::getStringFnAttrAsInt(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::CSKYTargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::LoongArchTargetMachine::getSubtargetImpl(), llvm::M68kTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::RISCVTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::SystemZTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::XtensaTargetMachine::getSubtargetImpl(), llvm::VFABI::getVectorVariantNames(), llvm::PPCTargetLowering::hasInlineStackProbe(), llvm::RISCVTargetLowering::hasInlineStackProbe(), llvm::SystemZTargetLowering::hasInlineStackProbe(), llvm::X86TargetLowering::hasInlineStackProbe(), isThumbFunction(), LLVMGetStringAttributeValue(), llvm::RISCVTargetLowering::LowerFormalArguments(), llvm::RISCVTargetLowering::LowerReturn(), llvm::GCNSubtarget::overridePostRASchedPolicy(), llvm::parseStatepointDirectivesFromAttrs(), llvm::memprof::removeAnyExistingAmbiguousAttribute(), and llvm::updateMinLegalVectorWidthAttr().

◆ getValueAsType()

Type * Attribute::getValueAsType ( ) const

Return the attribute's value as a Type.

This requires the attribute to be a type attribute.

Definition at line 407 of file Attributes.cpp.

References assert(), and isTypeAttribute().

Referenced by getAsString().

◆ getVScaleRangeMax()

std::optional< unsigned > Attribute::getVScaleRangeMax ( ) const

Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.

Definition at line 474 of file Attributes.cpp.

References assert(), hasAttribute(), and unpackVScaleRangeArgs().

Referenced by getAsString(), llvm::RISCVTargetMachine::getSubtargetImpl(), llvm::getVScaleRange(), llvm::InstCombinerImpl::visitSExt(), llvm::InstCombinerImpl::visitTrunc(), and llvm::InstCombinerImpl::visitZExt().

◆ getVScaleRangeMin()

unsigned Attribute::getVScaleRangeMin ( ) const

Returns the minimum value for the vscale_range attribute.

Definition at line 468 of file Attributes.cpp.

References assert(), hasAttribute(), and unpackVScaleRangeArgs().

Referenced by getAsString(), llvm::RISCVTargetMachine::getSubtargetImpl(), and llvm::getVScaleRange().

◆ getWithAlignment()

◆ getWithAllocKind()

Attribute Attribute::getWithAllocKind ( LLVMContext & Context,
AllocFnKind Kind )
static

Definition at line 303 of file Attributes.cpp.

References get().

◆ getWithAllocSizeArgs()

Attribute Attribute::getWithAllocSizeArgs ( LLVMContext & Context,
unsigned ElemSizeArg,
const std::optional< unsigned > & NumElemsArg )
static

Definition at line 296 of file Attributes.cpp.

References assert(), get(), and packAllocSizeArgs().

Referenced by doPromotion(), and setAllocSize().

◆ getWithByRefType()

Attribute Attribute::getWithByRefType ( LLVMContext & Context,
Type * Ty )
static

Definition at line 264 of file Attributes.cpp.

References get().

◆ getWithByValType()

Attribute Attribute::getWithByValType ( LLVMContext & Context,
Type * Ty )
static

Definition at line 256 of file Attributes.cpp.

References get().

◆ getWithCaptureInfo()

Attribute Attribute::getWithCaptureInfo ( LLVMContext & Context,
CaptureInfo CI )
static

◆ getWithDereferenceableBytes()

Attribute Attribute::getWithDereferenceableBytes ( LLVMContext & Context,
uint64_t Bytes )
static

Definition at line 244 of file Attributes.cpp.

References assert(), and get().

Referenced by annotateDereferenceableBytes(), and lowerKernelArguments().

◆ getWithDereferenceableOrNullBytes()

Attribute Attribute::getWithDereferenceableOrNullBytes ( LLVMContext & Context,
uint64_t Bytes )
static

Definition at line 250 of file Attributes.cpp.

References assert(), and get().

◆ getWithInAllocaType()

Attribute Attribute::getWithInAllocaType ( LLVMContext & Context,
Type * Ty )
static

Definition at line 272 of file Attributes.cpp.

References get().

◆ getWithMemoryEffects()

◆ getWithNewType()

Attribute llvm::Attribute::getWithNewType ( LLVMContext & Context,
Type * ReplacementTy )
inline

For a typed attribute, return the equivalent attribute with the type changed to ReplacementTy.

Definition at line 186 of file Attributes.h.

References assert(), get(), getKindAsEnum(), and isTypeAttribute().

◆ getWithNoFPClass()

Attribute Attribute::getWithNoFPClass ( LLVMContext & Context,
FPClassTest Mask )
static

Definition at line 286 of file Attributes.cpp.

References get().

◆ getWithPreallocatedType()

Attribute Attribute::getWithPreallocatedType ( LLVMContext & Context,
Type * Ty )
static

Definition at line 268 of file Attributes.cpp.

References get().

◆ getWithStackAlignment()

Attribute Attribute::getWithStackAlignment ( LLVMContext & Context,
Align Alignment )
static

Definition at line 239 of file Attributes.cpp.

References A(), assert(), and get().

Referenced by upgradeSingleNVVMAnnotation().

◆ getWithStructRetType()

Attribute Attribute::getWithStructRetType ( LLVMContext & Context,
Type * Ty )
static

Definition at line 260 of file Attributes.cpp.

References get().

◆ getWithUWTableKind()

Attribute Attribute::getWithUWTableKind ( LLVMContext & Context,
UWTableKind Kind )
static

Definition at line 276 of file Attributes.cpp.

References get().

Referenced by llvm::Function::setUWTableKind().

◆ getWithVScaleRangeArgs()

Attribute Attribute::getWithVScaleRangeArgs ( LLVMContext & Context,
unsigned MinValue,
unsigned MaxValue )
static

Definition at line 307 of file Attributes.cpp.

References get(), and packVScaleRangeArgs().

◆ hasAttribute() [1/2]

◆ hasAttribute() [2/2]

bool Attribute::hasAttribute ( StringRef Val) const

Return true if the target-dependent attribute is present.

Definition at line 430 of file Attributes.cpp.

References isStringAttribute().

◆ hasKindAsEnum()

bool llvm::Attribute::hasKindAsEnum ( ) const
inline

Returns true if the attribute's kind can be represented as an enum (Enum, Integer, Type, ConstantRange, or ConstantRangeList attribute).

Definition at line 233 of file Attributes.h.

References isStringAttribute().

Referenced by getKindAsEnum(), and llvm::AttributeSet::intersectWith().

◆ hasParentContext()

bool Attribute::hasParentContext ( LLVMContext & C) const

Return true if this attribute belongs to the LLVMContext.

Definition at line 731 of file Attributes.cpp.

References assert(), llvm::CallingConv::C, and isValid().

◆ intersectMustPreserve()

bool Attribute::intersectMustPreserve ( AttrKind Kind)
static

Definition at line 808 of file Attributes.cpp.

References hasIntersectProperty(), and IntersectPreserve.

Referenced by llvm::AttributeSet::intersectWith().

◆ intersectWithAnd()

bool Attribute::intersectWithAnd ( AttrKind Kind)
static

Definition at line 811 of file Attributes.cpp.

References hasIntersectProperty(), and IntersectAnd.

Referenced by llvm::AttributeSet::intersectWith().

◆ intersectWithCustom()

bool Attribute::intersectWithCustom ( AttrKind Kind)
static

Definition at line 817 of file Attributes.cpp.

References hasIntersectProperty(), and IntersectCustom.

Referenced by llvm::AttributeSet::intersectWith().

◆ intersectWithMin()

bool Attribute::intersectWithMin ( AttrKind Kind)
static

Definition at line 814 of file Attributes.cpp.

References hasIntersectProperty(), and IntersectMin.

Referenced by llvm::AttributeSet::intersectWith().

◆ isConstantRangeAttribute()

bool Attribute::isConstantRangeAttribute ( ) const

Return true if the attribute is a ConstantRange attribute.

Definition at line 364 of file Attributes.cpp.

Referenced by addIfNotExistent(), and getValueAsConstantRange().

◆ isConstantRangeAttrKind()

bool llvm::Attribute::isConstantRangeAttrKind ( AttrKind Kind)
inlinestatic

Definition at line 110 of file Attributes.h.

Referenced by get().

◆ isConstantRangeListAttribute()

bool Attribute::isConstantRangeListAttribute ( ) const

Return true if the attribute is a ConstantRangeList attribute.

Definition at line 368 of file Attributes.cpp.

Referenced by getValueAsConstantRangeList().

◆ isConstantRangeListAttrKind()

bool llvm::Attribute::isConstantRangeListAttrKind ( AttrKind Kind)
inlinestatic

Definition at line 113 of file Attributes.h.

Referenced by get().

◆ isEnumAttribute()

bool Attribute::isEnumAttribute ( ) const

Return true if the attribute is an Attribute::AttrKind type.

Definition at line 348 of file Attributes.cpp.

Referenced by addIfNotExistent(), and getAsString().

◆ isEnumAttrKind()

◆ isExistingAttribute()

bool Attribute::isExistingAttribute ( StringRef Name)
static

Return true if the provided string matches the IR name of an attribute.

example: "noalias" return true but not "NoAlias"

Definition at line 336 of file Attributes.cpp.

References llvm::StringSwitch< T, R >::Default().

Referenced by llvm::hasAttributeInAssume().

◆ isIntAttribute()

bool Attribute::isIntAttribute ( ) const

Return true if the attribute is an integer attribute.

Definition at line 352 of file Attributes.cpp.

Referenced by addIfNotExistent(), getValueAsInt(), and isEqualOrWorse().

◆ isIntAttrKind()

bool llvm::Attribute::isIntAttrKind ( AttrKind Kind)
inlinestatic

◆ isStringAttribute()

◆ isTypeAttribute()

bool Attribute::isTypeAttribute ( ) const

Return true if the attribute is a type attribute.

Definition at line 360 of file Attributes.cpp.

Referenced by getAsString(), getValueAsType(), getWithNewType(), and LLVMIsTypeAttribute().

◆ isTypeAttrKind()

bool llvm::Attribute::isTypeAttrKind ( AttrKind Kind)
inlinestatic

Definition at line 107 of file Attributes.h.

Referenced by addRawAttributeValue(), and get().

◆ isValid()

bool llvm::Attribute::isValid ( ) const
inline

Return true if the attribute is any kind of attribute.

Definition at line 223 of file Attributes.h.

Referenced by addNoUndefAttrs(), AddParamAndFnBasicAttributes(), AddReturnAttributes(), adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), collectMetadataInfo(), llvm::GCNTargetMachine::createMachineScheduler(), llvm::TargetOptions::DisableFramePointerElim(), llvm::GCNTTIImpl::fpenvIEEEMode(), llvm::TargetOptions::FramePointerIsReserved(), llvm::getAllocationFamily(), getAllocFnKind(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::CallBase::getFnAttr(), llvm::AMDGPUTargetMachine::getGPUName(), getParameterABIAttributes(), llvm::CallBase::getRange(), llvm::getStringFnAttrAsInt(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::CSKYTargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::LoongArchTargetMachine::getSubtargetImpl(), llvm::M68kTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::RISCVTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::SystemZTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::XtensaTargetMachine::getSubtargetImpl(), llvm::getVScaleRange(), hasParentContext(), llvm::inferAttribute(), llvm::AttributeSet::intersectWith(), isThumbFunction(), llvm::SPIRVCallLowering::lowerCall(), llvm::SPIRVCallLowering::lowerReturn(), llvm::GCNSubtarget::overridePostRASchedPolicy(), runImpl(), tryToMoveFreeBeforeNullTest(), llvm::typeIncompatible(), and llvm::updateMinLegalVectorWidthAttr().

◆ operator!=()

bool llvm::Attribute::operator!= ( Attribute A) const
inline

Definition at line 324 of file Attributes.h.

References A().

◆ operator<()

bool Attribute::operator< ( Attribute A) const

Less-than operator. Useful for sorting the attributes list.

Definition at line 749 of file Attributes.cpp.

References A().

◆ operator==()

bool llvm::Attribute::operator== ( Attribute A) const
inline

Equality and non-equality operators.

Definition at line 323 of file Attributes.h.

References A().

◆ Profile()

void Attribute::Profile ( FoldingSetNodeID & ID) const

Definition at line 756 of file Attributes.cpp.

Member Data Documentation

◆ NumIntAttrKinds

const unsigned llvm::Attribute::NumIntAttrKinds = LastIntAttr - FirstIntAttr + 1
static

Definition at line 98 of file Attributes.h.

◆ NumTypeAttrKinds

const unsigned llvm::Attribute::NumTypeAttrKinds = LastTypeAttr - FirstTypeAttr + 1
static

Definition at line 99 of file Attributes.h.


The documentation for this class was generated from the following files: