CIRCT  19.0.0git
Public Member Functions | Private Attributes | List of all members
circt::FieldRef Class Reference

This class represents a reference to a specific field or element of an aggregate value. More...

#include <FieldRef.h>

Collaboration diagram for circt::FieldRef:
Collaboration graph
[legend]

Public Member Functions

 FieldRef ()
 Get a null FieldRef. More...
 
 FieldRef (Value value, unsigned id)
 Get a FieldRef location for the specified value. More...
 
Value getValue () const
 Get the Value which created this location. More...
 
Operation * getDefiningOp () const
 Get the operation which defines this field. More...
 
template<typename OpTy >
OpTy getDefiningOp () const
 Get the operation which defines this field and cast it to the OpTy. More...
 
template<typename... Any>
bool isa () const
 
unsigned getFieldID () const
 Get the field ID of this FieldRef, which is a unique identifier mapped to a specific field in a bundle. More...
 
FieldRef getSubField (unsigned subFieldID) const
 Get a reference to a subfield. More...
 
Location getLoc () const
 Get the location associated with the value of this field ref. More...
 
bool operator== (const FieldRef &other) const
 
bool operator< (const FieldRef &other) const
 
 operator bool () const
 

Private Attributes

Value value
 A pointer to the value which created this. More...
 
unsigned id = 0
 A unique field ID. More...
 

Detailed Description

This class represents a reference to a specific field or element of an aggregate value.

Typically, the user will assign a unique field ID to each field in an aggregate type by visiting them in a depth-first pre-order.

This can be used as the key in a hashtable to store field specific information.

Definition at line 28 of file FieldRef.h.

Constructor & Destructor Documentation

◆ FieldRef() [1/2]

circt::FieldRef::FieldRef ( )
inline

Get a null FieldRef.

Definition at line 31 of file FieldRef.h.

Referenced by getSubField().

◆ FieldRef() [2/2]

circt::FieldRef::FieldRef ( Value  value,
unsigned  id 
)
inline

Get a FieldRef location for the specified value.

Definition at line 34 of file FieldRef.h.

Member Function Documentation

◆ getDefiningOp() [1/2]

Operation * FieldRef::getDefiningOp ( ) const

Get the operation which defines this field.

If the field is a block argument it will return the operation which owns the block.

Definition at line 19 of file FieldRef.cpp.

References value.

Referenced by getDefiningOp(), and isa().

◆ getDefiningOp() [2/2]

template<typename OpTy >
OpTy circt::FieldRef::getDefiningOp ( ) const
inline

Get the operation which defines this field and cast it to the OpTy.

Returns null if the defining operation is of a different type.

Definition at line 46 of file FieldRef.h.

References getDefiningOp().

◆ getFieldID()

unsigned circt::FieldRef::getFieldID ( ) const
inline

Get the field ID of this FieldRef, which is a unique identifier mapped to a specific field in a bundle.

Definition at line 59 of file FieldRef.h.

References id.

Referenced by getFieldIDOffset(), circt::firrtl::getFieldName(), getFieldName(), circt::firrtl::getTargetFor(), circt::hash_value(), isUselessVec(), and circt::firrtl::walkDrivers().

◆ getLoc()

Location circt::FieldRef::getLoc ( ) const
inline

Get the location associated with the value of this field ref.

Definition at line 67 of file FieldRef.h.

References getValue().

◆ getSubField()

FieldRef circt::FieldRef::getSubField ( unsigned  subFieldID) const
inline

Get a reference to a subfield.

Definition at line 62 of file FieldRef.h.

References FieldRef(), and value.

Referenced by DiscoverLoops::recordDataflow().

◆ getValue()

Value circt::FieldRef::getValue ( ) const
inline

◆ isa()

template<typename... Any>
bool circt::FieldRef::isa ( ) const
inline

Definition at line 51 of file FieldRef.h.

References assert(), and getDefiningOp().

◆ operator bool()

circt::FieldRef::operator bool ( ) const
inline

Definition at line 81 of file FieldRef.h.

References value.

◆ operator<()

bool circt::FieldRef::operator< ( const FieldRef other) const
inline

Definition at line 73 of file FieldRef.h.

References id, and value.

◆ operator==()

bool circt::FieldRef::operator== ( const FieldRef other) const
inline

Definition at line 69 of file FieldRef.h.

References id, and value.

Member Data Documentation

◆ id

unsigned circt::FieldRef::id = 0
private

A unique field ID.

Definition at line 88 of file FieldRef.h.

Referenced by getFieldID(), operator<(), and operator==().

◆ value

Value circt::FieldRef::value
private

A pointer to the value which created this.

Definition at line 85 of file FieldRef.h.

Referenced by getDefiningOp(), getSubField(), getValue(), operator bool(), operator<(), operator==(), and Python.support.OpOperand::type().


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