19 #include "mlir/Pass/Pass.h"
25 #define GEN_PASS_DEF_PRINT
26 #include "circt/Dialect/SSP/SSPPasses.h.inc"
30 using namespace circt;
31 using namespace scheduling;
35 struct PrintPass :
public circt::ssp::impl::PrintBase<PrintPass> {
36 explicit PrintPass(raw_ostream &os) : os(os) {}
37 void runOnOperation()
override;
42 template <
typename ProblemT>
44 auto prob = loadProblem<ProblemT>(instOp);
48 void PrintPass::runOnOperation() {
49 auto moduleOp = getOperation();
50 for (
auto instOp : moduleOp.getOps<InstanceOp>()) {
51 StringRef probName = instOp.getProblemName();
52 if (probName ==
"Problem")
53 printInstance<Problem>(instOp, os);
54 else if (probName ==
"CyclicProblem")
55 printInstance<CyclicProblem>(instOp, os);
56 else if (probName ==
"ChainingProblem")
57 printInstance<ChainingProblem>(instOp, os);
58 else if (probName ==
"SharedOperatorsProblem")
59 printInstance<SharedOperatorsProblem>(instOp, os);
60 else if (probName ==
"ModuloProblem")
61 printInstance<ModuloProblem>(instOp, os);
62 else if (probName ==
"ChainingCyclicProblem")
63 printInstance<ChainingCyclicProblem>(instOp, os);
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 dumpAsDOT(Problem &prob, StringRef fileName)
Export prob as a DOT graph into fileName.
std::unique_ptr< mlir::Pass > createPrintPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.