LLVM  mainline
Public Types | Public Member Functions | Static Public Member Functions
llvm::Attribute Class Reference

#include <Attributes.h>

List of all members.

Public Types

enum  AttrKind { None }
 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.
bool isIntAttribute () const
 Return true if the attribute is an integer attribute.
bool isStringAttribute () const
 Return true if the attribute is a string (target-dependent) attribute.
bool hasAttribute (AttrKind Val) const
 Return true if the attribute is present.
bool hasAttribute (StringRef Val) const
 Return true if the target-dependent attribute is present.
Attribute::AttrKind getKindAsEnum () const
 Return the attribute's kind as an enum (Attribute::AttrKind).
uint64_t getValueAsInt () const
 Return the attribute's value as an integer.
StringRef getKindAsString () const
 Return the attribute's kind as a string.
StringRef getValueAsString () const
 Return the attribute's value as a string.
unsigned getAlignment () const
 Returns the alignment field of an attribute as a byte alignment value.
unsigned getStackAlignment () const
 Returns the stack alignment field of an attribute as a byte alignment value.
uint64_t getDereferenceableBytes () const
 Returns the number of dereferenceable bytes from the dereferenceable attribute.
uint64_t getDereferenceableOrNullBytes () const
 Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
std::string getAsString (bool InAttrGrp=false) const
 The Attribute is converted to a string of equivalent mnemonic.
bool operator== (Attribute A) const
 Equality and non-equality operators.
bool operator!= (Attribute A) const
bool operator< (Attribute A) const
 Less-than operator. Useful for sorting the attributes list.
void Profile (FoldingSetNodeID &ID) const

Static Public Member Functions

static Attribute get (LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
 Return a uniquified Attribute object.
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.
static Attribute getWithStackAlignment (LLVMContext &Context, uint64_t Align)
static Attribute getWithDereferenceableBytes (LLVMContext &Context, uint64_t Bytes)
static Attribute getWithDereferenceableOrNullBytes (LLVMContext &Context, uint64_t Bytes)

Detailed Description

Definition at line 46 of file Attributes.h.


Member Enumeration Documentation

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.

Definition at line 65 of file Attributes.h.


Constructor & Destructor Documentation

llvm::Attribute::Attribute ( ) [inline]

Definition at line 78 of file Attributes.h.

Referenced by get().


Member Function Documentation

Attribute Attribute::get ( LLVMContext Context,
Attribute::AttrKind  Kind,
uint64_t  Val = 0 
) [static]
Attribute Attribute::get ( LLVMContext Context,
StringRef  Kind,
StringRef  Val = StringRef() 
) [static]

Returns the alignment field of an attribute as a byte alignment value.

Definition at line 157 of file Attributes.cpp.

References llvm::AttributeImpl::getValueAsInt(), and hasAttribute().

Referenced by llvm::AttrBuilder::addAttribute().

std::string Attribute::getAsString ( bool  InAttrGrp = false) const

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 183 of file Attributes.cpp.

References llvm::CallingConv::Cold, llvm::MCID::Convergent, llvm::StringRef::empty(), getKindAsString(), getValueAsInt(), llvm::AttributeImpl::getValueAsString(), hasAttribute(), isStringAttribute(), llvm::ISD::JumpTable, llvm_unreachable, llvm::codeview::Naked, Name, llvm::NoAlias, llvm::SExt, and llvm::utostr().

Returns the number of dereferenceable bytes from the dereferenceable attribute.

Definition at line 169 of file Attributes.cpp.

References llvm::AttributeImpl::getValueAsInt(), and hasAttribute().

Referenced by llvm::AttrBuilder::addAttribute().

Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.

Definition at line 176 of file Attributes.cpp.

References llvm::AttributeImpl::getValueAsInt(), and hasAttribute().

Referenced by llvm::AttrBuilder::addAttribute().

Return the attribute's kind as an enum (Attribute::AttrKind).

This requires the attribute to be an enum or integer attribute.

Definition at line 120 of file Attributes.cpp.

References llvm::AttributeImpl::getKindAsEnum(), isEnumAttribute(), isIntAttribute(), and None.

Referenced by llvm::AttrBuilder::addAttribute(), llvm::AttrBuilder::removeAttributes(), and WriteAttributeGroupTable().

Return the attribute's kind as a string.

This requires the attribute to be a string attribute.

Definition at line 134 of file Attributes.cpp.

References llvm::AttributeImpl::getKindAsString(), and isStringAttribute().

Referenced by llvm::AttrBuilder::addAttribute(), getAsString(), llvm::AttrBuilder::hasAttributes(), llvm::AttrBuilder::removeAttributes(), and WriteAttributeGroupTable().

Returns the stack alignment field of an attribute as a byte alignment value.

Definition at line 163 of file Attributes.cpp.

References llvm::AttributeImpl::getValueAsInt(), and hasAttribute().

Referenced by llvm::AttrBuilder::addAttribute().

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 127 of file Attributes.cpp.

References llvm::AttributeImpl::getValueAsInt(), and isIntAttribute().

Referenced by getAsString(), and WriteAttributeGroupTable().

Attribute Attribute::getWithAlignment ( LLVMContext Context,
uint64_t  Align 
) [static]

Return a uniquified Attribute object that has the specific alignment set.

Definition at line 79 of file Attributes.cpp.

References llvm::isPowerOf2_32().

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

Attribute Attribute::getWithDereferenceableBytes ( LLVMContext Context,
uint64_t  Bytes 
) [static]

Definition at line 92 of file Attributes.cpp.

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

Attribute Attribute::getWithDereferenceableOrNullBytes ( LLVMContext Context,
uint64_t  Bytes 
) [static]

Definition at line 98 of file Attributes.cpp.

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

Attribute Attribute::getWithStackAlignment ( LLVMContext Context,
uint64_t  Align 
) [static]

Definition at line 85 of file Attributes.cpp.

References llvm::isPowerOf2_32().

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

Return true if the target-dependent attribute is present.

Definition at line 152 of file Attributes.cpp.

References llvm::AttributeImpl::hasAttribute(), and isStringAttribute().

Return true if the attribute is an integer attribute.

Definition at line 112 of file Attributes.cpp.

References llvm::AttributeImpl::isIntAttribute().

Referenced by getKindAsEnum(), getValueAsInt(), llvm::AttrBuilder::hasAttributes(), llvm::AttrBuilder::removeAttributes(), and WriteAttributeGroupTable().

bool llvm::Attribute::operator!= ( Attribute  A) const [inline]

Definition at line 156 of file Attributes.h.

bool Attribute::operator< ( Attribute  A) const

Less-than operator. Useful for sorting the attributes list.

Definition at line 330 of file Attributes.cpp.

bool llvm::Attribute::operator== ( Attribute  A) const [inline]

Equality and non-equality operators.

Definition at line 155 of file Attributes.h.

void llvm::Attribute::Profile ( FoldingSetNodeID ID) const [inline]

Definition at line 161 of file Attributes.h.

References llvm::FoldingSetNodeID::AddPointer().


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