CIRCT 24.0.0git
Loading...
Searching...
No Matches
circt::firrtl::FieldRefCache Class Reference

Caching version of getFieldRefFromValue. More...

#include <FieldRefCache.h>

Collaboration diagram for circt::firrtl::FieldRefCache:

Public Member Functions

FieldRef getFieldRefFromValue (Value value, bool lookThroughCasts=false)
 Caching version of getFieldRefFromValue.
void clear ()
 Drop all cached entries.
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.

Private Types

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

Private Attributes

DenseMap< Key, FieldRef > refs
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.

References computed, hits, and queries.

◆ 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(), computed, circt::firrtl::getDeltaRef(), hits, queries, and refs.

◆ printStats()

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

Definition at line 78 of file FieldRefCache.cpp.

References computed, hits, and queries.

◆ 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(), circt::firrtl::getFieldRefFromValue(), and refs.

Referenced by verify().

Member Data Documentation

◆ computed

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

Definition at line 30 of file FieldRefCache.h.

Referenced by addToTotals(), getFieldRefFromValue(), and printStats().

◆ hits

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

Definition at line 31 of file FieldRefCache.h.

Referenced by addToTotals(), getFieldRefFromValue(), and printStats().

◆ queries

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

Definition at line 32 of file FieldRefCache.h.

Referenced by addToTotals(), getFieldRefFromValue(), and printStats().

◆ refs

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

Definition at line 28 of file FieldRefCache.h.

Referenced by clear(), getFieldRefFromValue(), and verifyImpl().


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