LLVM  14.0.0git
Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
llvm::AttributeList Class Reference

#include "llvm/IR/Attributes.h"

Classes

struct  index_iterator
 

Public Types

enum  AttrIndex : unsigned { ReturnIndex = 0U, FunctionIndex = ~0U, FirstArgIndex = 1 }
 
using iterator = const AttributeSet *
 

Public Member Functions

 AttributeList ()=default
 
LLVM_NODISCARD AttributeList addAttributeAtIndex (LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
 Add an attribute to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addAttributeAtIndex (LLVMContext &C, unsigned Index, StringRef Kind, StringRef Value=StringRef()) const
 Add an attribute to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addAttributeAtIndex (LLVMContext &C, unsigned Index, Attribute A) const
 Add an attribute to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addAttributesAtIndex (LLVMContext &C, unsigned Index, const AttrBuilder &B) const
 Add attributes to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addFnAttribute (LLVMContext &C, Attribute::AttrKind Kind) const
 Add a function attribute to the list. More...
 
LLVM_NODISCARD AttributeList addFnAttribute (LLVMContext &C, Attribute Attr) const
 Add a function attribute to the list. More...
 
LLVM_NODISCARD AttributeList addFnAttribute (LLVMContext &C, StringRef Kind, StringRef Value=StringRef()) const
 Add a function attribute to the list. More...
 
LLVM_NODISCARD AttributeList addFnAttributes (LLVMContext &C, const AttrBuilder &B) const
 Add function attribute to the list. More...
 
LLVM_NODISCARD AttributeList addRetAttribute (LLVMContext &C, Attribute::AttrKind Kind) const
 Add a return value attribute to the list. More...
 
LLVM_NODISCARD AttributeList addRetAttribute (LLVMContext &C, Attribute Attr) const
 Add a return value attribute to the list. More...
 
LLVM_NODISCARD AttributeList addRetAttributes (LLVMContext &C, const AttrBuilder &B) const
 Add a return value attribute to the list. More...
 
LLVM_NODISCARD AttributeList addParamAttribute (LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
 Add an argument attribute to the list. More...
 
LLVM_NODISCARD AttributeList addParamAttribute (LLVMContext &C, unsigned ArgNo, StringRef Kind, StringRef Value=StringRef()) const
 Add an argument attribute to the list. More...
 
LLVM_NODISCARD AttributeList addParamAttribute (LLVMContext &C, ArrayRef< unsigned > ArgNos, Attribute A) const
 Add an attribute to the attribute list at the given arg indices. More...
 
LLVM_NODISCARD AttributeList addParamAttributes (LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
 Add an argument attribute to the list. More...
 
LLVM_NODISCARD AttributeList removeAttributeAtIndex (LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
 Remove the specified attribute at the specified index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeAttributeAtIndex (LLVMContext &C, unsigned Index, StringRef Kind) const
 Remove the specified attribute at the specified index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeAttribute (LLVMContext &C, unsigned Index, StringRef Kind) const
 
LLVM_NODISCARD AttributeList removeAttributesAtIndex (LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
 Remove the specified attributes at the specified index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeAttributesAtIndex (LLVMContext &C, unsigned Index) const
 Remove all attributes at the specified index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeFnAttribute (LLVMContext &C, Attribute::AttrKind Kind) const
 Remove the specified attribute at the function index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeFnAttribute (LLVMContext &C, StringRef Kind) const
 Remove the specified attribute at the function index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeFnAttributes (LLVMContext &C, const AttrBuilder &AttrsToRemove) const
 Remove the specified attribute at the function index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeFnAttributes (LLVMContext &C) const
 Remove the attributes at the function index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeRetAttribute (LLVMContext &C, Attribute::AttrKind Kind) const
 Remove the specified attribute at the return value index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeRetAttribute (LLVMContext &C, StringRef Kind) const
 Remove the specified attribute at the return value index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeRetAttributes (LLVMContext &C, const AttrBuilder &AttrsToRemove) const
 Remove the specified attribute at the return value index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeParamAttribute (LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
 Remove the specified attribute at the specified arg index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeParamAttribute (LLVMContext &C, unsigned ArgNo, StringRef Kind) const
 Remove the specified attribute at the specified arg index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeParamAttributes (LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const
 Remove the specified attribute at the specified arg index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeParamAttributes (LLVMContext &C, unsigned ArgNo) const
 Remove all attributes at the specified arg index from this attribute list. More...
 
LLVM_NODISCARD AttributeList replaceAttributeTypeAtIndex (LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind, Type *ReplacementTy) const
 Replace the type contained by attribute AttrKind at index ArgNo wih ReplacementTy, preserving all other attributes. More...
 
LLVM_NODISCARD AttributeList addDereferenceableRetAttr (LLVMContext &C, uint64_t Bytes) const
 Add the dereferenceable attribute to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addDereferenceableParamAttr (LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
 Add the dereferenceable attribute to the attribute set at the given arg index. More...
 
LLVM_NODISCARD AttributeList addDereferenceableOrNullParamAttr (LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
 Add the dereferenceable_or_null attribute to the attribute set at the given arg index. More...
 
LLVM_NODISCARD AttributeList addAllocSizeParamAttr (LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
 Add the allocsize attribute to the attribute set at the given arg index. More...
 
AttributeSet getAttributes (unsigned Index) const
 The attributes for the specified index are returned. More...
 
AttributeSet getParamAttrs (unsigned ArgNo) const
 The attributes for the argument or parameter at the given index are returned. More...
 
AttributeSet getRetAttrs () const
 The attributes for the ret value are returned. More...
 
AttributeSet getFnAttrs () const
 The function attributes are returned. More...
 
bool hasAttributeAtIndex (unsigned Index, Attribute::AttrKind Kind) const
 Return true if the attribute exists at the given index. More...
 
bool hasAttributeAtIndex (unsigned Index, StringRef Kind) const
 Return true if the attribute exists at the given index. More...
 
bool hasAttributesAtIndex (unsigned Index) const
 Return true if attribute exists at the given index. More...
 
bool hasParamAttr (unsigned ArgNo, Attribute::AttrKind Kind) const
 Return true if the attribute exists for the given argument. More...
 
bool hasParamAttr (unsigned ArgNo, StringRef Kind) const
 Return true if the attribute exists for the given argument. More...
 
bool hasParamAttrs (unsigned ArgNo) const
 Return true if attributes exists for the given argument. More...
 
bool hasRetAttr (Attribute::AttrKind Kind) const
 Return true if the attribute exists for the return value. More...
 
bool hasRetAttr (StringRef Kind) const
 Return true if the attribute exists for the return value. More...
 
bool hasRetAttrs () const
 Return true if attributes exist for the return value. More...
 
bool hasFnAttr (Attribute::AttrKind Kind) const
 Return true if the attribute exists for the function. More...
 
bool hasFnAttr (StringRef Kind) const
 Return true if the attribute exists for the function. More...
 
bool hasFnAttrs () const
 Return true the attributes exist for the function. More...
 
bool hasAttrSomewhere (Attribute::AttrKind Kind, unsigned *Index=nullptr) const
 Return true if the specified attribute is set for at least one parameter or for the return value. More...
 
Attribute getAttributeAtIndex (unsigned Index, Attribute::AttrKind Kind) const
 Return the attribute object that exists at the given index. More...
 
Attribute getAttributeAtIndex (unsigned Index, StringRef Kind) const
 Return the attribute object that exists at the given index. More...
 
Attribute getParamAttr (unsigned ArgNo, Attribute::AttrKind Kind) const
 Return the attribute object that exists at the arg index. More...
 
Attribute getParamAttr (unsigned ArgNo, StringRef Kind) const
 Return the attribute object that exists at the given index. More...
 
Attribute getFnAttr (Attribute::AttrKind Kind) const
 Return the attribute object that exists for the function. More...
 
Attribute getFnAttr (StringRef Kind) const
 Return the attribute object that exists for the function. More...
 
MaybeAlign getRetAlignment () const
 Return the alignment of the return value. More...
 
MaybeAlign getParamAlignment (unsigned ArgNo) const
 Return the alignment for the specified function parameter. More...
 
MaybeAlign getParamStackAlignment (unsigned ArgNo) const
 Return the stack alignment for the specified function parameter. More...
 
TypegetParamByValType (unsigned ArgNo) const
 Return the byval type for the specified function parameter. More...
 
TypegetParamStructRetType (unsigned ArgNo) const
 Return the sret type for the specified function parameter. More...
 
TypegetParamByRefType (unsigned ArgNo) const
 Return the byref type for the specified function parameter. More...
 
TypegetParamPreallocatedType (unsigned ArgNo) const
 Return the preallocated type for the specified function parameter. More...
 
TypegetParamInAllocaType (unsigned ArgNo) const
 Return the inalloca type for the specified function parameter. More...
 
TypegetParamElementType (unsigned ArgNo) const
 Return the elementtype type for the specified function parameter. More...
 
MaybeAlign getFnStackAlignment () const
 Get the stack alignment of the function. More...
 
MaybeAlign getRetStackAlignment () const
 Get the stack alignment of the return value. More...
 
uint64_t getRetDereferenceableBytes () const
 Get the number of dereferenceable bytes (or zero if unknown) of the return value. More...
 
uint64_t getParamDereferenceableBytes (unsigned Index) const
 Get the number of dereferenceable bytes (or zero if unknown) of an arg. More...
 
uint64_t getRetDereferenceableOrNullBytes () const
 Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value. More...
 
uint64_t getParamDereferenceableOrNullBytes (unsigned ArgNo) const
 Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg. More...
 
std::string getAsString (unsigned Index, bool InAttrGrp=false) const
 Return the attributes at the index as a string. More...
 
bool hasParentContext (LLVMContext &C) const
 Return true if this attribute list belongs to the LLVMContext. More...
 
iterator begin () const
 
iterator end () const
 
unsigned getNumAttrSets () const
 
index_iterator indexes () const
 Use this to iterate over the valid attribute indexes. More...
 
bool operator== (const AttributeList &RHS) const
 operator==/!= - Provide equality predicates. More...
 
bool operator!= (const AttributeList &RHS) const
 
void * getRawPointer () const
 Return a raw pointer that uniquely identifies this attribute list. More...
 
bool isEmpty () const
 Return true if there are no attributes. More...
 
void print (raw_ostream &O) const
 
void dump () const
 

Static Public Member Functions

static AttributeList get (LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
 Create an AttributeList with the specified parameters in it. More...
 
static AttributeList get (LLVMContext &C, ArrayRef< std::pair< unsigned, AttributeSet >> Attrs)
 
static AttributeList get (LLVMContext &C, AttributeSet FnAttrs, AttributeSet RetAttrs, ArrayRef< AttributeSet > ArgAttrs)
 Create an AttributeList from attribute sets for a function, its return value, and all of its arguments. More...
 
static AttributeList get (LLVMContext &C, ArrayRef< AttributeList > Attrs)
 Return an AttributeList with the specified parameters in it. More...
 
static AttributeList get (LLVMContext &C, unsigned Index, ArrayRef< Attribute::AttrKind > Kinds)
 
static AttributeList get (LLVMContext &C, unsigned Index, ArrayRef< Attribute::AttrKind > Kinds, ArrayRef< uint64_t > Values)
 
static AttributeList get (LLVMContext &C, unsigned Index, ArrayRef< StringRef > Kind)
 
static AttributeList get (LLVMContext &C, unsigned Index, const AttrBuilder &B)
 

Friends

class AttrBuilder
 
class AttributeListImpl
 
class AttributeSet
 
class AttributeSetNode
 
template<typename Ty >
struct DenseMapInfo
 

Detailed Description

Definition at line 399 of file Attributes.h.

Member Typedef Documentation

◆ iterator

Definition at line 848 of file Attributes.h.

Member Enumeration Documentation

◆ AttrIndex

Enumerator
ReturnIndex 
FunctionIndex 
FirstArgIndex 

Definition at line 401 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttributeList()

llvm::AttributeList::AttributeList ( )
default

Member Function Documentation

◆ addAllocSizeParamAttr()

AttributeList AttributeList::addAllocSizeParamAttr ( LLVMContext C,
unsigned  ArgNo,
unsigned  ElemSizeArg,
const Optional< unsigned > &  NumElemsArg 
)

Add the allocsize attribute to the attribute set at the given arg index.

Returns a new list because attribute lists are immutable.

Definition at line 1342 of file Attributes.cpp.

References addParamAttributes(), B, and Index.

◆ addAttributeAtIndex() [1/3]

AttributeList AttributeList::addAttributeAtIndex ( LLVMContext C,
unsigned  Index,
Attribute  A 
) const

Add an attribute to the attribute set at the given index.

Returns a new list because attribute lists are immutable.

Definition at line 1203 of file Attributes.cpp.

References A, addAttributesAtIndex(), B, and Index.

◆ addAttributeAtIndex() [2/3]

AttributeList AttributeList::addAttributeAtIndex ( LLVMContext C,
unsigned  Index,
Attribute::AttrKind  Kind 
) const

Add an attribute to the attribute set at the given index.

Returns a new list because attribute lists are immutable.

Definition at line 1184 of file Attributes.cpp.

References Attrs, llvm::Function::begin(), llvm::Function::end(), llvm::Attribute::get(), llvm::AttributeSet::get(), getAttributes(), hasAttributeAtIndex(), and Index.

Referenced by llvm::Function::addAttributeAtIndex(), llvm::CallBase::addAttributeAtIndex(), addFnAttribute(), addParamAttribute(), and addRetAttribute().

◆ addAttributeAtIndex() [3/3]

AttributeList AttributeList::addAttributeAtIndex ( LLVMContext C,
unsigned  Index,
StringRef  Kind,
StringRef  Value = StringRef() 
) const

Add an attribute to the attribute set at the given index.

Returns a new list because attribute lists are immutable.

Definition at line 1195 of file Attributes.cpp.

References addAttributesAtIndex(), B, and Index.

◆ addAttributesAtIndex()

AttributeList AttributeList::addAttributesAtIndex ( LLVMContext C,
unsigned  Index,
const AttrBuilder B 
) const

Add attributes to the attribute set at the given index.

Returns a new list because attribute lists are immutable.

Definition at line 1221 of file Attributes.cpp.

References assert(), B, llvm::AttributeSet::get(), get(), llvm::AttributeSet::getAlignment(), getAttributes(), Index, and llvm::AttrBuilder::merge().

Referenced by addAttributeAtIndex(), addFnAttributes(), addParamAttributes(), and addRetAttributes().

◆ addDereferenceableOrNullParamAttr()

AttributeList AttributeList::addDereferenceableOrNullParamAttr ( LLVMContext C,
unsigned  ArgNo,
uint64_t  Bytes 
) const

Add the dereferenceable_or_null attribute to the attribute set at the given arg index.

Returns a new list because attribute lists are immutable.

Definition at line 1334 of file Attributes.cpp.

References addParamAttributes(), B, and Index.

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

◆ addDereferenceableParamAttr()

AttributeList AttributeList::addDereferenceableParamAttr ( LLVMContext C,
unsigned  ArgNo,
uint64_t  Bytes 
) const

Add the dereferenceable attribute to the attribute set at the given arg index.

Returns a new list because attribute lists are immutable.

Definition at line 1325 of file Attributes.cpp.

References addParamAttributes(), B, and Index.

Referenced by llvm::Function::addDereferenceableParamAttr(), and llvm::CallBase::addDereferenceableParamAttr().

◆ addDereferenceableRetAttr()

AttributeList AttributeList::addDereferenceableRetAttr ( LLVMContext C,
uint64_t  Bytes 
) const

Add the dereferenceable attribute to the attribute set at the given index.

Returns a new list because attribute lists are immutable.

Definition at line 1318 of file Attributes.cpp.

References addRetAttributes(), and B.

Referenced by llvm::CallBase::addDereferenceableRetAttr().

◆ addFnAttribute() [1/3]

LLVM_NODISCARD AttributeList llvm::AttributeList::addFnAttribute ( LLVMContext C,
Attribute  Attr 
) const
inline

Add a function attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 491 of file Attributes.h.

References addAttributeAtIndex(), and FunctionIndex.

◆ addFnAttribute() [2/3]

LLVM_NODISCARD AttributeList llvm::AttributeList::addFnAttribute ( LLVMContext C,
Attribute::AttrKind  Kind 
) const
inline

Add a function attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 484 of file Attributes.h.

References addAttributeAtIndex(), and FunctionIndex.

Referenced by llvm::Function::addFnAttr(), llvm::CallBase::addFnAttr(), and llvm::AMDGPULibFunc::getOrInsertFunction().

◆ addFnAttribute() [3/3]

LLVM_NODISCARD AttributeList llvm::AttributeList::addFnAttribute ( LLVMContext C,
StringRef  Kind,
StringRef  Value = StringRef() 
) const
inline

Add a function attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 498 of file Attributes.h.

References addAttributeAtIndex(), and FunctionIndex.

◆ addFnAttributes()

LLVM_NODISCARD AttributeList llvm::AttributeList::addFnAttributes ( LLVMContext C,
const AttrBuilder B 
) const
inline

Add function attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 505 of file Attributes.h.

References addAttributesAtIndex(), B, and FunctionIndex.

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

◆ addParamAttribute() [1/3]

AttributeList AttributeList::addParamAttribute ( LLVMContext C,
ArrayRef< unsigned >  ArgNos,
Attribute  A 
) const

Add an attribute to the attribute list at the given arg indices.

Returns a new list because attribute lists are immutable.

Definition at line 1244 of file Attributes.cpp.

References A, assert(), attrIdxToArrayIdx(), B, llvm::ArrayRef< T >::back(), begin(), end(), FirstArgIndex, llvm::AttributeSet::get(), getImpl(), Index, llvm::is_sorted(), and llvm::SmallVectorImpl< T >::resize().

◆ addParamAttribute() [2/3]

LLVM_NODISCARD AttributeList llvm::AttributeList::addParamAttribute ( LLVMContext C,
unsigned  ArgNo,
Attribute::AttrKind  Kind 
) const
inline

Add an argument attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 533 of file Attributes.h.

References addAttributeAtIndex(), and FirstArgIndex.

Referenced by llvm::Function::addParamAttr(), llvm::CallBase::addParamAttr(), and processCallSite().

◆ addParamAttribute() [3/3]

LLVM_NODISCARD AttributeList llvm::AttributeList::addParamAttribute ( LLVMContext C,
unsigned  ArgNo,
StringRef  Kind,
StringRef  Value = StringRef() 
) const
inline

Add an argument attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 541 of file Attributes.h.

References addAttributeAtIndex(), and FirstArgIndex.

◆ addParamAttributes()

LLVM_NODISCARD AttributeList llvm::AttributeList::addParamAttributes ( LLVMContext C,
unsigned  ArgNo,
const AttrBuilder B 
) const
inline

Add an argument attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 554 of file Attributes.h.

References addAttributesAtIndex(), B, and FirstArgIndex.

Referenced by addAllocSizeParamAttr(), addDereferenceableOrNullParamAttr(), addDereferenceableParamAttr(), and llvm::Function::addParamAttrs().

◆ addRetAttribute() [1/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::addRetAttribute ( LLVMContext C,
Attribute  Attr 
) const
inline

Add a return value attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 519 of file Attributes.h.

References addAttributeAtIndex(), and ReturnIndex.

◆ addRetAttribute() [2/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::addRetAttribute ( LLVMContext C,
Attribute::AttrKind  Kind 
) const
inline

Add a return value attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 512 of file Attributes.h.

References addAttributeAtIndex(), and ReturnIndex.

Referenced by llvm::Function::addRetAttr(), and llvm::CallBase::addRetAttr().

◆ addRetAttributes()

LLVM_NODISCARD AttributeList llvm::AttributeList::addRetAttributes ( LLVMContext C,
const AttrBuilder B 
) const
inline

Add a return value attribute to the list.

Returns a new list because attribute lists are immutable.

Definition at line 526 of file Attributes.h.

References addAttributesAtIndex(), B, and ReturnIndex.

Referenced by addDereferenceableRetAttr(), and llvm::Function::addRetAttrs().

◆ begin()

AttributeList::iterator AttributeList::begin ( ) const

◆ dump()

LLVM_DUMP_METHOD void AttributeList::dump ( ) const

Definition at line 1522 of file Attributes.cpp.

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

◆ end()

AttributeList::iterator AttributeList::end ( ) const

◆ get() [1/8]

AttributeList AttributeList::get ( LLVMContext C,
ArrayRef< AttributeList Attrs 
)
static

Return an AttributeList with the specified parameters in it.

Definition at line 1157 of file Attributes.cpp.

References Attrs, llvm::Function::empty(), llvm::AttributeSet::get(), getImpl(), I, List, llvm::max(), llvm::AttrBuilder::merge(), and llvm::Function::size().

◆ get() [2/8]

AttributeList AttributeList::get ( LLVMContext C,
ArrayRef< std::pair< unsigned, Attribute >>  Attrs 
)
static

◆ get() [3/8]

AttributeList AttributeList::get ( LLVMContext C,
ArrayRef< std::pair< unsigned, AttributeSet >>  Attrs 
)
static

◆ get() [4/8]

AttributeList AttributeList::get ( LLVMContext C,
AttributeSet  FnAttrs,
AttributeSet  RetAttrs,
ArrayRef< AttributeSet ArgAttrs 
)
static

Create an AttributeList from attribute sets for a function, its return value, and all of its arguments.

Definition at line 1079 of file Attributes.cpp.

References llvm::append_range(), getImpl(), llvm::AttributeSet::hasAttributes(), I, llvm::SmallVectorImpl< T >::reserve(), llvm::ArrayRef< T >::size(), and llvm::ArrayRef< T >::take_front().

◆ get() [5/8]

AttributeList AttributeList::get ( LLVMContext C,
unsigned  Index,
ArrayRef< Attribute::AttrKind Kinds 
)
static

Definition at line 1130 of file Attributes.cpp.

References Attrs, llvm::Attribute::get(), get(), and Index.

◆ get() [6/8]

AttributeList AttributeList::get ( LLVMContext C,
unsigned  Index,
ArrayRef< Attribute::AttrKind Kinds,
ArrayRef< uint64_t Values 
)
static

◆ get() [7/8]

AttributeList AttributeList::get ( LLVMContext C,
unsigned  Index,
ArrayRef< StringRef Kind 
)
static

Definition at line 1149 of file Attributes.cpp.

References Attrs, llvm::Attribute::get(), get(), and Index.

◆ get() [8/8]

AttributeList AttributeList::get ( LLVMContext C,
unsigned  Index,
const AttrBuilder B 
)
static

Definition at line 1120 of file Attributes.cpp.

References attrIdxToArrayIdx(), B, llvm::AttributeSet::get(), getImpl(), and Index.

◆ getAsString()

std::string AttributeList::getAsString ( unsigned  Index,
bool  InAttrGrp = false 
) const

Return the attributes at the index as a string.

Definition at line 1463 of file Attributes.cpp.

References llvm::AttributeSet::getAsString(), getAttributes(), and Index.

Referenced by print().

◆ getAttributeAtIndex() [1/2]

Attribute AttributeList::getAttributeAtIndex ( unsigned  Index,
Attribute::AttrKind  Kind 
) const

Return the attribute object that exists at the given index.

Definition at line 1392 of file Attributes.cpp.

References llvm::AttributeSet::getAttribute(), getAttributes(), and Index.

Referenced by llvm::Function::getAttributeAtIndex(), llvm::CallBase::getAttributeAtIndex(), getFnAttr(), getParamAttr(), and replaceAttributeTypeAtIndex().

◆ getAttributeAtIndex() [2/2]

Attribute AttributeList::getAttributeAtIndex ( unsigned  Index,
StringRef  Kind 
) const

Return the attribute object that exists at the given index.

Definition at line 1397 of file Attributes.cpp.

References llvm::AttributeSet::getAttribute(), getAttributes(), and Index.

◆ getAttributes()

AttributeSet AttributeList::getAttributes ( unsigned  Index) const

◆ getFnAttr() [1/2]

Attribute llvm::AttributeList::getFnAttr ( Attribute::AttrKind  Kind) const
inline

◆ getFnAttr() [2/2]

Attribute llvm::AttributeList::getFnAttr ( StringRef  Kind) const
inline

Return the attribute object that exists for the function.

Definition at line 786 of file Attributes.h.

References FunctionIndex, and getAttributeAtIndex().

◆ getFnAttrs()

AttributeSet AttributeList::getFnAttrs ( ) const

The function attributes are returned.

Definition at line 1362 of file Attributes.cpp.

References FunctionIndex, and getAttributes().

Referenced by llvm::CloneFunctionInto(), doPromotion(), fillOverallFunction(), getFnStackAlignment(), and llvm::promoteCall().

◆ getFnStackAlignment()

MaybeAlign AttributeList::getFnStackAlignment ( ) const

Get the stack alignment of the function.

Definition at line 1438 of file Attributes.cpp.

References getFnAttrs(), and llvm::AttributeSet::getStackAlignment().

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

◆ getNumAttrSets()

unsigned AttributeList::getNumAttrSets ( ) const

Definition at line 1494 of file Attributes.cpp.

Referenced by getAttributes(), indexes(), and removeAttributesAtIndex().

◆ getParamAlignment()

MaybeAlign AttributeList::getParamAlignment ( unsigned  ArgNo) const

Return the alignment for the specified function parameter.

Definition at line 1406 of file Attributes.cpp.

References FirstArgIndex, llvm::AttributeSet::getAlignment(), and getAttributes().

Referenced by llvm::Function::getParamAlign(), and llvm::CallBase::getParamAlign().

◆ getParamAttr() [1/2]

Attribute llvm::AttributeList::getParamAttr ( unsigned  ArgNo,
Attribute::AttrKind  Kind 
) const
inline

Return the attribute object that exists at the arg index.

Definition at line 771 of file Attributes.h.

References FirstArgIndex, and getAttributeAtIndex().

Referenced by llvm::CallBase::getParamAttr(), and llvm::Function::getParamAttribute().

◆ getParamAttr() [2/2]

Attribute llvm::AttributeList::getParamAttr ( unsigned  ArgNo,
StringRef  Kind 
) const
inline

Return the attribute object that exists at the given index.

Definition at line 776 of file Attributes.h.

References FirstArgIndex, and getAttributeAtIndex().

◆ getParamAttrs()

AttributeSet AttributeList::getParamAttrs ( unsigned  ArgNo) const

◆ getParamByRefType()

Type * AttributeList::getParamByRefType ( unsigned  ArgNo) const

Return the byref type for the specified function parameter.

Definition at line 1422 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), llvm::AttributeSet::getByRefType(), and Index.

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

◆ getParamByValType()

Type * AttributeList::getParamByValType ( unsigned  ArgNo) const

Return the byval type for the specified function parameter.

Definition at line 1414 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), llvm::AttributeSet::getByValType(), and Index.

Referenced by llvm::Function::getParamByValType(), and llvm::CallBase::getParamByValType().

◆ getParamDereferenceableBytes()

uint64_t AttributeList::getParamDereferenceableBytes ( unsigned  Index) const

Get the number of dereferenceable bytes (or zero if unknown) of an arg.

Definition at line 1450 of file Attributes.cpp.

References llvm::AttributeSet::getDereferenceableBytes(), getParamAttrs(), and Index.

Referenced by llvm::Function::getParamDereferenceableBytes(), and llvm::CallBase::getParamDereferenceableBytes().

◆ getParamDereferenceableOrNullBytes()

uint64_t AttributeList::getParamDereferenceableOrNullBytes ( unsigned  ArgNo) const

Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.

Definition at line 1459 of file Attributes.cpp.

References llvm::AttributeSet::getDereferenceableOrNullBytes(), getParamAttrs(), and Index.

Referenced by llvm::Function::getParamDereferenceableOrNullBytes(), and llvm::CallBase::getParamDereferenceableOrNullBytes().

◆ getParamElementType()

Type * AttributeList::getParamElementType ( unsigned  ArgNo) const

Return the elementtype type for the specified function parameter.

Definition at line 1434 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), llvm::AttributeSet::getElementType(), and Index.

◆ getParamInAllocaType()

Type * AttributeList::getParamInAllocaType ( unsigned  ArgNo) const

Return the inalloca type for the specified function parameter.

Definition at line 1430 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), llvm::AttributeSet::getInAllocaType(), and Index.

Referenced by llvm::Function::getParamInAllocaType(), and llvm::CallBase::getParamInAllocaType().

◆ getParamPreallocatedType()

Type * AttributeList::getParamPreallocatedType ( unsigned  ArgNo) const

Return the preallocated type for the specified function parameter.

Definition at line 1426 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), llvm::AttributeSet::getPreallocatedType(), and Index.

Referenced by llvm::Function::getParamPreallocatedType(), and llvm::CallBase::getParamPreallocatedType().

◆ getParamStackAlignment()

MaybeAlign AttributeList::getParamStackAlignment ( unsigned  ArgNo) const

Return the stack alignment for the specified function parameter.

Definition at line 1410 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), and llvm::AttributeSet::getStackAlignment().

Referenced by llvm::Function::getParamStackAlign(), and llvm::CallBase::getParamStackAlign().

◆ getParamStructRetType()

Type * AttributeList::getParamStructRetType ( unsigned  ArgNo) const

Return the sret type for the specified function parameter.

Definition at line 1418 of file Attributes.cpp.

References FirstArgIndex, getAttributes(), llvm::AttributeSet::getStructRetType(), and Index.

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

◆ getRawPointer()

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

Return a raw pointer that uniquely identifies this attribute list.

Definition at line 887 of file Attributes.h.

◆ getRetAlignment()

MaybeAlign AttributeList::getRetAlignment ( ) const

Return the alignment of the return value.

Definition at line 1402 of file Attributes.cpp.

References llvm::AttributeSet::getAlignment(), getAttributes(), and ReturnIndex.

Referenced by llvm::CallBase::getRetAlign().

◆ getRetAttrs()

AttributeSet AttributeList::getRetAttrs ( ) const

◆ getRetDereferenceableBytes()

uint64_t AttributeList::getRetDereferenceableBytes ( ) const

Get the number of dereferenceable bytes (or zero if unknown) of the return value.

Definition at line 1446 of file Attributes.cpp.

References llvm::AttributeSet::getDereferenceableBytes(), and getRetAttrs().

Referenced by llvm::CallBase::getRetDereferenceableBytes().

◆ getRetDereferenceableOrNullBytes()

uint64_t AttributeList::getRetDereferenceableOrNullBytes ( ) const

Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.

Definition at line 1454 of file Attributes.cpp.

References llvm::AttributeSet::getDereferenceableOrNullBytes(), and getRetAttrs().

Referenced by llvm::CallBase::getRetDereferenceableOrNullBytes().

◆ getRetStackAlignment()

MaybeAlign AttributeList::getRetStackAlignment ( ) const

Get the stack alignment of the return value.

Definition at line 1442 of file Attributes.cpp.

References getRetAttrs(), and llvm::AttributeSet::getStackAlignment().

◆ hasAttributeAtIndex() [1/2]

bool AttributeList::hasAttributeAtIndex ( unsigned  Index,
Attribute::AttrKind  Kind 
) const

Return true if the attribute exists at the given index.

Definition at line 1366 of file Attributes.cpp.

References getAttributes(), llvm::AttributeSet::hasAttribute(), and Index.

Referenced by addAttributeAtIndex(), hasFnAttr(), hasParamAttr(), hasRetAttr(), and removeAttributeAtIndex().

◆ hasAttributeAtIndex() [2/2]

bool AttributeList::hasAttributeAtIndex ( unsigned  Index,
StringRef  Kind 
) const

Return true if the attribute exists at the given index.

Definition at line 1371 of file Attributes.cpp.

References getAttributes(), llvm::AttributeSet::hasAttribute(), and Index.

◆ hasAttributesAtIndex()

bool AttributeList::hasAttributesAtIndex ( unsigned  Index) const

Return true if attribute exists at the given index.

Definition at line 1375 of file Attributes.cpp.

References getAttributes(), llvm::AttributeSet::hasAttributes(), and Index.

Referenced by hasFnAttrs(), hasParamAttrs(), and hasRetAttrs().

◆ hasAttrSomewhere()

bool AttributeList::hasAttrSomewhere ( Attribute::AttrKind  Kind,
unsigned *  Index = nullptr 
) const

◆ hasFnAttr() [1/2]

bool AttributeList::hasFnAttr ( Attribute::AttrKind  Kind) const

◆ hasFnAttr() [2/2]

bool AttributeList::hasFnAttr ( StringRef  Kind) const

Return true if the attribute exists for the function.

Definition at line 1383 of file Attributes.cpp.

References FunctionIndex, and hasAttributeAtIndex().

◆ hasFnAttrs()

bool llvm::AttributeList::hasFnAttrs ( ) const
inline

Return true the attributes exist for the function.

Definition at line 756 of file Attributes.h.

References FunctionIndex, and hasAttributesAtIndex().

◆ hasParamAttr() [1/2]

bool llvm::AttributeList::hasParamAttr ( unsigned  ArgNo,
Attribute::AttrKind  Kind 
) const
inline

◆ hasParamAttr() [2/2]

bool llvm::AttributeList::hasParamAttr ( unsigned  ArgNo,
StringRef  Kind 
) const
inline

Return true if the attribute exists for the given argument.

Definition at line 727 of file Attributes.h.

References FirstArgIndex, and hasAttributeAtIndex().

◆ hasParamAttrs()

bool llvm::AttributeList::hasParamAttrs ( unsigned  ArgNo) const
inline

Return true if attributes exists for the given argument.

Definition at line 732 of file Attributes.h.

References FirstArgIndex, and hasAttributesAtIndex().

◆ hasParentContext()

bool AttributeList::hasParentContext ( LLVMContext C) const

Return true if this attribute list belongs to the LLVMContext.

Definition at line 1474 of file Attributes.cpp.

References assert(), and isEmpty().

◆ hasRetAttr() [1/2]

bool llvm::AttributeList::hasRetAttr ( Attribute::AttrKind  Kind) const
inline

Return true if the attribute exists for the return value.

Definition at line 737 of file Attributes.h.

References hasAttributeAtIndex(), and ReturnIndex.

Referenced by llvm::GetReturnInfo(), llvm::Function::hasRetAttribute(), isLibCallInTailPosition(), llvm::Function::returnDoesNotAlias(), and llvm::CallBase::returnDoesNotAlias().

◆ hasRetAttr() [2/2]

bool llvm::AttributeList::hasRetAttr ( StringRef  Kind) const
inline

Return true if the attribute exists for the return value.

Definition at line 742 of file Attributes.h.

References hasAttributeAtIndex(), and ReturnIndex.

◆ hasRetAttrs()

bool llvm::AttributeList::hasRetAttrs ( ) const
inline

Return true if attributes exist for the return value.

Definition at line 747 of file Attributes.h.

References hasAttributesAtIndex(), and ReturnIndex.

◆ indexes()

index_iterator llvm::AttributeList::indexes ( ) const
inline

Use this to iterate over the valid attribute indexes.

Definition at line 880 of file Attributes.h.

References getNumAttrSets().

Referenced by print().

◆ isEmpty()

bool llvm::AttributeList::isEmpty ( ) const
inline

Return true if there are no attributes.

Definition at line 892 of file Attributes.h.

Referenced by llvm::ValueEnumerator::getAttributeListID(), and hasParentContext().

◆ operator!=()

bool llvm::AttributeList::operator!= ( const AttributeList RHS) const
inline

Definition at line 884 of file Attributes.h.

◆ operator==()

bool llvm::AttributeList::operator== ( const AttributeList RHS) const
inline

operator==/!= - Provide equality predicates.

Definition at line 883 of file Attributes.h.

◆ print()

void AttributeList::print ( raw_ostream O) const

Definition at line 1498 of file Attributes.cpp.

References getAsString(), getAttributes(), i, indexes(), and llvm::RISCVFenceField::O.

Referenced by dump().

◆ removeAttribute()

LLVM_NODISCARD AttributeList llvm::AttributeList::removeAttribute ( LLVMContext C,
unsigned  Index,
StringRef  Kind 
) const
inline

Definition at line 570 of file Attributes.h.

References Index, and removeAttributeAtIndex().

◆ removeAttributeAtIndex() [1/2]

AttributeList AttributeList::removeAttributeAtIndex ( LLVMContext C,
unsigned  Index,
Attribute::AttrKind  Kind 
) const

Remove the specified attribute at the specified index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 1265 of file Attributes.cpp.

References assert(), attrIdxToArrayIdx(), begin(), end(), getImpl(), hasAttributeAtIndex(), and Index.

Referenced by removeAttribute(), llvm::Function::removeAttributeAtIndex(), llvm::CallBase::removeAttributeAtIndex(), llvm::IRPosition::removeAttrs(), removeFnAttribute(), removeParamAttribute(), removeRetAttribute(), and replaceAttributeTypeAtIndex().

◆ removeAttributeAtIndex() [2/2]

AttributeList AttributeList::removeAttributeAtIndex ( LLVMContext C,
unsigned  Index,
StringRef  Kind 
) const

Remove the specified attribute at the specified index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 1279 of file Attributes.cpp.

References assert(), attrIdxToArrayIdx(), begin(), end(), getImpl(), hasAttributeAtIndex(), and Index.

◆ removeAttributesAtIndex() [1/2]

AttributeList AttributeList::removeAttributesAtIndex ( LLVMContext C,
unsigned  Index 
) const

Remove all attributes at the specified index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 1306 of file Attributes.cpp.

References AttributeSet, attrIdxToArrayIdx(), begin(), end(), getImpl(), and getNumAttrSets().

◆ removeAttributesAtIndex() [2/2]

AttributeList AttributeList::removeAttributesAtIndex ( LLVMContext C,
unsigned  Index,
const AttrBuilder AttrsToRemove 
) const

Remove the specified attributes at the specified index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 1295 of file Attributes.cpp.

References Attrs, getAttributes(), and Index.

Referenced by removeFnAttributes(), removeParamAttributes(), and removeRetAttributes().

◆ removeFnAttribute() [1/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeFnAttribute ( LLVMContext C,
Attribute::AttrKind  Kind 
) const
inline

Remove the specified attribute at the function index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 588 of file Attributes.h.

References FunctionIndex, and removeAttributeAtIndex().

Referenced by llvm::Function::removeFnAttr(), and llvm::CallBase::removeFnAttr().

◆ removeFnAttribute() [2/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeFnAttribute ( LLVMContext C,
StringRef  Kind 
) const
inline

Remove the specified attribute at the function index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 594 of file Attributes.h.

References FunctionIndex, and removeAttributeAtIndex().

◆ removeFnAttributes() [1/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeFnAttributes ( LLVMContext C) const
inline

Remove the attributes at the function index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 608 of file Attributes.h.

References FunctionIndex, and removeAttributesAtIndex().

◆ removeFnAttributes() [2/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeFnAttributes ( LLVMContext C,
const AttrBuilder AttrsToRemove 
) const
inline

Remove the specified attribute at the function index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 602 of file Attributes.h.

References FunctionIndex, and removeAttributesAtIndex().

Referenced by llvm::Function::removeFnAttrs(), and llvm::CallBase::removeFnAttrs().

◆ removeParamAttribute() [1/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeParamAttribute ( LLVMContext C,
unsigned  ArgNo,
Attribute::AttrKind  Kind 
) const
inline

Remove the specified attribute at the specified arg index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 635 of file Attributes.h.

References FirstArgIndex, and removeAttributeAtIndex().

Referenced by llvm::Function::removeParamAttr(), and llvm::CallBase::removeParamAttr().

◆ removeParamAttribute() [2/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeParamAttribute ( LLVMContext C,
unsigned  ArgNo,
StringRef  Kind 
) const
inline

Remove the specified attribute at the specified arg index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 642 of file Attributes.h.

References FirstArgIndex, and removeAttributeAtIndex().

◆ removeParamAttributes() [1/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeParamAttributes ( LLVMContext C,
unsigned  ArgNo 
) const
inline

Remove all attributes at the specified arg index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 657 of file Attributes.h.

References FirstArgIndex, and removeAttributesAtIndex().

◆ removeParamAttributes() [2/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeParamAttributes ( LLVMContext C,
unsigned  ArgNo,
const AttrBuilder AttrsToRemove 
) const
inline

Remove the specified attribute at the specified arg index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 650 of file Attributes.h.

References FirstArgIndex, and removeAttributesAtIndex().

Referenced by llvm::Function::removeParamAttrs(), and llvm::CallBase::removeParamAttrs().

◆ removeRetAttribute() [1/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeRetAttribute ( LLVMContext C,
Attribute::AttrKind  Kind 
) const
inline

Remove the specified attribute at the return value index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 615 of file Attributes.h.

References removeAttributeAtIndex(), and ReturnIndex.

Referenced by llvm::Function::removeRetAttr(), and llvm::CallBase::removeRetAttr().

◆ removeRetAttribute() [2/2]

LLVM_NODISCARD AttributeList llvm::AttributeList::removeRetAttribute ( LLVMContext C,
StringRef  Kind 
) const
inline

Remove the specified attribute at the return value index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 621 of file Attributes.h.

References removeAttributeAtIndex(), and ReturnIndex.

◆ removeRetAttributes()

LLVM_NODISCARD AttributeList llvm::AttributeList::removeRetAttributes ( LLVMContext C,
const AttrBuilder AttrsToRemove 
) const
inline

Remove the specified attribute at the return value index from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 629 of file Attributes.h.

References removeAttributesAtIndex(), and ReturnIndex.

Referenced by llvm::Function::removeRetAttrs(), and llvm::CallBase::removeRetAttrs().

◆ replaceAttributeTypeAtIndex()

LLVM_NODISCARD AttributeList llvm::AttributeList::replaceAttributeTypeAtIndex ( LLVMContext C,
unsigned  ArgNo,
Attribute::AttrKind  Kind,
Type ReplacementTy 
) const
inline

Replace the type contained by attribute AttrKind at index ArgNo wih ReplacementTy, preserving all other attributes.

Definition at line 664 of file Attributes.h.

References Attrs, getAttributeAtIndex(), llvm::Attribute::getWithNewType(), and removeAttributeAtIndex().

Friends And Related Function Documentation

◆ AttrBuilder

friend class AttrBuilder
friend

Definition at line 408 of file Attributes.h.

◆ AttributeListImpl

friend class AttributeListImpl
friend

Definition at line 409 of file Attributes.h.

◆ AttributeSet

friend class AttributeSet
friend

Definition at line 410 of file Attributes.h.

Referenced by removeAttributesAtIndex().

◆ AttributeSetNode

friend class AttributeSetNode
friend

Definition at line 411 of file Attributes.h.

◆ DenseMapInfo

template<typename Ty >
friend struct DenseMapInfo
friend

Definition at line 412 of file Attributes.h.


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