|
LLVM
4.0.0
|
#include <Attributes.h>
Public Types | |
| enum | AttrKind { None, EndAttrKinds } |
| This enumeration lists the attributes that can be associated with parameters, function results, or the function itself. More... | |
Public Member Functions | |
| Attribute () | |
| bool | isEnumAttribute () const |
| Return true if the attribute is an Attribute::AttrKind type. More... | |
| bool | isIntAttribute () const |
| Return true if the attribute is an integer attribute. More... | |
| bool | isStringAttribute () const |
| Return true if the attribute is a string (target-dependent) attribute. More... | |
| bool | hasAttribute (AttrKind Val) const |
| Return true if the attribute is present. More... | |
| bool | hasAttribute (StringRef Val) const |
| Return true if the target-dependent attribute is present. More... | |
| Attribute::AttrKind | getKindAsEnum () const |
| Return the attribute's kind as an enum (Attribute::AttrKind). More... | |
| uint64_t | getValueAsInt () const |
| Return the attribute's value as an integer. More... | |
| StringRef | getKindAsString () const |
| Return the attribute's kind as a string. More... | |
| StringRef | getValueAsString () const |
| Return the attribute's value as a string. More... | |
| unsigned | getAlignment () const |
| Returns the alignment field of an attribute as a byte alignment value. More... | |
| unsigned | getStackAlignment () const |
| Returns the stack alignment field of an attribute as a byte alignment value. More... | |
| uint64_t | getDereferenceableBytes () const |
| Returns the number of dereferenceable bytes from the dereferenceable attribute. More... | |
| uint64_t | getDereferenceableOrNullBytes () const |
| Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute. More... | |
| std::pair< unsigned, Optional < unsigned > > | getAllocSizeArgs () const |
| Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known). More... | |
| std::string | getAsString (bool InAttrGrp=false) const |
| The Attribute is converted to a string of equivalent mnemonic. More... | |
| bool | operator== (Attribute A) const |
| Equality and non-equality operators. More... | |
| bool | operator!= (Attribute A) const |
| bool | operator< (Attribute A) const |
| Less-than operator. Useful for sorting the attributes list. More... | |
| void | Profile (FoldingSetNodeID &ID) const |
| void * | getRawPointer () const |
| Return a raw pointer that uniquely identifies this attribute. More... | |
Static Public Member Functions | |
| static Attribute | get (LLVMContext &Context, AttrKind Kind, uint64_t Val=0) |
| Return a uniquified Attribute object. More... | |
| static Attribute | get (LLVMContext &Context, StringRef Kind, StringRef Val=StringRef()) |
| static Attribute | getWithAlignment (LLVMContext &Context, uint64_t Align) |
| Return a uniquified Attribute object that has the specific alignment set. More... | |
| static Attribute | getWithStackAlignment (LLVMContext &Context, uint64_t Align) |
| static Attribute | getWithDereferenceableBytes (LLVMContext &Context, uint64_t Bytes) |
| static Attribute | getWithDereferenceableOrNullBytes (LLVMContext &Context, uint64_t Bytes) |
| static Attribute | getWithAllocSizeArgs (LLVMContext &Context, unsigned ElemSizeArg, const Optional< unsigned > &NumElemsArg) |
| static Attribute | fromRawPointer (void *RawPtr) |
| Get an attribute from a raw pointer created by getRawPointer. More... | |
Definition at line 48 of file Attributes.h.
This enumeration lists the attributes that can be associated with parameters, function results, or the function itself.
Note: The `uwtable' attribute is about the ABI or the user mandating an entry in the unwind table. The `nounwind' attribute is about an exception passing by the function.
In a theoretical system that uses tables for profiling and SjLj for exceptions, they would be fully independent. In a normal system that uses tables for both, the semantics are:
nil = Needs an entry because an exception might pass by. nounwind = No need for an entry uwtable = Needs an entry because the ABI says so and because an exception might pass by. uwtable + nounwind = Needs an entry because the ABI says so.
| Enumerator | |
|---|---|
| None |
No attributes have been set. |
| EndAttrKinds |
Sentinal value useful for loops. |
Definition at line 67 of file Attributes.h.
|
inline |
Definition at line 80 of file Attributes.h.
Referenced by fromRawPointer(), and get().
|
inlinestatic |
Get an attribute from a raw pointer created by getRawPointer.
Definition at line 180 of file Attributes.h.
References Attribute().
Referenced by llvm::unwrap().
|
static |
Return a uniquified Attribute object.
Definition at line 64 of file Attributes.cpp.
References llvm::FoldingSetNodeID::AddInteger(), Attribute(), llvm::LLVMContextImpl::AttrsSet, and llvm::LLVMContext::pImpl.
Referenced by llvm::Function::addFnAttr(), llvm::AttributeSet::get(), LLVMCreateEnumAttribute(), LLVMCreateStringAttribute(), processCallSite(), RemoveNonValidAttrAtIndex(), and setFunctionAttributes().
|
static |
Definition at line 88 of file Attributes.cpp.
References llvm::FoldingSetNodeID::AddString(), Attribute(), llvm::LLVMContextImpl::AttrsSet, llvm::StringRef::empty(), and llvm::LLVMContext::pImpl.
| unsigned Attribute::getAlignment | ( | ) | const |
Returns the alignment field of an attribute as a byte alignment value.
Definition at line 194 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), llvm::FunctionComparator::cmpOperations(), and llvm::AttributeSetNode::getAlignment().
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
Definition at line 220 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), hasAttribute(), and unpackAllocSizeArgs().
Referenced by getAllocationSize(), llvm::AttributeSetNode::getAllocSizeArgs(), and getAsString().
The Attribute is converted to a string of equivalent mnemonic.
This is, presumably, for writing out the mnemonics for the assembly writer.
Definition at line 226 of file Attributes.cpp.
References llvm::CallingConv::Cold, llvm::MCID::Convergent, getAllocSizeArgs(), getKindAsString(), getValueAsInt(), llvm::AttributeImpl::getValueAsString(), hasAttribute(), llvm::Optional< T >::hasValue(), isStringAttribute(), llvm::ISD::JumpTable, llvm_unreachable, llvm::NoAlias, llvm::PrintEscapedString(), AMDGPU::RuntimeMD::KernelArg::ReadOnly, llvm::utostr(), and AMDGPU::RuntimeMD::KernelArg::WriteOnly.
| uint64_t Attribute::getDereferenceableBytes | ( | ) | const |
Returns the number of dereferenceable bytes from the dereferenceable attribute.
Definition at line 206 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), and llvm::AttributeSetNode::getDereferenceableBytes().
| uint64_t Attribute::getDereferenceableOrNullBytes | ( | ) | const |
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
Definition at line 213 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), and llvm::AttributeSetNode::getDereferenceableOrNullBytes().
| Attribute::AttrKind Attribute::getKindAsEnum | ( | ) | const |
Return the attribute's kind as an enum (Attribute::AttrKind).
This requires the attribute to be an enum or integer attribute.
Definition at line 157 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getKindAsEnum(), isEnumAttribute(), isIntAttribute(), and None.
Referenced by llvm::AttrBuilder::addAttribute(), LLVMGetEnumAttributeKind(), and llvm::AttrBuilder::removeAttributes().
| StringRef Attribute::getKindAsString | ( | ) | const |
Return the attribute's kind as a string.
This requires the attribute to be a string attribute.
Definition at line 171 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getKindAsString(), and isStringAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), getAsString(), llvm::AttrBuilder::hasAttributes(), LLVMGetStringAttributeKind(), and llvm::AttrBuilder::removeAttributes().
|
inline |
Return a raw pointer that uniquely identifies this attribute.
Definition at line 175 of file Attributes.h.
Referenced by llvm::wrap().
| unsigned Attribute::getStackAlignment | ( | ) | const |
Returns the stack alignment field of an attribute as a byte alignment value.
Definition at line 200 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), and llvm::AttributeSetNode::getStackAlignment().
| uint64_t Attribute::getValueAsInt | ( | ) | const |
Return the attribute's value as an integer.
This requires that the attribute be an integer attribute.
Definition at line 164 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), and isIntAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), and getAsString().
| StringRef Attribute::getValueAsString | ( | ) | const |
Return the attribute's value as a string.
This requires the attribute to be a string attribute.
Definition at line 178 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsString(), and isStringAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), llvm::NVPTXTargetLowering::allowFMA(), areJTsAllowed(), checkFunctionsAttributeConsistency(), eliminateTailRecursion(), llvm::X86FrameLowering::emitPrologue(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), getDeoptLowering(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::AMDGPUTargetMachine::getGPUName(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), getRecipEstimateForFunc(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), hasUnsafeFPMath(), llvm::RecurrenceDescriptor::isReductionPHI(), LLVMGetStringAttributeValue(), LowerInterruptReturn(), llvm::TargetFrameLowering::noFramePointerElim(), llvm::parseStatepointDirectivesFromAttrs(), llvm::TargetMachine::resetTargetOptions(), llvm::StackProtector::runOnFunction(), and WindowsRequiresStackProbe().
|
static |
Return a uniquified Attribute object that has the specific alignment set.
Definition at line 108 of file Attributes.cpp.
References assert(), Context, and llvm::isPowerOf2_32().
Referenced by llvm::AttributeSet::get().
|
static |
Definition at line 134 of file Attributes.cpp.
References assert(), Context, and packAllocSizeArgs().
Referenced by llvm::AttributeSet::get().
|
static |
Definition at line 121 of file Attributes.cpp.
References assert(), and Context.
Referenced by llvm::AttributeSet::get().
|
static |
Definition at line 127 of file Attributes.cpp.
References assert(), and Context.
Referenced by llvm::AttributeSet::get().
|
static |
Definition at line 114 of file Attributes.cpp.
References assert(), Context, and llvm::isPowerOf2_32().
Referenced by llvm::AttributeSet::get().
Return true if the attribute is present.
Definition at line 185 of file Attributes.cpp.
References llvm::AttributeImpl::hasAttribute(), and None.
Referenced by llvm::AttributeSetNode::getAlignment(), getAlignment(), llvm::AttributeSetNode::getAllocSizeArgs(), getAllocSizeArgs(), getAsString(), llvm::AttributeSetNode::getAttribute(), llvm::AttributeSetNode::getDereferenceableBytes(), getDereferenceableBytes(), llvm::AttributeSetNode::getDereferenceableOrNullBytes(), getDereferenceableOrNullBytes(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::AMDGPUTargetMachine::getGPUName(), llvm::AttributeSetNode::getStackAlignment(), getStackAlignment(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::AttributeSetNode::hasAttribute(), and llvm::isStatepointDirectiveAttr().
Return true if the target-dependent attribute is present.
Definition at line 189 of file Attributes.cpp.
References llvm::AttributeImpl::hasAttribute(), and isStringAttribute().
| bool Attribute::isEnumAttribute | ( | ) | const |
Return true if the attribute is an Attribute::AttrKind type.
Definition at line 145 of file Attributes.cpp.
References llvm::AttributeImpl::isEnumAttribute().
Referenced by getKindAsEnum(), llvm::AttrBuilder::hasAttributes(), and llvm::AttrBuilder::removeAttributes().
| bool Attribute::isIntAttribute | ( | ) | const |
Return true if the attribute is an integer attribute.
Definition at line 149 of file Attributes.cpp.
References llvm::AttributeImpl::isIntAttribute().
Referenced by getKindAsEnum(), getValueAsInt(), llvm::AttrBuilder::hasAttributes(), and llvm::AttrBuilder::removeAttributes().
| bool Attribute::isStringAttribute | ( | ) | const |
Return true if the attribute is a string (target-dependent) attribute.
Definition at line 153 of file Attributes.cpp.
References llvm::AttributeImpl::isStringAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), getAsString(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), getKindAsString(), getValueAsString(), hasAttribute(), llvm::AttrBuilder::hasAttributes(), LLVMIsStringAttribute(), llvm::parseStatepointDirectivesFromAttrs(), llvm::AsmPrinter::recordSled(), llvm::AttrBuilder::removeAttributes(), and llvm::StackProtector::runOnFunction().
Definition at line 165 of file Attributes.h.
Less-than operator. Useful for sorting the attributes list.
Definition at line 402 of file Attributes.cpp.
Equality and non-equality operators.
Definition at line 164 of file Attributes.h.
|
inline |
Definition at line 170 of file Attributes.h.
References llvm::FoldingSetNodeID::AddPointer().
1.8.6