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

Default symbol cache implementation; stores associations between names (StringAttr's) to mlir::Operation's. More...

#include <SymCache.h>

Inheritance diagram for circt::SymbolCache:
Collaboration diagram for circt::SymbolCache:

Classes

struct  SymbolCacheIteratorImpl

Public Member Functions

void addDefinition (mlir::Attribute key, mlir::Operation *op) override
 In the building phase, add symbols.
mlir::Operation * getDefinition (mlir::Attribute attr) const override
 Lookup a definition for 'symbol' in the cache.
SymbolCacheBase::Iterator begin () override
SymbolCacheBase::Iterator end () override
mlir::Operation * getDefinition (mlir::FlatSymbolRefAttr symbol) const
 Lookup a definition for 'symbol' in the cache.
Public Member Functions inherited from circt::SymbolCacheBase
virtual ~SymbolCacheBase ()
 Virtual method anchor.
void addSymbol (mlir::SymbolOpInterface op)
 Adds the symbol-defining 'op' to the cache.
void addDefinitions (mlir::Operation *top)
 Populate the symbol cache with all symbol-defining operations within the 'top' operation.
mlir::Operation * getDefinition (mlir::FlatSymbolRefAttr symbol) const
 Lookup a definition for 'symbol' in the cache.

Protected Attributes

llvm::DenseMap< mlir::Attribute, mlir::Operation * > symbolCache
 This stores a lookup table from symbol attribute to the operation that defines it.

Private Types

using Iterator = decltype(symbolCache)::iterator
 Iterator support: A simple mapping between decltype(symbolCache)::iterator to SymbolCacheBase::Iterator.

Additional Inherited Members

Public Types inherited from circt::SymbolCacheBase
using CacheItem = std::pair<mlir::Attribute, mlir::Operation *>
 Iterator support through a pointer to some abstract cache.

Detailed Description

Default symbol cache implementation; stores associations between names (StringAttr's) to mlir::Operation's.

Adding/getting definitions from the symbol cache is not thread safe. If this is required, synchronizing cache acccess should be ensured by the caller.

Definition at line 85 of file SymCache.h.

Member Typedef Documentation

◆ Iterator

using circt::SymbolCache::Iterator = decltype(symbolCache)::iterator
private

Iterator support: A simple mapping between decltype(symbolCache)::iterator to SymbolCacheBase::Iterator.

Definition at line 109 of file SymCache.h.

Member Function Documentation

◆ addDefinition()

void circt::SymbolCache::addDefinition ( mlir::Attribute key,
mlir::Operation * op )
inlineoverridevirtual

In the building phase, add symbols.

Implements circt::SymbolCacheBase.

Definition at line 88 of file SymCache.h.

References symbolCache.

◆ begin()

SymbolCacheBase::Iterator circt::SymbolCache::begin ( )
inlineoverridevirtual

Implements circt::SymbolCacheBase.

Definition at line 121 of file SymCache.h.

References symbolCache.

◆ end()

SymbolCacheBase::Iterator circt::SymbolCache::end ( )
inlineoverridevirtual

Implements circt::SymbolCacheBase.

Definition at line 125 of file SymCache.h.

References symbolCache.

◆ getDefinition() [1/2]

mlir::Operation * circt::SymbolCache::getDefinition ( mlir::Attribute symbol) const
inlineoverridevirtual

Lookup a definition for 'symbol' in the cache.

Implements circt::SymbolCacheBase.

Definition at line 94 of file SymCache.h.

References symbolCache.

Referenced by circt::msft::getValueName().

◆ getDefinition() [2/2]

mlir::Operation * circt::SymbolCacheBase::getDefinition ( mlir::FlatSymbolRefAttr symbol) const
inline

Lookup a definition for 'symbol' in the cache.

Definition at line 45 of file SymCache.h.

Member Data Documentation

◆ symbolCache

llvm::DenseMap<mlir::Attribute, mlir::Operation *> circt::SymbolCache::symbolCache
protected

This stores a lookup table from symbol attribute to the operation that defines it.

Definition at line 104 of file SymCache.h.

Referenced by addDefinition(), begin(), end(), and getDefinition().


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