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. More... | |
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". More... | |
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. More... | |
Public Attributes | |
ModuleOp | designOp |
The MLIR module to emit. More... | |
FileInfo | rootFile |
The main file that collects all operations that are neither replicated per-file ops nor specifically assigned to a file. More... | |
llvm::MapVector< StringAttr, FileInfo > | files |
The additional files to emit, with the output file name as the key into the map. More... | |
llvm::StringMap< SmallVector< StringAttr > > | fileLists |
The various file lists and their contents to emit. More... | |
SmallVector< Operation *, 0 > | replicatedOps |
A list of operations replicated in each output file (e.g., sv.verbatim or sv.ifdef without dedicated output file). More... | |
std::atomic< bool > | encounteredError = {} |
Whether any error has been encountered during emission. More... | |
hw::HWSymbolCache | symbolCache |
A cache of symbol -> defining ops built once and used by each of the verilog module emitters. More... | |
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. More... | |
const GlobalNameTable | globalNames |
Information about renamed global symbols, parameters, etc. More... | |
FileMapping | fileMapping |
Tracks the referenceable files through their symbol. More... | |
FragmentMapping | fragmentMapping |
Tracks referenceable files through their symbol. More... | |
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 344 of file ExportVerilogInternals.h.
using circt::ExportVerilog::SharedEmitterState::EmissionList = std::vector<StringOrOpToEmit> |
Definition at line 392 of file ExportVerilogInternals.h.
|
inlineexplicit |
Definition at line 386 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 6768 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 6855 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 6557 of file ExportVerilog.cpp.
References circt::hw::HWSymbolCache::addDefinition(), append(), circt::appendPossiblyAbsolutePath(), designOp, encounteredError, fileMapping, files, fragmentMapping, circt::hw::HWSymbolCache::freeze(), circt::calyx::direction::get(), circt::hw::InnerSymbolTable::getInnerSymbolAttrName(), 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 346 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 364 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 357 of file ExportVerilogInternals.h.
Referenced by exportSplitVerilogImpl(), and exportVerilogImpl().
FileMapping circt::ExportVerilog::SharedEmitterState::fileMapping |
Tracks the referenceable files through their symbol.
Definition at line 381 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 354 of file ExportVerilogInternals.h.
Referenced by exportSplitVerilogImpl(), exportVerilogImpl(), and gatherFiles().
FragmentMapping circt::ExportVerilog::SharedEmitterState::fragmentMapping |
Tracks referenceable files through their symbol.
Definition at line 384 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 378 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 375 of file ExportVerilogInternals.h.
Referenced by emitOps(), and gatherFiles().
const LoweringOptions& circt::ExportVerilog::SharedEmitterState::options |
Definition at line 371 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 361 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 350 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 368 of file ExportVerilogInternals.h.
Referenced by emitOps(), and gatherFiles().