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

#include "llvm/IR/Attributes.h"

Public Types

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

Public Member Functions

 AttributeList ()=default
 
LLVM_NODISCARD AttributeList addAttribute (LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
 Add an attribute to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addAttribute (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 addAttribute (LLVMContext &C, unsigned Index, Attribute A) const
 Add an attribute to the attribute set at the given index. More...
 
LLVM_NODISCARD AttributeList addAttributes (LLVMContext &C, unsigned Index, const AttrBuilder &B) const
 Add attributes to the attribute set at the given index. 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 removeAttribute (LLVMContext &C, unsigned Index, Attribute::AttrKind 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
 Remove the specified attribute at the specified index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeAttributes (LLVMContext &C, unsigned Index, const AttrBuilder &AttrsToRemove) const
 Remove the specified attributes at the specified index from this attribute list. More...
 
LLVM_NODISCARD AttributeList removeAttributes (LLVMContext &C, unsigned Index) const
 Remove all attributes at the specified 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 removeParamUndefImplyingAttributes (LLVMContext &C, unsigned ArgNo) const
 Remove noundef attribute and other attributes that imply undefined behavior if a undef or poison value is passed 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 replaceAttributeType (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 addDereferenceableAttr (LLVMContext &C, unsigned Index, 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 addDereferenceableOrNullAttr (LLVMContext &C, unsigned Index, uint64_t Bytes) const
 Add the dereferenceable_or_null attribute to the attribute set at the given 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 addAllocSizeAttr (LLVMContext &C, unsigned Index, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
 Add the allocsize attribute to the attribute set at the given 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...
 
LLVM_NODISCARD AttributeList addVScaleRangeAttr (LLVMContext &C, unsigned Index, unsigned MinValue, unsigned MaxValue)
 Add the vscale_range attribute to the attribute set at the given index. More...
 
AttributeSet getAttributes (unsigned Index) const
 The attributes for the specified index are returned. More...
 
AttributeSet getParamAttributes (unsigned ArgNo) const
 The attributes for the argument or parameter at the given index are returned. More...
 
AttributeSet getRetAttributes () const
 The attributes for the ret value are returned. More...
 
AttributeSet getFnAttributes () const
 The function attributes are returned. More...
 
bool hasAttribute (unsigned Index, Attribute::AttrKind Kind) const
 Return true if the attribute exists at the given index. More...
 
bool hasAttribute (unsigned Index, StringRef Kind) const
 Return true if the attribute exists at the given index. More...
 
bool hasAttributes (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 hasFnAttribute (Attribute::AttrKind Kind) const
 Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. More...
 
bool hasFnAttribute (StringRef Kind) const
 Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster. More...
 
bool hasParamAttribute (unsigned ArgNo, Attribute::AttrKind Kind) const
 Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind). 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 getAttribute (unsigned Index, Attribute::AttrKind Kind) const
 Return the attribute object that exists at the given index. More...
 
Attribute getAttribute (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...
 
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...
 
MaybeAlign getStackAlignment (unsigned Index) const
 Get the stack alignment. More...
 
uint64_t getDereferenceableBytes (unsigned Index) const
 Get the number of dereferenceable bytes (or zero if unknown). More...
 
uint64_t getParamDereferenceableBytes (unsigned ArgNo) const
 Get the number of dereferenceable bytes (or zero if unknown) of an arg. More...
 
uint64_t getDereferenceableOrNullBytes (unsigned Index) const
 Get the number of dereferenceable_or_null bytes (or zero if unknown). More...
 
uint64_t getParamDereferenceableOrNullBytes (unsigned ArgNo) const
 Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg. More...
 
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs (unsigned Index) const
 Get the allocsize argument numbers (or pair(0, 0) if unknown). More...
 
std::pair< unsigned, unsigned > getVScaleRangeArgs (unsigned Index) const
 Get the vscale_range argument numbers (or pair(0, 0) if unknown). 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
 
unsigned index_begin () const
 Use these to iterate over the valid attribute indices. More...
 
unsigned index_end () const
 
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 385 of file Attributes.h.

Member Typedef Documentation

◆ iterator

Definition at line 744 of file Attributes.h.

Member Enumeration Documentation

◆ AttrIndex

Enumerator
ReturnIndex 
FunctionIndex 
FirstArgIndex 

Definition at line 387 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttributeList()

llvm::AttributeList::AttributeList ( )
default

Member Function Documentation

◆ addAllocSizeAttr()

AttributeList AttributeList::addAllocSizeAttr ( LLVMContext C,
unsigned  Index,
unsigned  ElemSizeArg,
const Optional< unsigned > &  NumElemsArg 
)

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

Returns a new list because attribute lists are immutable.

Definition at line 1534 of file Attributes.cpp.

References addAttributes(), B, and Index.

Referenced by addAllocSizeParamAttr().

◆ addAllocSizeParamAttr()

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

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 595 of file Attributes.h.

References addAllocSizeAttr(), and FirstArgIndex.

◆ addAttribute() [1/3]

AttributeList AttributeList::addAttribute ( 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 1393 of file Attributes.cpp.

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

◆ addAttribute() [2/3]

AttributeList AttributeList::addAttribute ( 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 1375 of file Attributes.cpp.

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

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

◆ addAttribute() [3/3]

AttributeList AttributeList::addAttribute ( 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 1385 of file Attributes.cpp.

References addAttributes(), B, and Index.

◆ addAttributes()

AttributeList AttributeList::addAttributes ( 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 1410 of file Attributes.cpp.

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

Referenced by addAllocSizeAttr(), addAttribute(), llvm::Function::addAttributes(), addDereferenceableAttr(), addDereferenceableOrNullAttr(), addParamAttributes(), and addVScaleRangeAttr().

◆ addDereferenceableAttr()

AttributeList AttributeList::addDereferenceableAttr ( LLVMContext C,
unsigned  Index,
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 1517 of file Attributes.cpp.

References addAttributes(), B, and Index.

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

◆ addDereferenceableOrNullAttr()

AttributeList AttributeList::addDereferenceableOrNullAttr ( LLVMContext C,
unsigned  Index,
uint64_t  Bytes 
) const

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

Returns a new list because attribute lists are immutable.

Definition at line 1526 of file Attributes.cpp.

References addAttributes(), B, and Index.

Referenced by llvm::Function::addDereferenceableOrNullAttr(), llvm::CallBase::addDereferenceableOrNullAttr(), and addDereferenceableOrNullParamAttr().

◆ addDereferenceableOrNullParamAttr()

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

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 581 of file Attributes.h.

References addDereferenceableOrNullAttr(), and FirstArgIndex.

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

◆ addDereferenceableParamAttr()

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

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 568 of file Attributes.h.

References addDereferenceableAttr(), and FirstArgIndex.

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

◆ 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 1432 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 467 of file Attributes.h.

References addAttribute(), 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 475 of file Attributes.h.

References addAttribute(), 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 488 of file Attributes.h.

References addAttributes(), B, and FirstArgIndex.

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

◆ addVScaleRangeAttr()

AttributeList AttributeList::addVScaleRangeAttr ( LLVMContext C,
unsigned  Index,
unsigned  MinValue,
unsigned  MaxValue 
)

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

Returns a new list because attribute lists are immutable.

Definition at line 1542 of file Attributes.cpp.

References addAttributes(), B, and Index.

◆ begin()

AttributeList::iterator AttributeList::begin ( ) const

Definition at line 1679 of file Attributes.cpp.

Referenced by addParamAttribute(), removeAttribute(), and removeAttributes().

◆ dump()

LLVM_DUMP_METHOD void AttributeList::dump ( ) const

Definition at line 1719 of file Attributes.cpp.

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

◆ end()

AttributeList::iterator AttributeList::end ( ) const

Definition at line 1683 of file Attributes.cpp.

Referenced by addParamAttribute(), removeAttribute(), and removeAttributes().

◆ get() [1/8]

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

Return an AttributeList with the specified parameters in it.

Definition at line 1349 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 1271 of file Attributes.cpp.

References llvm::append_range(), getImpl(), llvm::AttributeSet::hasAttributes(), 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 1322 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 1341 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 1312 of file Attributes.cpp.

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

◆ getAllocSizeArgs()

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

Get the allocsize argument numbers (or pair(0, 0) if unknown).

Definition at line 1651 of file Attributes.cpp.

References llvm::AttributeSet::getAllocSizeArgs(), getAttributes(), 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 1660 of file Attributes.cpp.

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

Referenced by print().

◆ getAttribute() [1/2]

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

◆ getAttribute() [2/2]

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

Return the attribute object that exists at the given index.

Definition at line 1602 of file Attributes.cpp.

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

◆ getAttributes()

AttributeSet AttributeList::getAttributes ( unsigned  Index) const

◆ getDereferenceableBytes()

uint64_t AttributeList::getDereferenceableBytes ( unsigned  Index) const

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

Definition at line 1642 of file Attributes.cpp.

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

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

◆ getDereferenceableOrNullBytes()

uint64_t AttributeList::getDereferenceableOrNullBytes ( unsigned  Index) const

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

Definition at line 1646 of file Attributes.cpp.

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

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

◆ getFnAttributes()

AttributeSet AttributeList::getFnAttributes ( ) const

The function attributes are returned.

Definition at line 1562 of file Attributes.cpp.

References FunctionIndex, and getAttributes().

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

◆ getNumAttrSets()

unsigned AttributeList::getNumAttrSets ( ) const

Definition at line 1691 of file Attributes.cpp.

Referenced by getAttributes(), index_end(), and removeAttributes().

◆ getParamAlignment()

MaybeAlign AttributeList::getParamAlignment ( unsigned  ArgNo) const

Return the alignment for the specified function parameter.

Definition at line 1610 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 672 of file Attributes.h.

References FirstArgIndex, and getAttribute().

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 677 of file Attributes.h.

References FirstArgIndex, and getAttribute().

◆ getParamAttributes()

AttributeSet AttributeList::getParamAttributes ( unsigned  ArgNo) const

The attributes for the argument or parameter at the given index are returned.

Definition at line 1554 of file Attributes.cpp.

References FirstArgIndex, and getAttributes().

Referenced by llvm::CloneFunctionInto(), doPromotion(), llvm::Argument::getPassPointeeByValueCopySize(), llvm::Argument::getPointeeInMemoryValueType(), llvm::InlineFunction(), and llvm::promoteCall().

◆ getParamByRefType()

Type * AttributeList::getParamByRefType ( unsigned  ArgNo) const

Return the byref type for the specified function parameter.

Definition at line 1626 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 1618 of file Attributes.cpp.

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

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

◆ getParamDereferenceableBytes()

uint64_t llvm::AttributeList::getParamDereferenceableBytes ( unsigned  ArgNo) const
inline

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

Definition at line 713 of file Attributes.h.

References FirstArgIndex, and getDereferenceableBytes().

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

◆ getParamDereferenceableOrNullBytes()

uint64_t llvm::AttributeList::getParamDereferenceableOrNullBytes ( unsigned  ArgNo) const
inline

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

Definition at line 723 of file Attributes.h.

References FirstArgIndex, and getDereferenceableOrNullBytes().

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

◆ getParamInAllocaType()

Type * AttributeList::getParamInAllocaType ( unsigned  ArgNo) const

Return the inalloca type for the specified function parameter.

Definition at line 1634 of file Attributes.cpp.

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

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

◆ getParamPreallocatedType()

Type * AttributeList::getParamPreallocatedType ( unsigned  ArgNo) const

Return the preallocated type for the specified function parameter.

Definition at line 1630 of file Attributes.cpp.

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

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

◆ getParamStackAlignment()

MaybeAlign AttributeList::getParamStackAlignment ( unsigned  ArgNo) const

Return the stack alignment for the specified function parameter.

Definition at line 1614 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 1622 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 760 of file Attributes.h.

◆ getRetAlignment()

MaybeAlign AttributeList::getRetAlignment ( ) const

Return the alignment of the return value.

Definition at line 1606 of file Attributes.cpp.

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

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

◆ getRetAttributes()

AttributeSet AttributeList::getRetAttributes ( ) const

The attributes for the ret value are returned.

Definition at line 1558 of file Attributes.cpp.

References getAttributes(), and ReturnIndex.

Referenced by llvm::CloneFunctionInto(), doPromotion(), and llvm::PPCInstrInfo::isSignOrZeroExtended().

◆ getStackAlignment()

MaybeAlign AttributeList::getStackAlignment ( unsigned  Index) const

Get the stack alignment.

Definition at line 1638 of file Attributes.cpp.

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

Referenced by llvm::Function::getFnStackAlign(), and llvm::Function::getFnStackAlignment().

◆ getVScaleRangeArgs()

std::pair< unsigned, unsigned > AttributeList::getVScaleRangeArgs ( unsigned  Index) const

Get the vscale_range argument numbers (or pair(0, 0) if unknown).

Definition at line 1656 of file Attributes.cpp.

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

◆ hasAttribute() [1/2]

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

◆ hasAttribute() [2/2]

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

Return true if the attribute exists at the given index.

Definition at line 1571 of file Attributes.cpp.

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

◆ hasAttributes()

bool AttributeList::hasAttributes ( unsigned  Index) const

Return true if attribute exists at the given index.

Definition at line 1575 of file Attributes.cpp.

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

Referenced by get(), hasParamAttrs(), and print().

◆ hasAttrSomewhere()

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

◆ hasFnAttribute() [1/2]

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

◆ hasFnAttribute() [2/2]

bool AttributeList::hasFnAttribute ( StringRef  Kind) const

Equivalent to hasAttribute(AttributeList::FunctionIndex, Kind) but may be faster.

Definition at line 1583 of file Attributes.cpp.

References FunctionIndex, and hasAttribute().

◆ hasParamAttr() [1/2]

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

Return true if the attribute exists for the given argument.

Definition at line 634 of file Attributes.h.

References FirstArgIndex, and hasAttribute().

◆ 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 639 of file Attributes.h.

References FirstArgIndex, and hasAttribute().

◆ hasParamAttribute()

bool AttributeList::hasParamAttribute ( unsigned  ArgNo,
Attribute::AttrKind  Kind 
) const

Equivalent to hasAttribute(ArgNo + FirstArgIndex, Kind).

Definition at line 1587 of file Attributes.cpp.

References FirstArgIndex, and hasAttribute().

Referenced by llvm::Function::hasParamAttribute(), llvm::Function::hasStructRetAttr(), llvm::NVPTXTargetLowering::LowerFormalArguments(), and llvm::CallBase::paramHasAttr().

◆ hasParamAttrs()

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

Return true if attributes exists for the given argument.

Definition at line 644 of file Attributes.h.

References FirstArgIndex, and hasAttributes().

◆ hasParentContext()

bool AttributeList::hasParentContext ( LLVMContext C) const

Return true if this attribute list belongs to the LLVMContext.

Definition at line 1671 of file Attributes.cpp.

References assert(), and isEmpty().

◆ index_begin()

unsigned llvm::AttributeList::index_begin ( ) const
inline

Use these to iterate over the valid attribute indices.

Definition at line 752 of file Attributes.h.

References FunctionIndex.

Referenced by print().

◆ index_end()

unsigned llvm::AttributeList::index_end ( ) const
inline

Definition at line 753 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 765 of file Attributes.h.

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

◆ operator!=()

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

Definition at line 757 of file Attributes.h.

◆ operator==()

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

operator==/!= - Provide equality predicates.

Definition at line 756 of file Attributes.h.

◆ print()

void AttributeList::print ( raw_ostream O) const

◆ removeAttribute() [1/2]

AttributeList AttributeList::removeAttribute ( 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 1452 of file Attributes.cpp.

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

Referenced by llvm::Function::removeAttribute(), llvm::CallBase::removeAttribute(), llvm::IRPosition::removeAttrs(), removeParamAttribute(), and replaceAttributeType().

◆ removeAttribute() [2/2]

AttributeList AttributeList::removeAttribute ( 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 1465 of file Attributes.cpp.

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

◆ removeAttributes() [1/2]

AttributeList AttributeList::removeAttributes ( 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 1494 of file Attributes.cpp.

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

◆ removeAttributes() [2/2]

AttributeList AttributeList::removeAttributes ( 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 1479 of file Attributes.cpp.

References attrIdxToArrayIdx(), begin(), end(), getImpl(), Index, and llvm::SmallVectorImpl< T >::resize().

Referenced by llvm::Function::removeAttributes(), llvm::CallBase::removeAttributes(), and removeParamAttributes().

◆ 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 516 of file Attributes.h.

References FirstArgIndex, and removeAttribute().

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 523 of file Attributes.h.

References FirstArgIndex, and removeAttribute().

◆ 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 544 of file Attributes.h.

References FirstArgIndex, and removeAttributes().

◆ 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 531 of file Attributes.h.

References FirstArgIndex, and removeAttributes().

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

◆ removeParamUndefImplyingAttributes()

AttributeList AttributeList::removeParamUndefImplyingAttributes ( LLVMContext C,
unsigned  ArgNo 
) const

Remove noundef attribute and other attributes that imply undefined behavior if a undef or poison value is passed from this attribute list.

Returns a new list because attribute lists are immutable.

Definition at line 1507 of file Attributes.cpp.

References B, and removeParamAttributes().

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

◆ replaceAttributeType()

LLVM_NODISCARD AttributeList llvm::AttributeList::replaceAttributeType ( 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 551 of file Attributes.h.

References Attrs, getAttribute(), llvm::Attribute::getWithNewType(), and removeAttribute().

Friends And Related Function Documentation

◆ AttrBuilder

friend class AttrBuilder
friend

Definition at line 394 of file Attributes.h.

◆ AttributeListImpl

friend class AttributeListImpl
friend

Definition at line 395 of file Attributes.h.

◆ AttributeSet

friend class AttributeSet
friend

Definition at line 396 of file Attributes.h.

Referenced by removeAttributes().

◆ AttributeSetNode

friend class AttributeSetNode
friend

Definition at line 397 of file Attributes.h.

◆ DenseMapInfo

template<typename Ty >
friend struct DenseMapInfo
friend

Definition at line 398 of file Attributes.h.


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