CIRCT 20.0.0git
|
This class tracks the top-level state for the emitters, which is built and then shared across all per-file emissions that happen in parallel. More...
#include <ExportVerilogInternals.h>
Public Types | |
using | EmissionList = std::vector< StringOrOpToEmit > |
Public Member Functions | |
SharedEmitterState (ModuleOp designOp, const LoweringOptions &options, GlobalNameTable globalNames) | |
void | gatherFiles (bool separateModules) |
Organize the operations in the root MLIR module into output files to be generated. | |
void | collectOpsForFile (const FileInfo &fileInfo, EmissionList &thingsToEmit, bool emitHeader=false) |
Given a FileInfo, collect all the replicated and designated operations that go into it and append them to "thingsToEmit". | |
void | emitOps (EmissionList &thingsToEmit, llvm::formatted_raw_ostream &os, StringAttr fileName, bool parallelize) |
Actually emit the collected list of operations and strings to the specified file. | |
Public Attributes | |
ModuleOp | designOp |
The MLIR module to emit. | |
FileInfo | rootFile |
The main file that collects all operations that are neither replicated per-file ops nor specifically assigned to a file. | |
llvm::MapVector< StringAttr, FileInfo > | files |
The additional files to emit, with the output file name as the key into the map. | |
llvm::StringMap< SmallVector< StringAttr > > | fileLists |
The various file lists and their contents to emit. | |
SmallVector< Operation *, 0 > | replicatedOps |
A list of operations replicated in each output file (e.g., sv.verbatim or sv.ifdef without dedicated output file). | |
std::atomic< bool > | encounteredError = {} |
Whether any error has been encountered during emission. | |
hw::HWSymbolCache | symbolCache |
A cache of symbol -> defining ops built once and used by each of the verilog module emitters. | |
const LoweringOptions & | options |
SmallPtrSet< Operation *, 8 > | modulesContainingBinds |
This is a set is populated at "gather" time, containing the hw.module operations that have a sv.bind in them. | |
const GlobalNameTable | globalNames |
Information about renamed global symbols, parameters, etc. | |
FileMapping | fileMapping |
Tracks the referenceable files through their symbol. | |
FragmentMapping | fragmentMapping |
Tracks referenceable files through their symbol. | |
This class tracks the top-level state for the emitters, which is built and then shared across all per-file emissions that happen in parallel.
Definition at line 345 of file ExportVerilogInternals.h.
using circt::ExportVerilog::SharedEmitterState::EmissionList = std::vector<StringOrOpToEmit> |
Definition at line 393 of file ExportVerilogInternals.h.
|
inlineexplicit |
Definition at line 387 of file ExportVerilogInternals.h.
void SharedEmitterState::collectOpsForFile | ( | const FileInfo & | fileInfo, |
EmissionList & | thingsToEmit, | ||
bool | emitHeader = false |
||
) |
Given a FileInfo, collect all the replicated and designated operations that go into it and append them to "thingsToEmit".
Definition at line 6770 of file ExportVerilog.cpp.
References circtHeaderInclude, circt::ExportVerilog::FileInfo::emitReplicatedOps, encounteredError, fragmentMapping, circt::getCirctVersionComment(), circt::emit::getFragmentsAttrName(), circt::ExportVerilog::FileInfo::isHeader, circt::ExportVerilog::FileInfo::isVerilog, circt::LoweringOptions::omitVersionComment, circt::ExportVerilog::FileInfo::ops, options, and replicatedOps.
Referenced by createSplitOutputFile(), and exportVerilogImpl().
void SharedEmitterState::emitOps | ( | EmissionList & | thingsToEmit, |
llvm::formatted_raw_ostream & | os, | ||
StringAttr | fileName, | ||
bool | parallelize | ||
) |
Actually emit the collected list of operations and strings to the specified file.
Definition at line 6857 of file ExportVerilog.cpp.
References designOp, emitOperation(), encounteredError, fileMapping, circt::ExportVerilog::StringOrOpToEmit::getOperation(), globalNames, modulesContainingBinds, options, circt::ExportVerilog::OpLocMap::setStream(), circt::ExportVerilog::StringOrOpToEmit::setString(), symbolCache, and circt::ExportVerilog::StringOrOpToEmit::verilogLocs.
Referenced by createSplitOutputFile(), and exportVerilogImpl().
void SharedEmitterState::gatherFiles | ( | bool | separateModules | ) |
Organize the operations in the root MLIR module into output files to be generated.
If separateModules
is true, a handful of top-level declarations will be split into separate output files even in the absence of an explicit output file attribute.
Collect all the inner names from the specified module and add them to the IRCache. Declarations (named things) only exist at the top level of the module. Also keep track of any modules that contain bind operations. These are non-hierarchical references which we need to be careful about during emission.
Collect any port marked as being referenced via symbol.
Definition at line 6559 of file ExportVerilog.cpp.
References circt::hw::HWSymbolCache::addDefinition(), circt::appendPossiblyAbsolutePath(), designOp, encounteredError, fileMapping, files, fragmentMapping, circt::hw::HWSymbolCache::freeze(), circt::hw::InnerSymbolTable::getInnerSymbolAttrName(), circt::hw::getVerilogModuleName(), modulesContainingBinds, circt::ExportVerilog::FileInfo::ops, replicatedOps, rootFile, and symbolCache.
Referenced by exportSplitVerilogImpl(), and exportVerilogImpl().
ModuleOp circt::ExportVerilog::SharedEmitterState::designOp |
The MLIR module to emit.
Definition at line 347 of file ExportVerilogInternals.h.
Referenced by createOutputFile(), emitOps(), and gatherFiles().
std::atomic<bool> circt::ExportVerilog::SharedEmitterState::encounteredError = {} |
Whether any error has been encountered during emission.
Definition at line 365 of file ExportVerilogInternals.h.
Referenced by collectOpsForFile(), createOutputFile(), emitOps(), exportSplitVerilogImpl(), exportVerilogImpl(), and gatherFiles().
llvm::StringMap<SmallVector<StringAttr> > circt::ExportVerilog::SharedEmitterState::fileLists |
The various file lists and their contents to emit.
Definition at line 358 of file ExportVerilogInternals.h.
Referenced by exportSplitVerilogImpl(), and exportVerilogImpl().
FileMapping circt::ExportVerilog::SharedEmitterState::fileMapping |
Tracks the referenceable files through their symbol.
Definition at line 382 of file ExportVerilogInternals.h.
Referenced by emitOps(), and gatherFiles().
llvm::MapVector<StringAttr, FileInfo> circt::ExportVerilog::SharedEmitterState::files |
The additional files to emit, with the output file name as the key into the map.
Definition at line 355 of file ExportVerilogInternals.h.
Referenced by exportSplitVerilogImpl(), exportVerilogImpl(), and gatherFiles().
FragmentMapping circt::ExportVerilog::SharedEmitterState::fragmentMapping |
Tracks referenceable files through their symbol.
Definition at line 385 of file ExportVerilogInternals.h.
Referenced by collectOpsForFile(), and gatherFiles().
const GlobalNameTable circt::ExportVerilog::SharedEmitterState::globalNames |
Information about renamed global symbols, parameters, etc.
Definition at line 379 of file ExportVerilogInternals.h.
Referenced by emitOps().
SmallPtrSet<Operation *, 8> circt::ExportVerilog::SharedEmitterState::modulesContainingBinds |
This is a set is populated at "gather" time, containing the hw.module operations that have a sv.bind in them.
Definition at line 376 of file ExportVerilogInternals.h.
Referenced by emitOps(), and gatherFiles().
const LoweringOptions& circt::ExportVerilog::SharedEmitterState::options |
Definition at line 372 of file ExportVerilogInternals.h.
Referenced by collectOpsForFile(), createSplitOutputFile(), emitOps(), exportSplitVerilogImpl(), and exportVerilogImpl().
SmallVector<Operation *, 0> circt::ExportVerilog::SharedEmitterState::replicatedOps |
A list of operations replicated in each output file (e.g., sv.verbatim
or sv.ifdef
without dedicated output file).
Definition at line 362 of file ExportVerilogInternals.h.
Referenced by collectOpsForFile(), and gatherFiles().
FileInfo circt::ExportVerilog::SharedEmitterState::rootFile |
The main file that collects all operations that are neither replicated per-file ops nor specifically assigned to a file.
Definition at line 351 of file ExportVerilogInternals.h.
Referenced by exportVerilogImpl(), and gatherFiles().
hw::HWSymbolCache circt::ExportVerilog::SharedEmitterState::symbolCache |
A cache of symbol -> defining ops built once and used by each of the verilog module emitters.
This is built at "gatherFiles" time.
Definition at line 369 of file ExportVerilogInternals.h.
Referenced by emitOps(), and gatherFiles().