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

Caching version of getFieldRefFromValue. More...

#include <FieldRefCache.h>

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

Public Member Functions

FieldRef getFieldRefFromValue (Value value, bool lookThroughCasts=false)
 Caching version of getFieldRefFromValue. More...
 
void clear ()
 Drop all cached entries. More...
 
void printStats (llvm::raw_ostream &os) const
 
void addToTotals (size_t &totalHits, size_t &totalComputed, size_t &totalQueries) const
 
void verifyImpl () const
 
void verify () const
 Verify cached fieldRefs against firrtl::getFieldRefFromValue. More...
 

Private Types

using Key = llvm::PointerIntPair< Value, 1, bool >
 

Private Attributes

DenseMap< Key, FieldRefrefs
 
size_t computed = 0
 
size_t hits = 0
 
size_t queries = 0
 

Detailed Description

Caching version of getFieldRefFromValue.

Computes the requested FieldRef and for all operations visited along the way. Tracks some stats in debug.

Definition at line 26 of file FieldRefCache.h.

Member Typedef Documentation

◆ Key

using circt::firrtl::FieldRefCache::Key = llvm::PointerIntPair<Value, 1, bool>
private

Definition at line 27 of file FieldRefCache.h.

Member Function Documentation

◆ addToTotals()

void firrtl::FieldRefCache::addToTotals ( size_t &  totalHits,
size_t &  totalComputed,
size_t &  totalQueries 
) const

Definition at line 85 of file FieldRefCache.cpp.

◆ clear()

void circt::firrtl::FieldRefCache::clear ( )
inline

Drop all cached entries.

Definition at line 40 of file FieldRefCache.h.

References refs.

◆ getFieldRefFromValue()

FieldRef firrtl::FieldRefCache::getFieldRefFromValue ( Value  value,
bool  lookThroughCasts = false 
)

Caching version of getFieldRefFromValue.

Definition at line 23 of file FieldRefCache.cpp.

References assert(), and circt::firrtl::getDeltaRef().

◆ printStats()

void firrtl::FieldRefCache::printStats ( llvm::raw_ostream &  os) const

Definition at line 78 of file FieldRefCache.cpp.

◆ verify()

void circt::firrtl::FieldRefCache::verify ( ) const
inline

Verify cached fieldRefs against firrtl::getFieldRefFromValue.

No-op in release builds.

Definition at line 51 of file FieldRefCache.h.

References verifyImpl().

◆ verifyImpl()

void firrtl::FieldRefCache::verifyImpl ( ) const

Definition at line 93 of file FieldRefCache.cpp.

References assert(), and circt::firrtl::getFieldRefFromValue().

Referenced by verify().

Member Data Documentation

◆ computed

size_t circt::firrtl::FieldRefCache::computed = 0
private

Definition at line 30 of file FieldRefCache.h.

◆ hits

size_t circt::firrtl::FieldRefCache::hits = 0
private

Definition at line 31 of file FieldRefCache.h.

◆ queries

size_t circt::firrtl::FieldRefCache::queries = 0
private

Definition at line 32 of file FieldRefCache.h.

◆ refs

DenseMap<Key, FieldRef> circt::firrtl::FieldRefCache::refs
private

Definition at line 28 of file FieldRefCache.h.

Referenced by clear().


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