LLVM  10.0.0svn
Public Types | Public Member Functions | List of all members
llvm::AttrBuilder Class Reference

#include "llvm/IR/Attributes.h"

Public Types

using td_type = std::pair< std::string, std::string >
 
using td_iterator = std::map< std::string, std::string >::iterator
 
using td_const_iterator = std::map< std::string, std::string >::const_iterator
 
using td_range = iterator_range< td_iterator >
 
using td_const_range = iterator_range< td_const_iterator >
 

Public Member Functions

 AttrBuilder ()=default
 
 AttrBuilder (const Attribute &A)
 
 AttrBuilder (AttributeList AS, unsigned Idx)
 
 AttrBuilder (AttributeSet AS)
 
void clear ()
 
AttrBuilderaddAttribute (Attribute::AttrKind Val)
 Add an attribute to the builder. More...
 
AttrBuilderaddAttribute (Attribute A)
 Add the Attribute object to the builder. More...
 
AttrBuilderaddAttribute (StringRef A, StringRef V=StringRef())
 Add the target-dependent attribute to the builder. More...
 
AttrBuilderremoveAttribute (Attribute::AttrKind Val)
 Remove an attribute from the builder. More...
 
AttrBuilderremoveAttributes (AttributeList A, uint64_t WithoutIndex)
 Remove the attributes from the builder. More...
 
AttrBuilderremoveAttribute (StringRef A)
 Remove the target-dependent attribute to the builder. More...
 
AttrBuildermerge (const AttrBuilder &B)
 Add the attributes from the builder. More...
 
AttrBuilderremove (const AttrBuilder &B)
 Remove the attributes from the builder. More...
 
bool overlaps (const AttrBuilder &B) const
 Return true if the builder has any attribute that's in the specified builder. More...
 
bool contains (Attribute::AttrKind A) const
 Return true if the builder has the specified attribute. More...
 
bool contains (StringRef A) const
 Return true if the builder has the specified target-dependent attribute. More...
 
bool hasAttributes () const
 Return true if the builder has IR-level attributes. More...
 
bool hasAttributes (AttributeList A, uint64_t Index) const
 Return true if the builder has any attribute that's in the specified attribute. More...
 
bool hasAlignmentAttr () const
 Return true if the builder has an alignment attribute. More...
 
uint64_t getAlignment () const
 Retrieve the alignment attribute, if it exists. More...
 
uint64_t getStackAlignment () const
 Retrieve the stack alignment attribute, if it exists. More...
 
uint64_t getDereferenceableBytes () const
 Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is returned otherwise). More...
 
uint64_t getDereferenceableOrNullBytes () const
 Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists (zero is returned otherwise). More...
 
TypegetByValType () const
 Retrieve the byval type. More...
 
std::pair< unsigned, Optional< unsigned > > getAllocSizeArgs () const
 Retrieve the allocsize args, if the allocsize attribute exists. More...
 
AttrBuilderaddAlignmentAttr (unsigned Align)
 This turns an int alignment (which must be a power of 2) into the form used internally in Attribute. More...
 
AttrBuilderaddStackAlignmentAttr (unsigned Align)
 This turns an int stack alignment (which must be a power of 2) into the form used internally in Attribute. More...
 
AttrBuilderaddDereferenceableAttr (uint64_t Bytes)
 This turns the number of dereferenceable bytes into the form used internally in Attribute. More...
 
AttrBuilderaddDereferenceableOrNullAttr (uint64_t Bytes)
 This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute. More...
 
AttrBuilderaddAllocSizeAttr (unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg)
 This turns one (or two) ints into the form used internally in Attribute. More...
 
AttrBuilderaddByValAttr (Type *Ty)
 This turns a byval type into the form used internally in Attribute. More...
 
AttrBuilderaddAllocSizeAttrFromRawRepr (uint64_t RawAllocSizeRepr)
 Add an allocsize attribute, using the representation returned by Attribute.getIntValue(). More...
 
bool empty () const
 Return true if the builder contains no target-independent attributes. More...
 
td_iterator td_begin ()
 
td_iterator td_end ()
 
td_const_iterator td_begin () const
 
td_const_iterator td_end () const
 
td_range td_attrs ()
 
td_const_range td_attrs () const
 
bool td_empty () const
 
bool operator== (const AttrBuilder &B)
 
bool operator!= (const AttrBuilder &B)
 

Detailed Description

Definition at line 706 of file Attributes.h.

Member Typedef Documentation

◆ td_const_iterator

using llvm::AttrBuilder::td_const_iterator = std::map<std::string, std::string>::const_iterator

Definition at line 833 of file Attributes.h.

◆ td_const_range

Definition at line 835 of file Attributes.h.

◆ td_iterator

using llvm::AttrBuilder::td_iterator = std::map<std::string, std::string>::iterator

Definition at line 832 of file Attributes.h.

◆ td_range

Definition at line 834 of file Attributes.h.

◆ td_type

using llvm::AttrBuilder::td_type = std::pair<std::string, std::string>

Definition at line 831 of file Attributes.h.

Constructor & Destructor Documentation

◆ AttrBuilder() [1/4]

llvm::AttrBuilder::AttrBuilder ( )
default

◆ AttrBuilder() [2/4]

llvm::AttrBuilder::AttrBuilder ( const Attribute A)
inline

Definition at line 719 of file Attributes.h.

References B, and clear().

◆ AttrBuilder() [3/4]

AttrBuilder::AttrBuilder ( AttributeList  AS,
unsigned  Idx 
)

Definition at line 1424 of file Attributes.cpp.

References A, and llvm::AttributeList::getAttributes().

◆ AttrBuilder() [4/4]

AttrBuilder::AttrBuilder ( AttributeSet  AS)

Definition at line 1430 of file Attributes.cpp.

References A.

Member Function Documentation

◆ addAlignmentAttr()

AttrBuilder & AttrBuilder::addAlignmentAttr ( unsigned  Align)

This turns an int alignment (which must be a power of 2) into the form used internally in Attribute.

Definition at line 1519 of file Attributes.cpp.

References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, and assert().

Referenced by addRawAttributeValue(), decodeLLVMAttributesForBitcode(), getParameterABIAttributes(), and maybeSetDSOLocal().

◆ addAllocSizeAttr()

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

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

Definition at line 1561 of file Attributes.cpp.

References packAllocSizeArgs().

Referenced by llvm::AttributeList::addAllocSizeAttr(), and maybeSetDSOLocal().

◆ addAllocSizeAttrFromRawRepr()

AttrBuilder & AttrBuilder::addAllocSizeAttrFromRawRepr ( uint64_t  RawAllocSizeRepr)

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

Definition at line 1566 of file Attributes.cpp.

References assert().

◆ addAttribute() [1/3]

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

◆ addAttribute() [2/3]

AttrBuilder & AttrBuilder::addAttribute ( Attribute  A)

◆ addAttribute() [3/3]

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

Add the target-dependent attribute to the builder.

Definition at line 1478 of file Attributes.cpp.

References A.

◆ addByValAttr()

AttrBuilder & AttrBuilder::addByValAttr ( Type Ty)

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

Definition at line 1577 of file Attributes.cpp.

Referenced by annotateAnyAllocSite().

◆ addDereferenceableAttr()

AttrBuilder & AttrBuilder::addDereferenceableAttr ( uint64_t  Bytes)

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

Definition at line 1544 of file Attributes.cpp.

Referenced by llvm::AttributeList::addDereferenceableAttr(), and llvm::AttributeFuncs::typeIncompatible().

◆ addDereferenceableOrNullAttr()

AttrBuilder & AttrBuilder::addDereferenceableOrNullAttr ( uint64_t  Bytes)

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

Definition at line 1552 of file Attributes.cpp.

Referenced by llvm::AttributeList::addDereferenceableOrNullAttr(), and llvm::AttributeFuncs::typeIncompatible().

◆ addStackAlignmentAttr()

AttrBuilder & AttrBuilder::addStackAlignmentAttr ( unsigned  Align)

This turns an int stack alignment (which must be a power of 2) into the form used internally in Attribute.

Definition at line 1531 of file Attributes.cpp.

References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, and assert().

Referenced by addRawAttributeValue(), and maybeSetDSOLocal().

◆ clear()

void AttrBuilder::clear ( )

Definition at line 1435 of file Attributes.cpp.

Referenced by maybeSetDSOLocal().

◆ contains() [1/2]

bool llvm::AttrBuilder::contains ( Attribute::AttrKind  A) const
inline

Return true if the builder has the specified attribute.

Definition at line 757 of file Attributes.h.

References assert(), contains(), and llvm::Attribute::EndAttrKinds.

Referenced by FunctionNumber(), llvm::AttributeSetNode::get(), and overlaps().

◆ contains() [2/2]

bool AttrBuilder::contains ( StringRef  A) const

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

Definition at line 1652 of file Attributes.cpp.

◆ empty()

bool llvm::AttrBuilder::empty ( ) const
inline

Return true if the builder contains no target-independent attributes.

Definition at line 828 of file Attributes.h.

Referenced by RemoveNonValidAttrAtIndex().

◆ getAlignment()

uint64_t llvm::AttrBuilder::getAlignment ( ) const
inline

Retrieve the alignment attribute, if it exists.

Definition at line 777 of file Attributes.h.

Referenced by llvm::AttributeList::addAttributes(), FunctionNumber(), and llvm::AttributeSetNode::get().

◆ getAllocSizeArgs()

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

Retrieve the allocsize args, if the allocsize attribute exists.

If it doesn't exist, pair(0, 0) is returned.

Definition at line 1515 of file Attributes.cpp.

References unpackAllocSizeArgs().

Referenced by llvm::AttributeSetNode::get().

◆ getByValType()

Type* llvm::AttrBuilder::getByValType ( ) const
inline

Retrieve the byval type.

Definition at line 793 of file Attributes.h.

References llvm::Attribute::getAllocSizeArgs().

Referenced by llvm::AttributeSetNode::get().

◆ getDereferenceableBytes()

uint64_t llvm::AttrBuilder::getDereferenceableBytes ( ) const
inline

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

Definition at line 786 of file Attributes.h.

Referenced by llvm::AttributeSetNode::get().

◆ getDereferenceableOrNullBytes()

uint64_t llvm::AttrBuilder::getDereferenceableOrNullBytes ( ) const
inline

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

Definition at line 790 of file Attributes.h.

Referenced by llvm::AttributeSetNode::get().

◆ getStackAlignment()

uint64_t llvm::AttrBuilder::getStackAlignment ( ) const
inline

Retrieve the stack alignment attribute, if it exists.

Definition at line 780 of file Attributes.h.

Referenced by llvm::AttributeSetNode::get().

◆ hasAlignmentAttr()

bool AttrBuilder::hasAlignmentAttr ( ) const

Return true if the builder has an alignment attribute.

Definition at line 1676 of file Attributes.cpp.

Referenced by FunctionNumber().

◆ hasAttributes() [1/2]

bool AttrBuilder::hasAttributes ( ) const

Return true if the builder has IR-level attributes.

Definition at line 1656 of file Attributes.cpp.

References llvm::ArrayRef< T >::empty().

Referenced by llvm::AttributeList::addAttributes(), llvm::AttributeList::get(), maybeSetDSOLocal(), and setFastFlags().

◆ hasAttributes() [2/2]

bool AttrBuilder::hasAttributes ( AttributeList  A,
uint64_t  Index 
) const

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

Definition at line 1660 of file Attributes.cpp.

References assert(), contains(), and llvm::AttributeList::getAttributes().

◆ merge()

AttrBuilder & AttrBuilder::merge ( const AttrBuilder B)

Add the attributes from the builder.

Definition at line 1583 of file Attributes.cpp.

References I, and td_attrs().

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

◆ operator!=()

bool llvm::AttrBuilder::operator!= ( const AttrBuilder B)
inline

Definition at line 852 of file Attributes.h.

References B.

◆ operator==()

bool AttrBuilder::operator== ( const AttrBuilder B)

Definition at line 1680 of file Attributes.cpp.

References E, and I.

◆ overlaps()

bool AttrBuilder::overlaps ( const AttrBuilder B) const

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

Definition at line 1639 of file Attributes.cpp.

References contains(), and I.

Referenced by annotateAnyAllocSite().

◆ remove()

AttrBuilder & AttrBuilder::remove ( const AttrBuilder B)

Remove the attributes from the builder.

Definition at line 1611 of file Attributes.cpp.

References I, and td_attrs().

Referenced by annotateAnyAllocSite(), getRetComponentType(), legalizeCallAttributes(), llvm::promoteCall(), and llvm::AttributeSet::removeAttributes().

◆ removeAttribute() [1/2]

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

Remove an attribute from the builder.

Definition at line 1483 of file Attributes.cpp.

References assert(), and llvm::Attribute::EndAttrKinds.

Referenced by FunctionNumber(), getRetComponentType(), legalizeCallAttributes(), and llvm::AttributeSet::removeAttribute().

◆ removeAttribute() [2/2]

AttrBuilder & AttrBuilder::removeAttribute ( StringRef  A)

Remove the target-dependent attribute to the builder.

Definition at line 1508 of file Attributes.cpp.

References I.

◆ removeAttributes()

AttrBuilder & AttrBuilder::removeAttributes ( AttributeList  A,
uint64_t  WithoutIndex 
)

Remove the attributes from the builder.

Definition at line 1503 of file Attributes.cpp.

References llvm::AttributeList::getAttributes().

◆ td_attrs() [1/2]

td_range llvm::AttrBuilder::td_attrs ( )
inline

Definition at line 843 of file Attributes.h.

Referenced by llvm::AttributeSetNode::get(), merge(), and remove().

◆ td_attrs() [2/2]

td_const_range llvm::AttrBuilder::td_attrs ( ) const
inline

Definition at line 845 of file Attributes.h.

◆ td_begin() [1/2]

td_iterator llvm::AttrBuilder::td_begin ( )
inline

Definition at line 837 of file Attributes.h.

◆ td_begin() [2/2]

td_const_iterator llvm::AttrBuilder::td_begin ( ) const
inline

Definition at line 840 of file Attributes.h.

◆ td_empty()

bool llvm::AttrBuilder::td_empty ( ) const
inline

Definition at line 849 of file Attributes.h.

References llvm::Attribute::operator==().

◆ td_end() [1/2]

td_iterator llvm::AttrBuilder::td_end ( )
inline

Definition at line 838 of file Attributes.h.

◆ td_end() [2/2]

td_const_iterator llvm::AttrBuilder::td_end ( ) const
inline

Definition at line 841 of file Attributes.h.


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