LLVM API Documentation
#include <Attributes.h>
Public Types | |
enum | AttrIndex { ReturnIndex = 0U, FunctionIndex = ~0U } |
typedef ArrayRef< Attribute > ::iterator | iterator |
Public Member Functions | |
AttributeSet () | |
AttributeSet | addAttribute (LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const |
Add an attribute to the attribute set at the given index. Since attribute sets are immutable, this returns a new set. | |
AttributeSet | addAttribute (LLVMContext &C, unsigned Index, StringRef Kind) const |
Add an attribute to the attribute set at the given index. Since attribute sets are immutable, this returns a new set. | |
AttributeSet | addAttribute (LLVMContext &C, unsigned Index, StringRef Kind, StringRef Value) const |
AttributeSet | addAttributes (LLVMContext &C, unsigned Index, AttributeSet Attrs) const |
Add attributes to the attribute set at the given index. Since attribute sets are immutable, this returns a new set. | |
AttributeSet | removeAttribute (LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const |
Remove the specified attribute at the specified index from this attribute list. Since attribute lists are immutable, this returns the new list. | |
AttributeSet | removeAttributes (LLVMContext &C, unsigned Index, AttributeSet Attrs) const |
Remove the specified attributes at the specified index from this attribute list. Since attribute lists are immutable, this returns the new list. | |
LLVMContext & | getContext () const |
Retrieve the LLVM context. | |
AttributeSet | getParamAttributes (unsigned Index) const |
The attributes for the specified index are returned. | |
AttributeSet | getRetAttributes () const |
The attributes for the ret value are returned. | |
AttributeSet | getFnAttributes () const |
The function attributes are returned. | |
bool | hasAttribute (unsigned Index, Attribute::AttrKind Kind) const |
Return true if the attribute exists at the given index. | |
bool | hasAttribute (unsigned Index, StringRef Kind) const |
Return true if the attribute exists at the given index. | |
bool | hasAttributes (unsigned Index) const |
Return true if attribute exists at the given index. | |
bool | hasAttrSomewhere (Attribute::AttrKind Attr) const |
Return true if the specified attribute is set for at least one parameter or for the return value. | |
Attribute | getAttribute (unsigned Index, Attribute::AttrKind Kind) const |
Return the attribute object that exists at the given index. | |
Attribute | getAttribute (unsigned Index, StringRef Kind) const |
Return the attribute object that exists at the given index. | |
unsigned | getParamAlignment (unsigned Index) const |
Return the alignment for the specified function parameter. | |
unsigned | getStackAlignment (unsigned Index) const |
Get the stack alignment. | |
uint64_t | getDereferenceableBytes (unsigned Index) const |
Get the number of dereferenceable bytes (or zero if unknown). | |
std::string | getAsString (unsigned Index, bool InAttrGrp=false) const |
Return the attributes at the index as a string. | |
iterator | begin (unsigned Slot) const |
iterator | end (unsigned Slot) const |
bool | operator== (const AttributeSet &RHS) const |
operator==/!= - Provide equality predicates. | |
bool | operator!= (const AttributeSet &RHS) const |
uint64_t | Raw (unsigned Index) const |
void * | getRawPointer () const |
Return a raw pointer that uniquely identifies this attribute list. | |
bool | isEmpty () const |
Return true if there are no attributes. | |
unsigned | getNumSlots () const |
Return the number of slots used in this attribute list. This is the number of arguments that have an attribute set on them (including the function itself). | |
unsigned | getSlotIndex (unsigned Slot) const |
Return the index for the given slot. | |
AttributeSet | getSlotAttributes (unsigned Slot) const |
Return the attributes at the given slot. | |
void | dump () const |
Static Public Member Functions | |
static AttributeSet | get (LLVMContext &C, ArrayRef< AttributeSet > Attrs) |
Return an AttributeSet with the specified parameters in it. | |
static AttributeSet | get (LLVMContext &C, unsigned Index, ArrayRef< Attribute::AttrKind > Kind) |
static AttributeSet | get (LLVMContext &C, unsigned Index, const AttrBuilder &B) |
Friends | |
class | AttrBuilder |
class | AttributeSetImpl |
struct | DenseMapInfo |
Definition at line 212 of file Attributes.h.
Definition at line 332 of file Attributes.h.
Definition at line 214 of file Attributes.h.
llvm::AttributeSet::AttributeSet | ( | ) | [inline] |
Definition at line 244 of file Attributes.h.
Referenced by get(), getFnAttributes(), getParamAttributes(), getRetAttributes(), and removeAttributes().
AttributeSet AttributeSet::addAttribute | ( | LLVMContext & | C, |
unsigned | Index, | ||
Attribute::AttrKind | Attr | ||
) | const |
Add an attribute to the attribute set at the given index. Since attribute sets are immutable, this returns a new set.
Definition at line 718 of file Attributes.cpp.
References addAttributes(), and hasAttribute().
Referenced by llvm::Function::addAttribute(), llvm::CallInst::addAttribute(), llvm::InvokeInst::addAttribute(), llvm::Function::addFnAttr(), fixupFPReturnAndCall(), and removeUseSoftFloat().
AttributeSet AttributeSet::addAttribute | ( | LLVMContext & | C, |
unsigned | Index, | ||
StringRef | Kind | ||
) | const |
Add an attribute to the attribute set at the given index. Since attribute sets are immutable, this returns a new set.
Definition at line 724 of file Attributes.cpp.
References llvm::AttrBuilder::addAttribute(), and addAttributes().
AttributeSet AttributeSet::addAttribute | ( | LLVMContext & | C, |
unsigned | Index, | ||
StringRef | Kind, | ||
StringRef | Value | ||
) | const |
Definition at line 731 of file Attributes.cpp.
References llvm::AttrBuilder::addAttribute(), and addAttributes().
AttributeSet AttributeSet::addAttributes | ( | LLVMContext & | C, |
unsigned | Index, | ||
AttributeSet | Attrs | ||
) | const |
Add attributes to the attribute set at the given index. Since attribute sets are immutable, this returns a new set.
Definition at line 738 of file Attributes.cpp.
References llvm::AttrBuilder::addAttribute(), llvm::AttributeSetImpl::begin(), llvm::CallingConv::C, llvm::AttributeSetImpl::end(), llvm::AttributeSetImpl::getNumAttributes(), getParamAlignment(), getSlotAttributes(), getSlotIndex(), I, llvm::ARM_PROC::IE, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by addAttribute(), llvm::Function::addAttributes(), llvm::CloneFunctionInto(), LLVMAddFunctionAttr(), LLVMAddInstrAttribute(), and LLVMSetInstrParamAlignment().
AttributeSet::iterator AttributeSet::begin | ( | unsigned | Slot | ) | const |
Definition at line 946 of file Attributes.cpp.
Referenced by llvm::AttrBuilder::hasAttributes(), llvm::AssemblyWriter::printFunction(), llvm::AttrBuilder::removeAttributes(), and WriteAttributeGroupTable().
void AttributeSet::dump | ( | ) | const |
Definition at line 986 of file Attributes.cpp.
References llvm::dbgs(), getAsString(), getNumSlots(), and getSlotIndex().
AttributeSet::iterator AttributeSet::end | ( | unsigned | Slot | ) | const |
Definition at line 952 of file Attributes.cpp.
Referenced by llvm::AttrBuilder::hasAttributes(), llvm::AssemblyWriter::printFunction(), llvm::AttrBuilder::removeAttributes(), and WriteAttributeGroupTable().
AttributeSet AttributeSet::get | ( | LLVMContext & | C, |
ArrayRef< AttributeSet > | Attrs | ||
) | [static] |
Return an AttributeSet with the specified parameters in it.
Definition at line 687 of file Attributes.cpp.
References llvm::SmallVectorImpl< T >::append(), AttributeSet(), llvm::SmallVectorTemplateCommon< T >::begin(), llvm::ArrayRef< T >::empty(), llvm::SmallVectorTemplateCommon< T >::end(), llvm::AttributeSetImpl::getNumAttributes(), I, llvm::SmallVectorImpl< T >::insert(), and llvm::ArrayRef< T >::size().
AttributeSet AttributeSet::get | ( | LLVMContext & | C, |
unsigned | Index, | ||
ArrayRef< Attribute::AttrKind > | Kind | ||
) | [static] |
Definition at line 678 of file Attributes.cpp.
References llvm::ArrayRef< T >::begin(), llvm::CallingConv::C, llvm::ArrayRef< T >::end(), llvm::Attribute::get(), I, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
AttributeSet AttributeSet::get | ( | LLVMContext & | C, |
unsigned | Index, | ||
const AttrBuilder & | B | ||
) | [static] |
Definition at line 644 of file Attributes.cpp.
References llvm::Attribute::Alignment, AttributeSet(), llvm::CallingConv::C, llvm::AttrBuilder::contains(), llvm::Attribute::Dereferenceable, llvm::Attribute::EndAttrKinds, llvm::Attribute::get(), llvm::AttrBuilder::getAlignment(), llvm::AttrBuilder::getDereferenceableBytes(), llvm::AttrBuilder::getStackAlignment(), llvm::Attribute::getWithDereferenceableBytes(), llvm::AttrBuilder::hasAttributes(), llvm::Attribute::None, llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back(), llvm::Attribute::StackAlignment, and llvm::AttrBuilder::td_attrs().
std::string AttributeSet::getAsString | ( | unsigned | Index, |
bool | InAttrGrp = false |
||
) | const |
Return the attributes at the index as a string.
Definition at line 928 of file Attributes.cpp.
References llvm::AttributeSetNode::getAsString(), and llvm::Intrinsic::getAttributes().
Referenced by dump(), llvm::AssemblyWriter::printArgument(), llvm::AssemblyWriter::printFunction(), llvm::AssemblyWriter::printInstruction(), and llvm::AssemblyWriter::writeParamOperand().
Attribute AttributeSet::getAttribute | ( | unsigned | Index, |
Attribute::AttrKind | Kind | ||
) | const |
Return the attribute object that exists at the given index.
Definition at line 901 of file Attributes.cpp.
References llvm::AttributeSetNode::getAttribute(), and llvm::Intrinsic::getAttributes().
Referenced by llvm::AMDGPUMachineFunction::AMDGPUMachineFunction(), llvm::Function::getFnAttribute(), and llvm::StackProtector::runOnFunction().
Attribute AttributeSet::getAttribute | ( | unsigned | Index, |
StringRef | Kind | ||
) | const |
Return the attribute object that exists at the given index.
Definition at line 907 of file Attributes.cpp.
References llvm::AttributeSetNode::getAttribute(), and llvm::Intrinsic::getAttributes().
LLVMContext & AttributeSet::getContext | ( | ) | const |
Retrieve the LLVM context.
Definition at line 842 of file Attributes.cpp.
uint64_t AttributeSet::getDereferenceableBytes | ( | unsigned | Index | ) | const |
Get the number of dereferenceable bytes (or zero if unknown).
Definition at line 923 of file Attributes.cpp.
References llvm::Intrinsic::getAttributes(), and llvm::AttributeSetNode::getDereferenceableBytes().
Referenced by llvm::Function::getDereferenceableBytes(), llvm::CallInst::getDereferenceableBytes(), and llvm::InvokeInst::getDereferenceableBytes().
AttributeSet AttributeSet::getFnAttributes | ( | ) | const |
The function attributes are returned.
Definition at line 863 of file Attributes.cpp.
References AttributeSet(), FunctionIndex, llvm::Intrinsic::getAttributes(), and hasAttributes().
Referenced by llvm::CloneFunctionInto(), llvm::AssemblyWriter::printFunction(), and llvm::AssemblyWriter::printInstruction().
unsigned AttributeSet::getNumSlots | ( | ) | const |
Return the number of slots used in this attribute list. This is the number of arguments that have an attribute set on them (including the function itself).
Definition at line 965 of file Attributes.cpp.
Referenced by llvm::Argument::addAttr(), llvm::CloneFunctionInto(), dump(), llvm::AttrBuilder::hasAttributes(), isEmpty(), llvm::AssemblyWriter::printFunction(), llvm::Argument::removeAttr(), llvm::AttrBuilder::removeAttributes(), StripNest(), WriteAttributeGroupTable(), and WriteAttributeTable().
unsigned AttributeSet::getParamAlignment | ( | unsigned | Index | ) | const |
Return the alignment for the specified function parameter.
Definition at line 913 of file Attributes.cpp.
References llvm::AttributeSetNode::getAlignment(), and llvm::Intrinsic::getAttributes().
Referenced by addAttributes(), llvm::Function::getParamAlignment(), llvm::CallInst::getParamAlignment(), llvm::InvokeInst::getParamAlignment(), and getParameterABIAttributes().
AttributeSet AttributeSet::getParamAttributes | ( | unsigned | Index | ) | const |
The attributes for the specified index are returned.
Definition at line 846 of file Attributes.cpp.
References AttributeSet(), llvm::Intrinsic::getAttributes(), and hasAttributes().
Referenced by llvm::CloneFunctionInto().
void* llvm::AttributeSet::getRawPointer | ( | ) | const [inline] |
Return a raw pointer that uniquely identifies this attribute list.
Definition at line 353 of file Attributes.h.
AttributeSet AttributeSet::getRetAttributes | ( | ) | const |
The attributes for the ret value are returned.
Definition at line 854 of file Attributes.cpp.
References AttributeSet(), llvm::Intrinsic::getAttributes(), hasAttributes(), and ReturnIndex.
Referenced by llvm::CloneFunctionInto().
AttributeSet AttributeSet::getSlotAttributes | ( | unsigned | Slot | ) | const |
Return the attributes at the given slot.
Definition at line 975 of file Attributes.cpp.
Referenced by addAttributes(), removeAttributes(), StripNest(), WriteAttributeGroupTable(), and WriteAttributeTable().
unsigned AttributeSet::getSlotIndex | ( | unsigned | Slot | ) | const |
Return the index for the given slot.
Definition at line 969 of file Attributes.cpp.
Referenced by llvm::Argument::addAttr(), addAttributes(), dump(), llvm::AttrBuilder::hasAttributes(), llvm::AssemblyWriter::printFunction(), llvm::Argument::removeAttr(), removeAttributes(), llvm::AttrBuilder::removeAttributes(), StripNest(), and WriteAttributeGroupTable().
unsigned AttributeSet::getStackAlignment | ( | unsigned | Index | ) | const |
Get the stack alignment.
Definition at line 918 of file Attributes.cpp.
References llvm::Intrinsic::getAttributes(), and llvm::AttributeSetNode::getStackAlignment().
bool AttributeSet::hasAttribute | ( | unsigned | Index, |
Attribute::AttrKind | Kind | ||
) | const |
Return true if the attribute exists at the given index.
Definition at line 872 of file Attributes.cpp.
References llvm::Intrinsic::getAttributes(), and llvm::AttributeSetNode::hasAttribute().
Referenced by addAttribute(), AddFastCallStdCallSuffix(), llvm::Function::cannotDuplicate(), llvm::AArch64FrameLowering::canUseRedZone(), checkNumAlignedDPRCS2Regs(), llvm::Function::doesNotAccessMemory(), llvm::Function::doesNotAlias(), llvm::Function::doesNotCapture(), llvm::Function::doesNotReturn(), llvm::Function::doesNotThrow(), llvm::PPCTargetLowering::emitEHSjLjSetJmp(), llvm::MipsAsmPrinter::EmitFunctionBodyStart(), llvm::X86FrameLowering::emitPrologue(), ExpandPowI(), llvm::Inliner::getInlineThreshold(), llvm::ARMTargetLowering::getOptimalMemOpType(), llvm::AArch64TargetLowering::getOptimalMemOpType(), getParameterABIAttributes(), llvm::GetReturnInfo(), llvm::Argument::hasByValOrInAllocaAttr(), llvm::Function::hasFnAttribute(), llvm::Function::hasStructRetAttr(), llvm::Function::hasUWTable(), llvm::InlineCostAnalysis::isInlineViable(), llvm::TargetLowering::isInTailCallPosition(), llvm::NVPTXTargetLowering::LowerFormalArguments(), llvm::MachineFunction::MachineFunction(), llvm::PPCFrameLowering::needsFP(), llvm::PPCRegisterInfo::needsStackRealignment(), llvm::ARMBaseRegisterInfo::needsStackRealignment(), llvm::Function::onlyReadsMemory(), llvm::CallInst::paramHasAttr(), llvm::InvokeInst::paramHasAttr(), performSTORECombine(), removeAttribute(), removeAttributes(), llvm::Inliner::removeDeadFunctions(), llvm::MipsTargetMachine::resetSubtarget(), llvm::InstCombiner::runOnFunction(), StripNest(), llvm::tryFoldSPUpdateIntoPushPop(), and llvm::ARMSubtarget::useMovt().
bool AttributeSet::hasAttribute | ( | unsigned | Index, |
StringRef | Kind | ||
) | const |
Return true if the attribute exists at the given index.
Definition at line 877 of file Attributes.cpp.
References llvm::Intrinsic::getAttributes(), and llvm::AttributeSetNode::hasAttribute().
bool AttributeSet::hasAttributes | ( | unsigned | Index | ) | const |
Return true if attribute exists at the given index.
Definition at line 882 of file Attributes.cpp.
References llvm::Intrinsic::getAttributes(), and llvm::AttributeSetNode::hasAttributes().
Referenced by getFnAttributes(), getParamAttributes(), getRetAttributes(), llvm::AssemblyWriter::printArgument(), llvm::AssemblyWriter::printFunction(), llvm::AssemblyWriter::printInstruction(), and llvm::AssemblyWriter::writeParamOperand().
bool AttributeSet::hasAttrSomewhere | ( | Attribute::AttrKind | Attr | ) | const |
Return true if the specified attribute is set for at least one parameter or for the return value.
Definition at line 889 of file Attributes.cpp.
References I, and llvm::ARM_PROC::IE.
Referenced by llvm::XCoreFrameLowering::emitPrologue(), llvm::CallInst::hasByValArgument(), and llvm::InvokeInst::hasByValArgument().
bool llvm::AttributeSet::isEmpty | ( | ) | const [inline] |
Return true if there are no attributes.
Definition at line 358 of file Attributes.h.
References getNumSlots().
Referenced by llvm::ValueEnumerator::getAttributeGroupID(), and llvm::ValueEnumerator::getAttributeID().
bool llvm::AttributeSet::operator!= | ( | const AttributeSet & | RHS | ) | const [inline] |
Definition at line 341 of file Attributes.h.
bool llvm::AttributeSet::operator== | ( | const AttributeSet & | RHS | ) | const [inline] |
operator==/!= - Provide equality predicates.
Definition at line 338 of file Attributes.h.
uint64_t AttributeSet::Raw | ( | unsigned | Index | ) | const |
Definition at line 981 of file Attributes.cpp.
Referenced by LLVMGetFunctionAttr().
AttributeSet AttributeSet::removeAttribute | ( | LLVMContext & | C, |
unsigned | Index, | ||
Attribute::AttrKind | Attr | ||
) | const |
Remove the specified attribute at the specified index from this attribute list. Since attribute lists are immutable, this returns the new list.
Definition at line 787 of file Attributes.cpp.
References hasAttribute(), and removeAttributes().
Referenced by llvm::Function::removeFnAttr(), and StripNest().
AttributeSet AttributeSet::removeAttributes | ( | LLVMContext & | C, |
unsigned | Index, | ||
AttributeSet | Attrs | ||
) | const |
Remove the specified attributes at the specified index from this attribute list. Since attribute lists are immutable, this returns the new list.
Definition at line 793 of file Attributes.cpp.
References llvm::Attribute::Alignment, AttributeSet(), llvm::CallingConv::C, llvm::AttributeSetImpl::getNumAttributes(), llvm::AttributeSetImpl::getSlotAttributes(), getSlotAttributes(), getSlotIndex(), hasAttribute(), I, and llvm::AttrBuilder::removeAttributes().
Referenced by LLVMRemoveFunctionAttr(), LLVMRemoveInstrAttribute(), removeAttribute(), llvm::CallInst::removeAttribute(), llvm::InvokeInst::removeAttribute(), and llvm::Function::removeAttributes().
friend class AttrBuilder [friend] |
Definition at line 219 of file Attributes.h.
friend class AttributeSetImpl [friend] |
Definition at line 220 of file Attributes.h.
friend struct DenseMapInfo [friend] |
Definition at line 221 of file Attributes.h.