CIRCT  18.0.0git
Public Member Functions | Private Attributes | List of all members
SymbolHandler Class Reference

A combination of SymbolCache and SymbolUserMap that also allows to add users and remove symbols on-demand. More...

Inheritance diagram for SymbolHandler:
Inheritance graph
[legend]
Collaboration diagram for SymbolHandler:
Collaboration graph
[legend]

Public Member Functions

ArrayRef< Operation * > getUsers (Operation *symbol) const
 Return the users of the provided symbol operation. More...
 
bool useEmpty (Operation *symbol)
 Return true if the given symbol has no uses. More...
 
void addUser (Operation *def, Operation *user)
 
void removeUser (Operation *def, Operation *user)
 
void removeDefinitionAndAllUsers (Operation *def)
 
void collectAllSymbolUses (Operation *symbolTableOp, SymbolTableCollection &symbolTable)
 
- Public Member Functions inherited from circt::SymbolCache
void addDefinition (mlir::Attribute key, mlir::Operation *op) override
 In the building phase, add symbols. More...
 
mlir::Operation * getDefinition (mlir::Attribute attr) const override
 Lookup a definition for 'symbol' in the cache. More...
 
SymbolCacheBase::Iterator begin () override
 
SymbolCacheBase::Iterator end () override
 
virtual mlir::Operation * getDefinition (mlir::Attribute symbol) const=0
 Lookup a definition for 'symbol' in the cache. More...
 
mlir::Operation * getDefinition (mlir::FlatSymbolRefAttr symbol) const
 Lookup a definition for 'symbol' in the cache. More...
 
- Public Member Functions inherited from circt::SymbolCacheBase
virtual ~SymbolCacheBase ()
 Virtual method anchor. More...
 
void addSymbol (mlir::SymbolOpInterface op)
 Adds the symbol-defining 'op' to the cache. More...
 
void addDefinitions (mlir::Operation *top)
 Populate the symbol cache with all symbol-defining operations within the 'top' operation. More...
 
mlir::Operation * getDefinition (mlir::FlatSymbolRefAttr symbol) const
 Lookup a definition for 'symbol' in the cache. More...
 

Private Attributes

DenseMap< Operation *, SetVector< Operation * > > userMap
 

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. More...
 
- Protected Attributes inherited from circt::SymbolCache
llvm::DenseMap< mlir::Attribute, mlir::Operation * > symbolCache
 This stores a lookup table from symbol attribute to the operation that defines it. More...
 

Detailed Description

A combination of SymbolCache and SymbolUserMap that also allows to add users and remove symbols on-demand.

Definition at line 43 of file ArcCanonicalizer.cpp.

Member Function Documentation

◆ addUser()

void SymbolHandler::addUser ( Operation *  def,
Operation *  user 
)
inline

Definition at line 56 of file ArcCanonicalizer.cpp.

References assert().

◆ collectAllSymbolUses()

void SymbolHandler::collectAllSymbolUses ( Operation *  symbolTableOp,
SymbolTableCollection &  symbolTable 
)
inline

Definition at line 78 of file ArcCanonicalizer.cpp.

References assert().

◆ getUsers()

ArrayRef<Operation *> SymbolHandler::getUsers ( Operation *  symbol) const
inline

Return the users of the provided symbol operation.

Definition at line 46 of file ArcCanonicalizer.cpp.

◆ removeDefinitionAndAllUsers()

void SymbolHandler::removeDefinitionAndAllUsers ( Operation *  def)
inline

Definition at line 72 of file ArcCanonicalizer.cpp.

References assert().

◆ removeUser()

void SymbolHandler::removeUser ( Operation *  def,
Operation *  user 
)
inline

Definition at line 64 of file ArcCanonicalizer.cpp.

References assert(), and empty.

Referenced by canonicalizePassthoughCall().

◆ useEmpty()

bool SymbolHandler::useEmpty ( Operation *  symbol)
inline

Return true if the given symbol has no uses.

Definition at line 52 of file ArcCanonicalizer.cpp.

Member Data Documentation

◆ userMap

DenseMap<Operation *, SetVector<Operation *> > SymbolHandler::userMap
private

Definition at line 105 of file ArcCanonicalizer.cpp.


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