LLVM
13.0.0git
|
#include "llvm/IR/Attributes.h"
Public Types | |
using | td_type = std::pair< std::string, std::string > |
using | td_iterator = decltype(TargetDepAttrs)::iterator |
using | td_const_iterator = decltype(TargetDepAttrs)::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 () |
AttrBuilder & | addAttribute (Attribute::AttrKind Val) |
Add an attribute to the builder. More... | |
AttrBuilder & | addAttribute (Attribute A) |
Add the Attribute object to the builder. More... | |
AttrBuilder & | addAttribute (StringRef A, StringRef V=StringRef()) |
Add the target-dependent attribute to the builder. More... | |
AttrBuilder & | removeAttribute (Attribute::AttrKind Val) |
Remove an attribute from the builder. More... | |
AttrBuilder & | removeAttributes (AttributeList A, uint64_t WithoutIndex) |
Remove the attributes from the builder. More... | |
AttrBuilder & | removeAttribute (StringRef A) |
Remove the target-dependent attribute to the builder. More... | |
AttrBuilder & | merge (const AttrBuilder &B) |
Add the attributes from the builder. More... | |
AttrBuilder & | remove (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... | |
MaybeAlign | getAlignment () const |
Retrieve the alignment attribute, if it exists. More... | |
MaybeAlign | 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... | |
Type * | getByValType () const |
Retrieve the byval type. More... | |
Type * | getStructRetType () const |
Retrieve the sret type. More... | |
Type * | getByRefType () const |
Retrieve the byref type. More... | |
Type * | getPreallocatedType () const |
Retrieve the preallocated type. More... | |
std::pair< unsigned, Optional< unsigned > > | getAllocSizeArgs () const |
Retrieve the allocsize args, if the allocsize attribute exists. More... | |
AttrBuilder & | addAlignmentAttr (MaybeAlign Align) |
This turns an alignment into the form used internally in Attribute. More... | |
AttrBuilder & | addAlignmentAttr (unsigned Align) |
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute. More... | |
AttrBuilder & | addStackAlignmentAttr (MaybeAlign Align) |
This turns a stack alignment into the form used internally in Attribute. More... | |
AttrBuilder & | addStackAlignmentAttr (unsigned Align) |
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attribute. More... | |
AttrBuilder & | addDereferenceableAttr (uint64_t Bytes) |
This turns the number of dereferenceable bytes into the form used internally in Attribute. More... | |
AttrBuilder & | addDereferenceableOrNullAttr (uint64_t Bytes) |
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute. More... | |
AttrBuilder & | addAllocSizeAttr (unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg) |
This turns one (or two) ints into the form used internally in Attribute. More... | |
AttrBuilder & | addByValAttr (Type *Ty) |
This turns a byval type into the form used internally in Attribute. More... | |
AttrBuilder & | addStructRetAttr (Type *Ty) |
This turns a sret type into the form used internally in Attribute. More... | |
AttrBuilder & | addByRefAttr (Type *Ty) |
This turns a byref type into the form used internally in Attribute. More... | |
AttrBuilder & | addPreallocatedAttr (Type *Ty) |
This turns a preallocated type into the form used internally in Attribute. More... | |
AttrBuilder & | addAllocSizeAttrFromRawRepr (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) const |
bool | operator!= (const AttrBuilder &B) const |
Definition at line 757 of file Attributes.h.
using llvm::AttrBuilder::td_const_iterator = decltype(TargetDepAttrs)::const_iterator |
Definition at line 926 of file Attributes.h.
Definition at line 928 of file Attributes.h.
using llvm::AttrBuilder::td_iterator = decltype(TargetDepAttrs)::iterator |
Definition at line 925 of file Attributes.h.
Definition at line 927 of file Attributes.h.
using llvm::AttrBuilder::td_type = std::pair<std::string, std::string> |
Definition at line 924 of file Attributes.h.
|
default |
Definition at line 773 of file Attributes.h.
References addAttribute().
AttrBuilder::AttrBuilder | ( | AttributeList | AS, |
unsigned | Idx | ||
) |
Definition at line 1572 of file Attributes.cpp.
References A, addAttribute(), llvm::AArch64CC::AL, and Index.
AttrBuilder::AttrBuilder | ( | AttributeSet | AS | ) |
Definition at line 1578 of file Attributes.cpp.
References A, and addAttribute().
AttrBuilder & AttrBuilder::addAlignmentAttr | ( | MaybeAlign | Align | ) |
This turns an alignment into the form used internally in Attribute.
This call has no effect if Align is not set.
Definition at line 1673 of file Attributes.cpp.
References Align, assert(), Attrs, and llvm::Value::MaximumAlignment.
Referenced by addAlignmentAttr(), addFramePointerAttrs(), and llvm::AttributeFuncs::typeIncompatible().
|
inline |
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute.
This call has no effect if Align is 0. Deprecated, use the version using a MaybeAlign.
Definition at line 875 of file Attributes.h.
References addAlignmentAttr().
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 1713 of file Attributes.cpp.
References addAllocSizeAttrFromRawRepr(), and packAllocSizeArgs().
AttrBuilder & AttrBuilder::addAllocSizeAttrFromRawRepr | ( | uint64_t | RawAllocSizeRepr | ) |
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
Definition at line 1718 of file Attributes.cpp.
References assert(), and Attrs.
Referenced by addAllocSizeAttr().
AttrBuilder & AttrBuilder::addAttribute | ( | Attribute | A | ) |
Add the Attribute object to the builder.
Definition at line 1596 of file Attributes.cpp.
References addAttribute(), Attrs, llvm::Attribute::getAlignment(), llvm::Attribute::getDereferenceableBytes(), llvm::Attribute::getDereferenceableOrNullBytes(), llvm::Attribute::getKindAsEnum(), llvm::Attribute::getKindAsString(), llvm::Attribute::getStackAlignment(), llvm::Attribute::getValueAsInt(), llvm::Attribute::getValueAsString(), llvm::Attribute::getValueAsType(), and llvm::Attribute::isStringAttribute().
|
inline |
Add an attribute to the builder.
Definition at line 783 of file Attributes.h.
References assert(), llvm::Attribute::doesAttrKindHaveArgument(), and llvm::Attribute::EndAttrKinds.
Referenced by addAttribute(), addFramePointerAttrs(), addReadAttrs(), adjustCallerSSPLevel(), AttrBuilder(), IdentifyValidAttributes(), llvm::runIPSCCP(), llvm::codegen::setFunctionAttributes(), and llvm::AttributeFuncs::typeIncompatible().
AttrBuilder & AttrBuilder::addAttribute | ( | StringRef | A, |
StringRef | V = StringRef() |
||
) |
Add the target-dependent attribute to the builder.
Definition at line 1626 of file Attributes.cpp.
References A.
AttrBuilder & AttrBuilder::addByRefAttr | ( | Type * | Ty | ) |
This turns a byref type into the form used internally in Attribute.
Definition at line 1741 of file Attributes.cpp.
References Attrs.
Referenced by llvm::AttributeFuncs::typeIncompatible().
AttrBuilder & AttrBuilder::addByValAttr | ( | Type * | Ty | ) |
This turns a byval type into the form used internally in Attribute.
Definition at line 1729 of file Attributes.cpp.
References Attrs.
Referenced by llvm::promoteCall(), and llvm::AttributeFuncs::typeIncompatible().
AttrBuilder & AttrBuilder::addDereferenceableAttr | ( | uint64_t | Bytes | ) |
This turns the number of dereferenceable bytes into the form used internally in Attribute.
Definition at line 1696 of file Attributes.cpp.
References Attrs.
Referenced by addFramePointerAttrs(), IdentifyValidAttributes(), and llvm::AttributeFuncs::typeIncompatible().
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 1704 of file Attributes.cpp.
References Attrs.
Referenced by IdentifyValidAttributes(), and llvm::AttributeFuncs::typeIncompatible().
AttrBuilder & AttrBuilder::addPreallocatedAttr | ( | Type * | Ty | ) |
This turns a preallocated type into the form used internally in Attribute.
Definition at line 1747 of file Attributes.cpp.
References Attrs.
Referenced by llvm::AttributeFuncs::typeIncompatible().
AttrBuilder & AttrBuilder::addStackAlignmentAttr | ( | MaybeAlign | Align | ) |
This turns a stack alignment into the form used internally in Attribute.
This call has no effect if Align is not set.
Definition at line 1684 of file Attributes.cpp.
References Align, assert(), and Attrs.
Referenced by addStackAlignmentAttr().
|
inline |
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attribute.
This call has no effect if Align is 0. Deprecated, use the version using a MaybeAlign.
Definition at line 887 of file Attributes.h.
References addStackAlignmentAttr().
AttrBuilder & AttrBuilder::addStructRetAttr | ( | Type * | Ty | ) |
This turns a sret type into the form used internally in Attribute.
Definition at line 1735 of file Attributes.cpp.
References Attrs.
Referenced by llvm::AttributeFuncs::typeIncompatible().
void AttrBuilder::clear | ( | ) |
Definition at line 1583 of file Attributes.cpp.
References Attrs, and llvm::Optional< T >::reset().
|
inline |
Return true if the builder has the specified attribute.
Definition at line 818 of file Attributes.h.
References assert(), and llvm::Attribute::EndAttrKinds.
Referenced by llvm::attributesPermitTailCall(), and hasAttributes().
bool AttrBuilder::contains | ( | StringRef | A | ) | const |
Return true if the builder has the specified target-dependent attribute.
Definition at line 1840 of file Attributes.cpp.
References A.
|
inline |
Return true if the builder contains no target-independent attributes.
Definition at line 921 of file Attributes.h.
Referenced by AddReturnAttributes().
|
inline |
Retrieve the alignment attribute, if it exists.
Definition at line 838 of file Attributes.h.
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 1669 of file Attributes.cpp.
References unpackAllocSizeArgs().
|
inline |
Retrieve the byref type.
Definition at line 858 of file Attributes.h.
|
inline |
Retrieve the byval type.
Definition at line 852 of file Attributes.h.
Referenced by llvm::promoteCall().
|
inline |
Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is returned otherwise).
Definition at line 845 of file Attributes.h.
|
inline |
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists (zero is returned otherwise).
Definition at line 849 of file Attributes.h.
|
inline |
Retrieve the preallocated type.
Definition at line 861 of file Attributes.h.
|
inline |
Retrieve the stack alignment attribute, if it exists.
Definition at line 841 of file Attributes.h.
|
inline |
Retrieve the sret type.
Definition at line 855 of file Attributes.h.
bool AttrBuilder::hasAlignmentAttr | ( | ) | const |
Return true if the builder has an alignment attribute.
Definition at line 1864 of file Attributes.cpp.
bool AttrBuilder::hasAttributes | ( | ) | const |
Return true if the builder has IR-level attributes.
Definition at line 1844 of file Attributes.cpp.
References Attrs.
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 1848 of file Attributes.cpp.
References llvm::AArch64CC::AL, assert(), contains(), and Index.
AttrBuilder & AttrBuilder::merge | ( | const AttrBuilder & | B | ) |
Add the attributes from the builder.
Definition at line 1753 of file Attributes.cpp.
Referenced by llvm::AttributeList::addAttributes(), and llvm::AttributeList::get().
|
inline |
Definition at line 945 of file Attributes.h.
References B.
bool AttrBuilder::operator== | ( | const AttrBuilder & | B | ) | const |
Definition at line 1868 of file Attributes.cpp.
bool AttrBuilder::overlaps | ( | const AttrBuilder & | B | ) | const |
Return true if the builder has any attribute that's in the specified builder.
Definition at line 1827 of file Attributes.cpp.
References Attrs, B, I, and td_attrs().
AttrBuilder & AttrBuilder::remove | ( | const AttrBuilder & | B | ) |
Remove the attributes from the builder.
Definition at line 1790 of file Attributes.cpp.
References Attrs, B, I, and llvm::Optional< T >::reset().
Referenced by legalizeCallAttributes(), llvm::promoteCall(), and removeAttributes().
AttrBuilder & AttrBuilder::removeAttribute | ( | Attribute::AttrKind | Val | ) |
Remove an attribute from the builder.
Definition at line 1631 of file Attributes.cpp.
References assert(), Attrs, llvm::Attribute::EndAttrKinds, and llvm::Optional< T >::reset().
Referenced by llvm::attributesPermitTailCall(), and legalizeCallAttributes().
AttrBuilder & AttrBuilder::removeAttribute | ( | StringRef | A | ) |
Remove the target-dependent attribute to the builder.
Definition at line 1662 of file Attributes.cpp.
AttrBuilder & AttrBuilder::removeAttributes | ( | AttributeList | A, |
uint64_t | WithoutIndex | ||
) |
Remove the attributes from the builder.
Definition at line 1657 of file Attributes.cpp.
|
inline |
Definition at line 936 of file Attributes.h.
References td_begin(), and td_end().
Referenced by overlaps().
|
inline |
Definition at line 938 of file Attributes.h.
References td_begin(), and td_end().
|
inline |
Definition at line 930 of file Attributes.h.
Referenced by td_attrs().
|
inline |
Definition at line 933 of file Attributes.h.
|
inline |
Definition at line 942 of file Attributes.h.
|
inline |
Definition at line 931 of file Attributes.h.
Referenced by td_attrs().
|
inline |
Definition at line 934 of file Attributes.h.