LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::AttributeSet Class Reference

#include "llvm/IR/Attributes.h"

Public Types

using iterator = const Attribute *
 

Public Member Functions

 AttributeSet ()=default
 AttributeSet is a trivially copyable value type.
 
 AttributeSet (const AttributeSet &)=default
 
 ~AttributeSet ()=default
 
bool operator== (const AttributeSet &O) const
 
bool operator!= (const AttributeSet &O) const
 
AttributeSet addAttribute (LLVMContext &C, Attribute::AttrKind Kind) const
 Add an argument attribute.
 
AttributeSet addAttribute (LLVMContext &C, StringRef Kind, StringRef Value=StringRef()) const
 Add a target-dependent attribute.
 
AttributeSet addAttributes (LLVMContext &C, AttributeSet AS) const
 Add attributes to the attribute set.
 
AttributeSet removeAttribute (LLVMContext &C, Attribute::AttrKind Kind) const
 Remove the specified attribute from this set.
 
AttributeSet removeAttribute (LLVMContext &C, StringRef Kind) const
 Remove the specified attribute from this set.
 
AttributeSet removeAttributes (LLVMContext &C, const AttributeMask &AttrsToRemove) const
 Remove the specified attributes from this set.
 
std::optional< AttributeSetintersectWith (LLVMContext &C, AttributeSet Other) const
 Try to intersect this AttributeSet with Other.
 
unsigned getNumAttributes () const
 Return the number of attributes in this set.
 
bool hasAttributes () const
 Return true if attributes exists in this set.
 
bool hasAttribute (Attribute::AttrKind Kind) const
 Return true if the attribute exists in this set.
 
bool hasAttribute (StringRef Kind) const
 Return true if the attribute exists in this set.
 
Attribute getAttribute (Attribute::AttrKind Kind) const
 Return the attribute object.
 
Attribute getAttribute (StringRef Kind) const
 Return the target-dependent attribute object.
 
MaybeAlign getAlignment () const
 
MaybeAlign getStackAlignment () const
 
uint64_t getDereferenceableBytes () const
 
uint64_t getDereferenceableOrNullBytes () const
 
TypegetByValType () const
 
TypegetStructRetType () const
 
TypegetByRefType () const
 
TypegetPreallocatedType () const
 
TypegetInAllocaType () const
 
TypegetElementType () const
 
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs () const
 
unsigned getVScaleRangeMin () const
 
std::optional< unsignedgetVScaleRangeMax () const
 
UWTableKind getUWTableKind () const
 
AllocFnKind getAllocKind () const
 
MemoryEffects getMemoryEffects () const
 
FPClassTest getNoFPClass () const
 
std::string getAsString (bool InAttrGrp=false) const
 
bool hasParentContext (LLVMContext &C) const
 Return true if this attribute set belongs to the LLVMContext.
 
iterator begin () const
 
iterator end () const
 
void dump () const
 

Static Public Member Functions

static AttributeSet get (LLVMContext &C, const AttrBuilder &B)
 
static AttributeSet get (LLVMContext &C, ArrayRef< Attribute > Attrs)
 

Friends

template<typename Ty , typename Enable >
struct DenseMapInfo
 

Detailed Description

Definition at line 342 of file Attributes.h.

Member Typedef Documentation

◆ iterator

Definition at line 445 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttributeSet() [1/2]

llvm::AttributeSet::AttributeSet ( )
default

AttributeSet is a trivially copyable value type.

Referenced by get().

◆ AttributeSet() [2/2]

llvm::AttributeSet::AttributeSet ( const AttributeSet )
default

◆ ~AttributeSet()

llvm::AttributeSet::~AttributeSet ( )
default

Member Function Documentation

◆ addAttribute() [1/2]

AttributeSet AttributeSet::addAttribute ( LLVMContext C,
Attribute::AttrKind  Kind 
) const

Add an argument attribute.

Returns a new set because attribute sets are immutable.

Definition at line 905 of file Attributes.cpp.

References addAttributes(), B, llvm::CallingConv::C, get(), and hasAttribute().

Referenced by llvm::OpenMPIRBuilder::addAttributes().

◆ addAttribute() [2/2]

AttributeSet AttributeSet::addAttribute ( LLVMContext C,
StringRef  Kind,
StringRef  Value = StringRef() 
) const

Add a target-dependent attribute.

Returns a new set because attribute sets are immutable.

Definition at line 913 of file Attributes.cpp.

References addAttributes(), B, llvm::CallingConv::C, and get().

◆ addAttributes()

AttributeSet AttributeSet::addAttributes ( LLVMContext C,
AttributeSet  AS 
) const

Add attributes to the attribute set.

Returns a new set because attribute sets are immutable.

Definition at line 920 of file Attributes.cpp.

References B, llvm::CallingConv::C, get(), and hasAttributes().

Referenced by addAttribute(), and llvm::OpenMPIRBuilder::addAttributes().

◆ begin()

AttributeSet::iterator AttributeSet::begin ( ) const

Definition at line 1189 of file Attributes.cpp.

References llvm::AttributeSetNode::begin().

Referenced by intersectWith().

◆ dump()

LLVM_DUMP_METHOD void AttributeSet::dump ( ) const

Definition at line 1198 of file Attributes.cpp.

References llvm::dbgs(), and getAsString().

◆ end()

AttributeSet::iterator AttributeSet::end ( ) const

Definition at line 1193 of file Attributes.cpp.

References llvm::AttributeSetNode::end().

Referenced by intersectWith().

◆ get() [1/2]

AttributeSet AttributeSet::get ( LLVMContext C,
ArrayRef< Attribute Attrs 
)
static

◆ get() [2/2]

AttributeSet AttributeSet::get ( LLVMContext C,
const AttrBuilder B 
)
static

◆ getAlignment()

MaybeAlign AttributeSet::getAlignment ( ) const

◆ getAllocKind()

AllocFnKind AttributeSet::getAllocKind ( ) const

◆ getAllocSizeArgs()

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

Definition at line 1147 of file Attributes.cpp.

References llvm::AttributeSetNode::getAllocSizeArgs().

Referenced by doPromotion().

◆ getAsString()

std::string AttributeSet::getAsString ( bool  InAttrGrp = false) const

Definition at line 1177 of file Attributes.cpp.

References llvm::AttributeSetNode::getAsString().

Referenced by dump(), and llvm::AttributeList::getAsString().

◆ getAttribute() [1/2]

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

◆ getAttribute() [2/2]

Attribute AttributeSet::getAttribute ( StringRef  Kind) const

Return the target-dependent attribute object.

Definition at line 1102 of file Attributes.cpp.

References llvm::AttributeSetNode::getAttribute().

◆ getByRefType()

Type * AttributeSet::getByRefType ( ) const

◆ getByValType()

Type * AttributeSet::getByValType ( ) const

◆ getDereferenceableBytes()

uint64_t AttributeSet::getDereferenceableBytes ( ) const

◆ getDereferenceableOrNullBytes()

uint64_t AttributeSet::getDereferenceableOrNullBytes ( ) const

◆ getElementType()

Type * AttributeSet::getElementType ( ) const

◆ getInAllocaType()

Type * AttributeSet::getInAllocaType ( ) const

◆ getMemoryEffects()

MemoryEffects AttributeSet::getMemoryEffects ( ) const

◆ getNoFPClass()

FPClassTest AttributeSet::getNoFPClass ( ) const

◆ getNumAttributes()

unsigned AttributeSet::getNumAttributes ( ) const

Return the number of attributes in this set.

Definition at line 1086 of file Attributes.cpp.

References llvm::AttributeSetNode::getNumAttributes().

◆ getPreallocatedType()

Type * AttributeSet::getPreallocatedType ( ) const

◆ getStackAlignment()

MaybeAlign AttributeSet::getStackAlignment ( ) const

◆ getStructRetType()

Type * AttributeSet::getStructRetType ( ) const

◆ getUWTableKind()

UWTableKind AttributeSet::getUWTableKind ( ) const

◆ getVScaleRangeMax()

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

Definition at line 1157 of file Attributes.cpp.

References llvm::AttributeSetNode::getVScaleRangeMax().

◆ getVScaleRangeMin()

unsigned AttributeSet::getVScaleRangeMin ( ) const

Definition at line 1153 of file Attributes.cpp.

References llvm::AttributeSetNode::getVScaleRangeMin().

◆ hasAttribute() [1/2]

bool AttributeSet::hasAttribute ( Attribute::AttrKind  Kind) const

◆ hasAttribute() [2/2]

bool AttributeSet::hasAttribute ( StringRef  Kind) const

Return true if the attribute exists in this set.

Definition at line 1094 of file Attributes.cpp.

References llvm::AttributeSetNode::hasAttribute().

◆ hasAttributes()

bool llvm::AttributeSet::hasAttributes ( ) const
inline

Return true if attributes exists in this set.

Definition at line 408 of file Attributes.h.

Referenced by addAttributes(), llvm::AttributeList::get(), llvm::AttributeList::hasAttributesAtIndex(), and hasParentContext().

◆ hasParentContext()

bool AttributeSet::hasParentContext ( LLVMContext C) const

Return true if this attribute set belongs to the LLVMContext.

Definition at line 1181 of file Attributes.cpp.

References assert(), llvm::CallingConv::C, hasAttributes(), and llvm::AttributeSetNode::Profile().

◆ intersectWith()

std::optional< AttributeSet > AttributeSet::intersectWith ( LLVMContext C,
AttributeSet  Other 
) const

◆ operator!=()

bool llvm::AttributeSet::operator!= ( const AttributeSet O) const
inline

Definition at line 366 of file Attributes.h.

◆ operator==()

bool llvm::AttributeSet::operator== ( const AttributeSet O) const
inline

Definition at line 365 of file Attributes.h.

◆ removeAttribute() [1/2]

AttributeSet AttributeSet::removeAttribute ( LLVMContext C,
Attribute::AttrKind  Kind 
) const

Remove the specified attribute from this set.

Returns a new set because attribute sets are immutable.

Definition at line 933 of file Attributes.cpp.

References B, llvm::CallingConv::C, get(), and hasAttribute().

Referenced by AddParamAndFnBasicAttributes().

◆ removeAttribute() [2/2]

AttributeSet AttributeSet::removeAttribute ( LLVMContext C,
StringRef  Kind 
) const

Remove the specified attribute from this set.

Returns a new set because attribute sets are immutable.

Definition at line 941 of file Attributes.cpp.

References B, llvm::CallingConv::C, get(), and hasAttribute().

◆ removeAttributes()

AttributeSet AttributeSet::removeAttributes ( LLVMContext C,
const AttributeMask AttrsToRemove 
) const

Remove the specified attributes from this set.

Returns a new set because attribute sets are immutable.

Definition at line 949 of file Attributes.cpp.

References B, llvm::CallingConv::C, and get().

Referenced by moveFunctionAdaptingType().

Friends And Related Function Documentation

◆ DenseMapInfo

template<typename Ty , typename Enable >
friend struct DenseMapInfo
friend

Definition at line 344 of file Attributes.h.


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