CIRCT
20.0.0git
|
Psuedo-reduction that sanitizes module, instance, and port names. More...
Public Member Functions | |
const char * | getName () |
char | getPortName () |
void | beforeReduction (mlir::ModuleOp op) override |
Called before the reduction is applied to a new subset of operations. More... | |
LogicalResult | rewrite (firrtl::CircuitOp circuitOp) override |
std::string | getName () const override |
Return a human-readable name for this reduction pattern. More... | |
bool | acceptSizeIncrease () const override |
Return true if the tool should accept the transformation this reduction performs on the module even if the overall size of the output increases. More... | |
bool | isOneShot () const override |
Return true if the tool should not try to reapply this reduction after it has been successful. More... | |
Public Member Functions inherited from circt::OpReduction< firrtl::CircuitOp > | |
uint64_t | match (Operation *op) override |
Check if the reduction can apply to a specific operation. More... | |
virtual uint64_t | match (firrtl::CircuitOp op) |
LogicalResult | rewrite (Operation *op) override |
Apply the reduction to a specific operation. More... | |
Public Member Functions inherited from circt::Reduction | |
virtual | ~Reduction () |
virtual void | afterReduction (mlir::ModuleOp) |
Called after the reduction has been applied to a subset of operations. More... | |
void | notifyOpErased (Operation *op) |
Public Attributes | |
const char * | names [48] |
size_t | nameIndex = 0 |
size_t | portNameIndex = 0 |
Public Attributes inherited from circt::Reduction | |
std::function< void(Operation *)> | notifyOpErasedCallback = nullptr |
An optional callback for reductions to communicate removal of operations. More... | |
Psuedo-reduction that sanitizes module, instance, and port names.
This makes the following changes:
- All modules are given metasyntactic names ("Foo", "Bar", etc.) - All instances are renamed to match the new module name - All module ports are renamed in the following way: - All clocks are reanemd to "clk" - All resets are renamed to "rst" - All references are renamed to "ref" - Anything else is renamed to "port"
Definition at line 1000 of file FIRRTLReductions.cpp.
|
inlineoverridevirtual |
Return true if the tool should accept the transformation this reduction performs on the module even if the overall size of the output increases.
This can be handy for patterns that reduce the complexity of the IR at the cost of some verbosity.
Reimplemented from circt::Reduction.
Definition at line 1088 of file FIRRTLReductions.cpp.
|
inlineoverridevirtual |
Called before the reduction is applied to a new subset of operations.
Reductions may use this callback to collect information such as symbol tables about the module upfront.
Reimplemented from circt::Reduction.
Definition at line 1027 of file FIRRTLReductions.cpp.
|
inline |
Definition at line 1013 of file FIRRTLReductions.cpp.
|
inlineoverridevirtual |
Return a human-readable name for this reduction pattern.
Implements circt::Reduction.
Definition at line 1086 of file FIRRTLReductions.cpp.
|
inline |
Definition at line 1021 of file FIRRTLReductions.cpp.
|
inlineoverridevirtual |
Return true if the tool should not try to reapply this reduction after it has been successful.
This is useful for reductions whose match()
function keeps returning true even after the reduction has reached a fixed-point and no longer performs any change. An example of this are reductions that apply a lowering pass which always applies but may leave the input unmodified.
This is mainly useful in conjunction with returning true from acceptSizeIncrease()
. For reductions that don't accept an increase, the module size has to decrease for them to be considered useful, which prevents the tool from getting stuck at a local point where the reduction applies but produces no change in the input. However, reductions that do accept a size increase can get stuck in this local fixed-point as they keep applying to the same operations and the tool keeps accepting the unmodified input as an improvement.
Reimplemented from circt::Reduction.
Definition at line 1090 of file FIRRTLReductions.cpp.
|
inlineoverridevirtual |
Implements circt::OpReduction< firrtl::CircuitOp >.
Definition at line 1029 of file FIRRTLReductions.cpp.
References circt::firrtl::FIRRTLTypeSwitch< T, ResultT >::Case(), circt::calyx::direction::get(), circt::hw::instance_like_impl::getName(), circt::firrtl::InstanceGraph::getTopLevelModule(), and circt::Namespace::newName().
size_t ModuleNameSanitizer::nameIndex = 0 |
Definition at line 1011 of file FIRRTLReductions.cpp.
const char* ModuleNameSanitizer::names[48] |
Definition at line 1002 of file FIRRTLReductions.cpp.
size_t ModuleNameSanitizer::portNameIndex = 0 |
Definition at line 1019 of file FIRRTLReductions.cpp.