CIRCT  19.0.0git
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
circt::firrtl::Annotation Class Reference

This class provides a read-only projection of an annotation. More...

#include <FIRRTLAnnotations.h>

Collaboration diagram for circt::firrtl::Annotation:
Collaboration graph
[legend]

Classes

struct  ClassIsa
 Helper struct to perform variadic class equality check. More...
 

Public Types

using iterator = llvm::ArrayRef< NamedAttribute >::iterator
 

Public Member Functions

 Annotation ()
 
 Annotation (Attribute attr)
 
 Annotation (Annotation anno, uint64_t fieldID)
 
DictionaryAttr getDict () const
 Get the data dictionary of this attribute. More...
 
void setDict (DictionaryAttr dict)
 Set the data dictionary of this attribute. More...
 
unsigned getFieldID () const
 Get the field id this attribute targets. More...
 
Attribute getAttr () const
 Get the underlying attribute. More...
 
StringAttr getClassAttr () const
 Return the 'class' that this annotation is representing. More...
 
StringRef getClass () const
 Return the 'class' that this annotation is representing. More...
 
template<typename... Args>
bool isClass (Args... names) const
 Return true if this annotation matches any of the specified class names. More...
 
template<typename AttrClass = Attribute>
AttrClass getMember (StringAttr name) const
 Return a member of the annotation. More...
 
template<typename AttrClass = Attribute>
AttrClass getMember (StringRef name) const
 
void setMember (StringAttr name, Attribute value)
 Add or set a member of the annotation to a value. More...
 
void setMember (StringRef name, Attribute value)
 
void removeMember (StringAttr name)
 Remove a member of the annotation. More...
 
void removeMember (StringRef name)
 
bool canBeDeleted ()
 Returns true if this is an annotation which can be safely deleted without consequence. More...
 
iterator begin () const
 
iterator end () const
 
bool operator== (const Annotation &other) const
 
bool operator!= (const Annotation &other) const
 
 operator bool () const
 
bool operator! () const
 
void dump ()
 

Private Attributes

Attribute attr
 

Detailed Description

This class provides a read-only projection of an annotation.

Definition at line 49 of file FIRRTLAnnotations.h.

Member Typedef Documentation

◆ iterator

using circt::firrtl::Annotation::iterator = llvm::ArrayRef<NamedAttribute>::iterator

Definition at line 114 of file FIRRTLAnnotations.h.

Constructor & Destructor Documentation

◆ Annotation() [1/3]

circt::firrtl::Annotation::Annotation ( )
inline

Definition at line 51 of file FIRRTLAnnotations.h.

◆ Annotation() [2/3]

circt::firrtl::Annotation::Annotation ( Attribute  attr)
inlineexplicit

Definition at line 53 of file FIRRTLAnnotations.h.

References assert(), and attr.

◆ Annotation() [3/3]

circt::firrtl::Annotation::Annotation ( Annotation  anno,
uint64_t  fieldID 
)
inline

Member Function Documentation

◆ begin()

iterator circt::firrtl::Annotation::begin ( ) const
inline

Definition at line 115 of file FIRRTLAnnotations.h.

References getDict().

Referenced by Deduper::makeAnnotationNonLocal().

◆ canBeDeleted()

bool Annotation::canBeDeleted ( )

Returns true if this is an annotation which can be safely deleted without consequence.

Definition at line 534 of file FIRRTLAnnotations.cpp.

References isClass(), and circt::firrtl::omirTrackerAnnoClass.

Referenced by circt::firrtl::AnnotationSet::canBeDeleted().

◆ dump()

void Annotation::dump ( )

Definition at line 546 of file FIRRTLAnnotations.cpp.

References attr.

◆ end()

iterator circt::firrtl::Annotation::end ( ) const
inline

Definition at line 116 of file FIRRTLAnnotations.h.

References getDict().

Referenced by Deduper::makeAnnotationNonLocal().

◆ getAttr()

Attribute circt::firrtl::Annotation::getAttr ( ) const
inline

◆ getClass()

StringRef Annotation::getClass ( ) const

Return the 'class' that this annotation is representing.

Definition at line 466 of file FIRRTLAnnotations.cpp.

References getClassAttr().

Referenced by circt::firrtl::applyWithoutTargetImpl(), circt::firrtl::AnnotationSet::removeAnnotation(), and circt::firrtl::AnnotationSet::removeAnnotations().

◆ getClassAttr()

StringAttr Annotation::getClassAttr ( ) const

Return the 'class' that this annotation is representing.

Definition at line 461 of file FIRRTLAnnotations.cpp.

References getDict().

Referenced by getClass(), and isClass().

◆ getDict()

DictionaryAttr Annotation::getDict ( ) const

Get the data dictionary of this attribute.

Definition at line 448 of file FIRRTLAnnotations.cpp.

References attr.

Referenced by begin(), cloneMemWithNewType(), end(), getClassAttr(), getMember(), circt::firrtl::AnnotationSet::removeAnnotation(), removeMember(), and setMember().

◆ getFieldID()

unsigned Annotation::getFieldID ( ) const

Get the field id this attribute targets.

Definition at line 454 of file FIRRTLAnnotations.cpp.

Referenced by cloneMemWithNewType(), and ResolveTracesPass::updateTargetImpl().

◆ getMember() [1/2]

template<typename AttrClass = Attribute>
AttrClass circt::firrtl::Annotation::getMember ( StringAttr  name) const
inline

◆ getMember() [2/2]

template<typename AttrClass = Attribute>
AttrClass circt::firrtl::Annotation::getMember ( StringRef  name) const
inline

Definition at line 98 of file FIRRTLAnnotations.h.

References getDict().

◆ isClass()

template<typename... Args>
bool circt::firrtl::Annotation::isClass ( Args...  names) const
inline

◆ operator bool()

circt::firrtl::Annotation::operator bool ( ) const
inlineexplicit

Definition at line 120 of file FIRRTLAnnotations.h.

References attr.

◆ operator!()

bool circt::firrtl::Annotation::operator! ( ) const
inline

Definition at line 121 of file FIRRTLAnnotations.h.

References attr.

◆ operator!=()

bool circt::firrtl::Annotation::operator!= ( const Annotation other) const
inline

Definition at line 119 of file FIRRTLAnnotations.h.

◆ operator==()

bool circt::firrtl::Annotation::operator== ( const Annotation other) const
inline

Definition at line 118 of file FIRRTLAnnotations.h.

References attr.

◆ removeMember() [1/2]

void Annotation::removeMember ( StringAttr  name)

Remove a member of the annotation.

Definition at line 497 of file FIRRTLAnnotations.cpp.

References getDict(), and setDict().

Referenced by Annotation().

◆ removeMember() [2/2]

void Annotation::removeMember ( StringRef  name)

Definition at line 514 of file FIRRTLAnnotations.cpp.

References getDict(), and setDict().

◆ setDict()

void Annotation::setDict ( DictionaryAttr  dict)

Set the data dictionary of this attribute.

Definition at line 452 of file FIRRTLAnnotations.cpp.

References attr.

Referenced by Deduper::cloneAnnotation(), removeMember(), and setMember().

◆ setMember() [1/2]

void Annotation::setMember ( StringAttr  name,
Attribute  value 
)

Add or set a member of the annotation to a value.

Definition at line 472 of file FIRRTLAnnotations.cpp.

Referenced by Annotation(), and cloneMemWithNewType().

◆ setMember() [2/2]

void Annotation::setMember ( StringRef  name,
Attribute  value 
)

Definition at line 476 of file FIRRTLAnnotations.cpp.

References circt::calyx::direction::get(), getDict(), and setDict().

Member Data Documentation

◆ attr

Attribute circt::firrtl::Annotation::attr
private

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