CIRCT
20.0.0git
|
A table of inner symbols and their resolutions. More...
#include <InnerSymbolTable.h>
Public Types | |
using | InnerSymCallbackFn = llvm::function_ref< LogicalResult(StringAttr, const InnerSymTarget &)> |
Public Member Functions | |
InnerSymbolTable (Operation *op) | |
Build an inner symbol table for the given operation. More... | |
InnerSymbolTable (const InnerSymbolTable &)=delete | |
Non-copyable. More... | |
InnerSymbolTable & | operator= (const InnerSymbolTable &)=delete |
InnerSymbolTable (InnerSymbolTable &&)=default | |
InnerSymbolTable & | operator= (InnerSymbolTable &&)=default |
InnerSymTarget | lookup (StringRef name) const |
Look up a symbol with the specified name, returning empty InnerSymTarget if no such name exists. More... | |
InnerSymTarget | lookup (StringAttr name) const |
Operation * | lookupOp (StringRef name) const |
Look up a symbol with the specified name, returning null if no such name exists or doesn't target just an operation. More... | |
template<typename T > | |
T | lookupOp (StringRef name) const |
Operation * | lookupOp (StringAttr name) const |
Look up a symbol with the specified name, returning null if no such name exists or doesn't target just an operation. More... | |
template<typename T > | |
T | lookupOp (StringAttr name) const |
Static Public Member Functions | |
static StringAttr | getInnerSymbol (Operation *op) |
Get InnerSymbol for an operation. More... | |
static StringAttr | getInnerSymbol (const InnerSymTarget &target) |
Get InnerSymbol for a target. More... | |
static StringRef | getInnerSymbolAttrName () |
Return the name of the attribute used for inner symbol names. More... | |
static FailureOr< InnerSymbolTable > | get (Operation *op) |
Construct an InnerSymbolTable, checking for verification failure. More... | |
template<typename FuncTy , typename RetTy = typename std::invoke_result_t< FuncTy, StringAttr, const InnerSymTarget &>> | |
static RetTy | walkSymbols (Operation *op, FuncTy &&callback) |
Walk the given IST operation and invoke the callback for all encountered inner symbols. More... | |
static LogicalResult | walkSymbols (Operation *op, InnerSymCallbackFn callback) |
Walk the given IST operation and invoke the callback for all encountered inner symbols. More... | |
Private Types | |
using | TableTy = DenseMap< StringAttr, InnerSymTarget > |
Private Member Functions | |
InnerSymbolTable (Operation *op, TableTy &&table) | |
Construct an inner symbol table for the given operation, with pre-populated table contents. More... | |
Private Attributes | |
Operation * | innerSymTblOp |
This is the operation this table is constructed for, which must have the InnerSymbolTable trait. More... | |
TableTy | symbolTable |
This maps inner symbol names to their targets. More... | |
A table of inner symbols and their resolutions.
Definition at line 104 of file InnerSymbolTable.h.
using circt::hw::InnerSymbolTable::InnerSymCallbackFn = llvm::function_ref<LogicalResult(StringAttr, const InnerSymTarget &)> |
Definition at line 152 of file InnerSymbolTable.h.
|
private |
Definition at line 185 of file InnerSymbolTable.h.
|
explicit |
Build an inner symbol table for the given operation.
The operation must have the InnerSymbolTable trait.
Definition at line 27 of file InnerSymbolTable.cpp.
References assert().
|
delete |
Non-copyable.
|
default |
|
inlineexplicitprivate |
Construct an inner symbol table for the given operation, with pre-populated table contents.
Definition at line 188 of file InnerSymbolTable.h.
|
static |
Construct an InnerSymbolTable, checking for verification failure.
Emits diagnostics describing encountered issues.
Definition at line 39 of file InnerSymbolTable.cpp.
References append(), assert(), and circt::hw::InnerSymTarget::getOp().
Referenced by LowerLayersPass::runOnModuleBody().
|
static |
Get InnerSymbol for a target.
Be robust to queries on unexpected operations to avoid users needing to know the details.
Definition at line 132 of file InnerSymbolTable.cpp.
References assert(), circt::hw::InnerSymTarget::getField(), circt::hw::InnerSymTarget::getOp(), circt::hw::InnerSymTarget::getPort(), and circt::hw::InnerSymTarget::isPort().
|
static |
Get InnerSymbol for an operation.
Definition at line 124 of file InnerSymbolTable.cpp.
Referenced by ResolveTracesPass::buildTarget().
|
inlinestatic |
Return the name of the attribute used for inner symbol names.
Definition at line 146 of file InnerSymbolTable.h.
Referenced by circt::ExportVerilog::SharedEmitterState::gatherFiles(), circt::firrtl::getInnerSymName(), circt::firrtl::hasDontTouch(), parseModulePorts(), and printFIRRTLImplicitSSAName().
InnerSymTarget circt::hw::InnerSymbolTable::lookup | ( | StringAttr | name | ) | const |
Definition at line 107 of file InnerSymbolTable.cpp.
InnerSymTarget circt::hw::InnerSymbolTable::lookup | ( | StringRef | name | ) | const |
Look up a symbol with the specified name, returning empty InnerSymTarget if no such name exists.
Names never include the @ on them.
Definition at line 104 of file InnerSymbolTable.cpp.
References circt::calyx::direction::get().
Operation * circt::hw::InnerSymbolTable::lookupOp | ( | StringAttr | name | ) | const |
Look up a symbol with the specified name, returning null if no such name exists or doesn't target just an operation.
Definition at line 116 of file InnerSymbolTable.cpp.
|
inline |
Definition at line 135 of file InnerSymbolTable.h.
References lookupOp().
Operation * circt::hw::InnerSymbolTable::lookupOp | ( | StringRef | name | ) | const |
Look up a symbol with the specified name, returning null if no such name exists or doesn't target just an operation.
Definition at line 113 of file InnerSymbolTable.cpp.
References circt::calyx::direction::get().
Referenced by lookupOp().
|
inline |
Definition at line 127 of file InnerSymbolTable.h.
References lookupOp().
|
delete |
|
default |
|
inlinestatic |
Walk the given IST operation and invoke the callback for all encountered inner symbols.
This variant allows callbacks that return LogicalResult OR void, and wraps the underlying implementation.
Definition at line 161 of file InnerSymbolTable.h.
Referenced by circt::hw::InnerSymbolNamespace::add().
|
static |
Walk the given IST operation and invoke the callback for all encountered inner symbols.
This variant is the underlying implementation. If callback returns failure, the walk is aborted and failure is returned. A successful walk with no failures returns success.
Definition at line 62 of file InnerSymbolTable.cpp.
References assert(), and circt::hw::InnerSymTarget::getTargetForSubfield().
|
private |
This is the operation this table is constructed for, which must have the InnerSymbolTable trait.
Definition at line 193 of file InnerSymbolTable.h.
|
private |
This maps inner symbol names to their targets.
Definition at line 196 of file InnerSymbolTable.h.