15 #include "mlir/Pass/Pass.h"
16 #include "llvm/Support/GraphWriter.h"
17 #include "llvm/Support/raw_ostream.h"
21 #define GEN_PASS_DEF_PRINTINSTANCEGRAPH
22 #include "circt/Dialect/FIRRTL/Passes.h.inc"
26 using namespace circt;
27 using namespace firrtl;
30 struct PrintInstanceGraphPass
31 :
public circt::firrtl::impl::PrintInstanceGraphBase<
32 PrintInstanceGraphPass> {
33 PrintInstanceGraphPass(raw_ostream &os) : os(os) {}
34 void runOnOperation()
override {
35 auto circuitOp = getOperation();
36 auto &instanceGraph = getAnalysis<InstanceGraph>();
37 llvm::WriteGraph(os, &instanceGraph,
false,
39 markAllAnalysesPreserved();
46 return std::make_unique<PrintInstanceGraphPass>(llvm::errs());
std::unique_ptr< mlir::Pass > createPrintInstanceGraphPass()
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.