LLVM
8.0.1
|
#include "llvm/IR/Attributes.h"
Public Types | |
enum | AttrKind { None, Alignment, AllocSize, AlwaysInline, ArgMemOnly, Builtin, ByVal, Cold, Convergent, Dereferenceable, DereferenceableOrNull, InAlloca, InReg, InaccessibleMemOnly, InaccessibleMemOrArgMemOnly, InlineHint, JumpTable, MinSize, Naked, Nest, NoAlias, NoBuiltin, NoCapture, NoCfCheck, NoDuplicate, NoImplicitFloat, NoInline, NoRecurse, NoRedZone, NoReturn, NoUnwind, NonLazyBind, NonNull, OptForFuzzing, OptimizeForSize, OptimizeNone, ReadNone, ReadOnly, Returned, ReturnsTwice, SExt, SafeStack, SanitizeAddress, SanitizeHWAddress, SanitizeMemory, SanitizeThread, ShadowCallStack, Speculatable, SpeculativeLoadHardening, StackAlignment, StackProtect, StackProtectReq, StackProtectStrong, StrictFP, StructRet, SwiftError, SwiftSelf, UWTable, WriteOnly, ZExt, EndAttrKinds } |
This enumeration lists the attributes that can be associated with parameters, function results, or the function itself. More... | |
Public Member Functions | |
Attribute ()=default | |
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 51 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.
Definition at line 70 of file Attributes.h.
|
default |
Referenced by fromRawPointer(), get(), and llvm::AttributeSet::getAttribute().
|
inlinestatic |
Get an attribute from a raw pointer created by getRawPointer.
Definition at line 184 of file Attributes.h.
References Attribute().
Referenced by llvm::unwrap().
|
static |
Return a uniquified Attribute object.
Definition at line 81 of file Attributes.cpp.
References llvm::FoldingSetNodeID::AddInteger(), Attribute(), llvm::LLVMContextImpl::AttrsSet, and llvm::LLVMContext::pImpl.
Referenced by llvm::Function::addFnAttr(), findInitTrampoline(), llvm::AttributeSetNode::get(), llvm::AttributeList::get(), LLVMAddTargetDependentFunctionAttr(), LLVMCreateEnumAttribute(), LLVMCreateStringAttribute(), processCallSite(), RemoveNonValidAttrAtIndex(), llvm::WholeProgramDevirtPass::run(), and setInlineRemark().
|
static |
Definition at line 105 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 211 of file Attributes.cpp.
References Alignment, assert(), llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), and llvm::AttributeSet::hasAttributes().
Returns the argument numbers for the allocsize attribute (or pair(0, 0) if not known).
Definition at line 237 of file Attributes.cpp.
References AllocSize, assert(), llvm::AttributeImpl::getValueAsInt(), hasAttribute(), and unpackAllocSizeArgs().
Referenced by getAllocationSize(), getAsString(), llvm::AttrBuilder::getDereferenceableOrNullBytes(), llvm::AttributeList::getParamDereferenceableOrNullBytes(), and llvm::AttributeSet::hasAttributes().
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 243 of file Attributes.cpp.
References Alignment, AllocSize, AlwaysInline, ArgMemOnly, Builtin, ByVal, Cold, Convergent, Dereferenceable, DereferenceableOrNull, getAllocSizeArgs(), getKindAsString(), getValueAsInt(), llvm::AttributeImpl::getValueAsString(), hasAttribute(), llvm::Optional< T >::hasValue(), InaccessibleMemOnly, InaccessibleMemOrArgMemOnly, InAlloca, InlineHint, InReg, isStringAttribute(), JumpTable, llvm_unreachable, MinSize, Naked, Name, Nest, NoAlias, NoBuiltin, NoCapture, NoCfCheck, NoDuplicate, NoImplicitFloat, NoInline, NonLazyBind, NonNull, NoRecurse, NoRedZone, NoReturn, NoUnwind, OptForFuzzing, OptimizeForSize, OptimizeNone, llvm::printEscapedString(), ReadNone, ReadOnly, Returned, ReturnsTwice, SafeStack, SanitizeAddress, SanitizeHWAddress, SanitizeMemory, SanitizeThread, SExt, ShadowCallStack, Speculatable, SpeculativeLoadHardening, StackAlignment, StackProtect, StackProtectReq, StackProtectStrong, StrictFP, StructRet, SwiftError, SwiftSelf, llvm::utostr(), UWTable, WriteOnly, and ZExt.
Referenced by llvm::AttributeSet::dump(), llvm::AttributeList::getParamDereferenceableOrNullBytes(), and llvm::AttributeSet::hasAttributes().
uint64_t Attribute::getDereferenceableBytes | ( | ) | const |
Returns the number of dereferenceable bytes from the dereferenceable attribute.
Definition at line 223 of file Attributes.cpp.
References assert(), Dereferenceable, llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), llvm::AttributeList::getParamDereferenceableBytes(), and llvm::AttributeSet::hasAttributes().
uint64_t Attribute::getDereferenceableOrNullBytes | ( | ) | const |
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
Definition at line 230 of file Attributes.cpp.
References assert(), DereferenceableOrNull, llvm::AttributeImpl::getValueAsInt(), and hasAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), llvm::AttributeList::getParamDereferenceableBytes(), llvm::AttributeList::getParamDereferenceableOrNullBytes(), and llvm::AttributeSet::hasAttributes().
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 174 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getKindAsEnum(), isEnumAttribute(), isIntAttribute(), and None.
Referenced by llvm::AttrBuilder::addAttribute(), llvm::AttributeImpl::hasAttribute(), LLVMGetEnumAttributeKind(), and llvm::AttributeImpl::operator<().
StringRef Attribute::getKindAsString | ( | ) | const |
Return the attribute's kind as a string.
This requires the attribute to be a string attribute.
Definition at line 188 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getKindAsString(), and isStringAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), getAsString(), llvm::AttributeImpl::hasAttribute(), LLVMGetStringAttributeKind(), and llvm::AttributeImpl::operator<().
|
inline |
Return a raw pointer that uniquely identifies this attribute.
Definition at line 179 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 217 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), hasAttribute(), and StackAlignment.
Referenced by llvm::AttrBuilder::addAttribute(), and llvm::AttributeSet::hasAttributes().
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 181 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsInt(), and isIntAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), getAsString(), and llvm::AttributeImpl::operator<().
StringRef Attribute::getValueAsString | ( | ) | const |
Return the attribute's value as a string.
This requires the attribute to be a string attribute.
Definition at line 195 of file Attributes.cpp.
References assert(), llvm::AttributeImpl::getValueAsString(), and isStringAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), adjustCallerStackProbeSize(), adjustMinLegalVectorWidth(), llvm::NVPTXTargetLowering::allowUnsafeFPMath(), llvm::TargetLoweringBase::areJTsAllowed(), checkFunctionsAttributeConsistency(), llvm::TargetOptions::DisableFramePointerElim(), doesNotGeneratecode(), eliminateTailRecursion(), llvm::AMDGPU::HSAMD::MetadataStreamerV2::emitKernel(), llvm::MipsSEFrameLowering::emitPrologue(), llvm::X86FrameLowering::emitPrologue(), foldFPToIntToFP(), llvm::ARMBaseRegisterInfo::getCalleeSavedRegs(), getDeoptLowering(), llvm::TargetLoweringObjectFileELF::getExplicitSectionGlobal(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::AMDGPUTargetMachine::getGPUName(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), getRecipEstimateForFunc(), llvm::X86TargetLowering::getStackProbeSymbolName(), getSubOpcode(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), getUnderlyingArgReg(), hasUnsafeFPMath(), llvm::RecurrenceDescriptor::isReductionPHI(), isThumbFunction(), llvm::LoopVectorizationLegality::isUniform(), llvm::AMDGPULibCalls::isUnsafeMath(), LLVMGetStringAttributeValue(), LowerInterruptReturn(), MatchReductions(), llvm::AttributeImpl::operator<(), llvm::parseStatepointDirectivesFromAttrs(), replaceShuffleOfInsert(), llvm::TargetMachine::resetTargetOptions(), RetagMask(), llvm::WholeProgramDevirtPass::run(), runOnFunction(), llvm::StackProtector::runOnFunction(), ShouldSignReturnAddress(), ShouldSignWithAKey(), llvm::SIMachineFunctionInfo::SIMachineFunctionInfo(), SimplifyNVVMIntrinsic(), unpackF64OnRV32DSoftABI(), llvm::NVPTXTargetLowering::useF32FTZ(), WindowsRequiresStackProbe(), and windowsRequiresStackProbe().
|
static |
Return a uniquified Attribute object that has the specific alignment set.
Definition at line 125 of file Attributes.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, Alignment, assert(), Context, and llvm::isPowerOf2_32().
Referenced by llvm::IRBuilderBase::CreateElementUnorderedAtomicMemMove(), llvm::AttributeSetNode::get(), LLVMSetInstrParamAlignment(), LLVMSetParamAlignment(), llvm::MemIntrinsicBase< AnyMemIntrinsic >::setDestAlignment(), and llvm::MemTransferBase< AnyMemIntrinsic >::setSourceAlignment().
|
static |
Definition at line 151 of file Attributes.cpp.
References AllocSize, assert(), Context, and packAllocSizeArgs().
Referenced by llvm::AttributeSetNode::get().
|
static |
Definition at line 138 of file Attributes.cpp.
References assert(), Context, and Dereferenceable.
Referenced by llvm::AttributeSetNode::get().
|
static |
Definition at line 144 of file Attributes.cpp.
References assert(), Context, and DereferenceableOrNull.
Referenced by llvm::AttributeSetNode::get().
|
static |
Definition at line 131 of file Attributes.cpp.
References llvm::AMDGPU::HSAMD::Kernel::Arg::Key::Align, assert(), Context, llvm::isPowerOf2_32(), and StackAlignment.
Referenced by llvm::AttributeSetNode::get().
Return true if the attribute is present.
Definition at line 202 of file Attributes.cpp.
References llvm::AttributeImpl::hasAttribute(), and None.
Referenced by llvm::AttributeList::addAllocSizeParamAttr(), llvm::AttributeSet::addAttribute(), getAlignment(), getAllocSizeArgs(), getAsString(), llvm::AttributeSetNode::getAttribute(), getDereferenceableBytes(), getDereferenceableOrNullBytes(), llvm::AMDGPUTargetMachine::getFeatureString(), llvm::AMDGPUTargetMachine::getGPUName(), getStackAlignment(), llvm::HexagonTargetMachine::getSubtargetImpl(), llvm::SparcTargetMachine::getSubtargetImpl(), llvm::WebAssemblyTargetMachine::getSubtargetImpl(), llvm::AArch64TargetMachine::getSubtargetImpl(), llvm::X86TargetMachine::getSubtargetImpl(), llvm::PPCTargetMachine::getSubtargetImpl(), llvm::ARMBaseTargetMachine::getSubtargetImpl(), llvm::MipsTargetMachine::getSubtargetImpl(), llvm::AttributeSet::hasAttributes(), llvm::AttributeList::hasParamAttr(), llvm::isStatepointDirectiveAttr(), isThumbFunction(), llvm::AttributeSet::removeAttribute(), and llvm::WholeProgramDevirtPass::run().
Return true if the target-dependent attribute is present.
Definition at line 206 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 162 of file Attributes.cpp.
References llvm::AttributeImpl::isEnumAttribute().
Referenced by llvm::AttributeImpl::getKindAsEnum(), getKindAsEnum(), and llvm::AttributeImpl::operator<().
bool Attribute::isIntAttribute | ( | ) | const |
Return true if the attribute is an integer attribute.
Definition at line 166 of file Attributes.cpp.
References llvm::AttributeImpl::isIntAttribute().
Referenced by llvm::AttributeImpl::getKindAsEnum(), getKindAsEnum(), llvm::AttributeImpl::getValueAsInt(), getValueAsInt(), and llvm::AttributeImpl::operator<().
bool Attribute::isStringAttribute | ( | ) | const |
Return true if the attribute is a string (target-dependent) attribute.
Definition at line 170 of file Attributes.cpp.
References llvm::AttributeImpl::isStringAttribute().
Referenced by llvm::AttrBuilder::addAttribute(), getAsString(), llvm::AMDGPU::getIntegerAttribute(), llvm::AMDGPU::getIntegerPairAttribute(), llvm::AttributeImpl::getKindAsString(), getKindAsString(), llvm::AttributeImpl::getValueAsString(), getValueAsString(), llvm::AttributeImpl::hasAttribute(), hasAttribute(), LLVMIsStringAttribute(), llvm::parseStatepointDirectivesFromAttrs(), and llvm::StackProtector::runOnFunction().
Definition at line 169 of file Attributes.h.
References operator<().
Less-than operator. Useful for sorting the attributes list.
Definition at line 433 of file Attributes.cpp.
References llvm::AttributeImpl::~AttributeImpl().
Referenced by operator!=().
Equality and non-equality operators.
Definition at line 168 of file Attributes.h.
Referenced by llvm::AttrBuilder::td_empty().
|
inline |
Definition at line 174 of file Attributes.h.
References llvm::FoldingSetNodeID::AddPointer().