LLVM 24.0.0git
llvm::AttributeImpl Class Reference

This class represents a single, uniqued attribute. More...

#include "IR/AttributeImpl.h"

Inheritance diagram for llvm::AttributeImpl:
[legend]

Public Member Functions

 AttributeImpl (const AttributeImpl &)=delete
AttributeImploperator= (const AttributeImpl &)=delete
bool isEnumAttribute () const
bool isIntAttribute () const
bool isStringAttribute () const
bool isTypeAttribute () const
bool isConstantRangeAttribute () const
bool isConstantRangeListAttribute () const
bool hasAttribute (Attribute::AttrKind A) const
bool hasAttribute (StringRef Kind) const
Attribute::AttrKind getKindAsEnum () const
uint64_t getValueAsInt () const
bool getValueAsBool () const
StringRef getKindAsString () const
StringRef getValueAsString () const
TypegetValueAsType () const
const ConstantRangegetValueAsConstantRange () const
ArrayRef< ConstantRangegetValueAsConstantRangeList () const
int cmp (const AttributeImpl &AI, bool KindOnly) const
 Used to sort attributes.
bool operator< (const AttributeImpl &AI) const
 Used when sorting the attributes.
void Profile (FoldingSetNodeID &ID) const
 Only the ConstantRange kinds are uniqued by profile; every other kind has a pool with a typed key.
Public Member Functions inherited from llvm::FoldingSetNode
 FoldingSetNode ()=default
uint32_t getFoldingSetHash () const
void setFoldingSetHash (uint32_t Hash)

Static Public Member Functions

static void Profile (FoldingSetNodeID &ID, Attribute::AttrKind Kind, const ConstantRange &CR)
static void Profile (FoldingSetNodeID &ID, Attribute::AttrKind Kind, ArrayRef< ConstantRange > Val)

Protected Types

enum  AttrEntryKind {
  EnumAttrEntry , IntAttrEntry , StringAttrEntry , TypeAttrEntry ,
  ConstantRangeAttrEntry , ConstantRangeListAttrEntry
}

Protected Member Functions

 AttributeImpl (AttrEntryKind KindID)

Detailed Description

This class represents a single, uniqued attribute.

That attribute could be a single enum, a tuple, or a string.

Definition at line 42 of file AttributeImpl.h.

Member Enumeration Documentation

◆ AttrEntryKind

Enumerator
EnumAttrEntry 
IntAttrEntry 
StringAttrEntry 
TypeAttrEntry 
ConstantRangeAttrEntry 
ConstantRangeListAttrEntry 

Definition at line 46 of file AttributeImpl.h.

Constructor & Destructor Documentation

◆ AttributeImpl() [1/2]

◆ AttributeImpl() [2/2]

llvm::AttributeImpl::AttributeImpl ( const AttributeImpl & )
delete

References AttributeImpl().

Member Function Documentation

◆ cmp()

int AttributeImpl::cmp ( const AttributeImpl & AI,
bool KindOnly ) const

Used to sort attributes.

KindOnly controls if the sort includes the attributes' values or just the kind.

Definition at line 923 of file Attributes.cpp.

References assert(), AttributeImpl(), llvm::StringRef::compare(), getKindAsEnum(), getKindAsString(), getValueAsInt(), getValueAsString(), isConstantRangeAttribute(), isConstantRangeListAttribute(), isEnumAttribute(), isIntAttribute(), isStringAttribute(), and isTypeAttribute().

Referenced by operator<().

◆ getKindAsEnum()

Attribute::AttrKind AttributeImpl::getKindAsEnum ( ) const

◆ getKindAsString()

StringRef AttributeImpl::getKindAsString ( ) const

Definition at line 896 of file Attributes.cpp.

References assert(), and isStringAttribute().

Referenced by cmp(), and hasAttribute().

◆ getValueAsBool()

bool AttributeImpl::getValueAsBool ( ) const

Definition at line 891 of file Attributes.cpp.

References assert(), and getValueAsString().

◆ getValueAsConstantRange()

const ConstantRange & AttributeImpl::getValueAsConstantRange ( ) const

Definition at line 911 of file Attributes.cpp.

References assert(), and isConstantRangeAttribute().

Referenced by Profile().

◆ getValueAsConstantRangeList()

ArrayRef< ConstantRange > AttributeImpl::getValueAsConstantRangeList ( ) const

Definition at line 917 of file Attributes.cpp.

References assert(), and isConstantRangeListAttribute().

Referenced by Profile().

◆ getValueAsInt()

uint64_t AttributeImpl::getValueAsInt ( ) const

Definition at line 886 of file Attributes.cpp.

References assert(), getValue(), and isIntAttribute().

Referenced by cmp().

◆ getValueAsString()

StringRef AttributeImpl::getValueAsString ( ) const

Definition at line 901 of file Attributes.cpp.

References assert(), and isStringAttribute().

Referenced by cmp(), and getValueAsBool().

◆ getValueAsType()

Type * AttributeImpl::getValueAsType ( ) const

Definition at line 906 of file Attributes.cpp.

References assert(), and isTypeAttribute().

◆ hasAttribute() [1/2]

bool AttributeImpl::hasAttribute ( Attribute::AttrKind A) const

Definition at line 870 of file Attributes.cpp.

References A(), getKindAsEnum(), and isStringAttribute().

◆ hasAttribute() [2/2]

bool AttributeImpl::hasAttribute ( StringRef Kind) const

Definition at line 875 of file Attributes.cpp.

References getKindAsString(), and isStringAttribute().

◆ isConstantRangeAttribute()

bool llvm::AttributeImpl::isConstantRangeAttribute ( ) const
inline

Definition at line 66 of file AttributeImpl.h.

References ConstantRangeAttrEntry.

Referenced by cmp(), getKindAsEnum(), getValueAsConstantRange(), and Profile().

◆ isConstantRangeListAttribute()

bool llvm::AttributeImpl::isConstantRangeListAttribute ( ) const
inline

Definition at line 69 of file AttributeImpl.h.

References ConstantRangeListAttrEntry.

Referenced by cmp(), getKindAsEnum(), and getValueAsConstantRangeList().

◆ isEnumAttribute()

bool llvm::AttributeImpl::isEnumAttribute ( ) const
inline

Definition at line 62 of file AttributeImpl.h.

References EnumAttrEntry.

Referenced by cmp(), and getKindAsEnum().

◆ isIntAttribute()

bool llvm::AttributeImpl::isIntAttribute ( ) const
inline

Definition at line 63 of file AttributeImpl.h.

References IntAttrEntry.

Referenced by cmp(), getKindAsEnum(), and getValueAsInt().

◆ isStringAttribute()

bool llvm::AttributeImpl::isStringAttribute ( ) const
inline

Definition at line 64 of file AttributeImpl.h.

References StringAttrEntry.

Referenced by cmp(), getKindAsString(), getValueAsString(), hasAttribute(), and hasAttribute().

◆ isTypeAttribute()

bool llvm::AttributeImpl::isTypeAttribute ( ) const
inline

Definition at line 65 of file AttributeImpl.h.

References TypeAttrEntry.

Referenced by cmp(), getKindAsEnum(), and getValueAsType().

◆ operator<()

bool AttributeImpl::operator< ( const AttributeImpl & AI) const

Used when sorting the attributes.

Definition at line 958 of file Attributes.cpp.

References AttributeImpl(), and cmp().

◆ operator=()

AttributeImpl & llvm::AttributeImpl::operator= ( const AttributeImpl & )
delete

References AttributeImpl().

◆ Profile() [1/3]

void llvm::AttributeImpl::Profile ( FoldingSetNodeID & ID) const
inline

Only the ConstantRange kinds are uniqued by profile; every other kind has a pool with a typed key.

Definition at line 97 of file AttributeImpl.h.

References getKindAsEnum(), getValueAsConstantRange(), getValueAsConstantRangeList(), isConstantRangeAttribute(), and Profile.

◆ Profile() [2/3]

void llvm::AttributeImpl::Profile ( FoldingSetNodeID & ID,
Attribute::AttrKind Kind,
ArrayRef< ConstantRange > Val )
inlinestatic

Definition at line 111 of file AttributeImpl.h.

References llvm::ArrayRef< T >::size().

◆ Profile() [3/3]

void llvm::AttributeImpl::Profile ( FoldingSetNodeID & ID,
Attribute::AttrKind Kind,
const ConstantRange & CR )
inlinestatic

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