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