19#include "mlir/Pass/Pass.h"
25#define GEN_PASS_DEF_PRINT
26#include "circt/Dialect/SSP/SSPPasses.h.inc"
35struct PrintPass :
public circt::ssp::impl::PrintBase<PrintPass> {
36 explicit PrintPass(raw_ostream &os) : os(os) {}
37 void runOnOperation()
override;
42template <
typename ProblemT>
48void PrintPass::runOnOperation() {
49 auto moduleOp = getOperation();
50 for (
auto instOp : moduleOp.getOps<InstanceOp>()) {
51 StringRef probName = instOp.getProblemName();
52 if (probName ==
"Problem")
54 else if (probName ==
"CyclicProblem")
56 else if (probName ==
"ChainingProblem")
58 else if (probName ==
"SharedOperatorsProblem")
60 else if (probName ==
"ModuloProblem")
62 else if (probName ==
"ChainingCyclicProblem")
65 auto instName = instOp.getSymName().value_or(
"unnamed");
66 llvm::errs() <<
"ssp-print-instance: Unknown problem class '" << probName
67 <<
"' in instance '" << instName <<
"'\n";
68 return signalPassFailure();
74 return std::make_unique<PrintPass>(llvm::errs());
static void printInstance(InstanceOp instOp, raw_ostream &os)
void printInstance(std::ostream &os, const HWModule *d, std::string indent, bool details)
void dumpAsDOT(Problem &prob, StringRef fileName)
Export prob as a DOT graph into fileName.
ProblemT loadProblem(InstanceOp instOp, std::tuple< OperationPropertyTs... > opProps, std::tuple< OperatorTypePropertyTs... > oprProps, std::tuple< ResourceTypePropertyTs... > rsrcProps, std::tuple< DependencePropertyTs... > depProps, std::tuple< InstancePropertyTs... > instProps)
Construct an instance of ProblemT from instOp, and attempt to set properties from the given attribute...
std::unique_ptr< mlir::Pass > createPrintPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.