[UpdateCCTestChecks] Detect function mangled name on separate line
[llvm-core.git] / tools / opt / GraphPrinters.cpp
blob611fb20513c96ce486a7cbb965be8ee7807974c9
1 //===- GraphPrinters.cpp - DOT printers for various graph types -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines several printers for various different types of graphs used
10 // by the LLVM infrastructure. It uses the generic graph interface to convert
11 // the graph into a .dot graph. These graphs can then be processed with the
12 // "dot" tool to convert them to postscript or some other suitable format.
14 //===----------------------------------------------------------------------===//
16 #include "llvm/IR/Dominators.h"
17 #include "llvm/Pass.h"
19 using namespace llvm;
21 //===----------------------------------------------------------------------===//
22 // DomInfoPrinter Pass
23 //===----------------------------------------------------------------------===//
25 namespace {
26 class DomInfoPrinter : public FunctionPass {
27 public:
28 static char ID; // Pass identification, replacement for typeid
29 DomInfoPrinter() : FunctionPass(ID) {}
31 void getAnalysisUsage(AnalysisUsage &AU) const override {
32 AU.setPreservesAll();
33 AU.addRequired<DominatorTreeWrapperPass>();
36 bool runOnFunction(Function &F) override {
37 getAnalysis<DominatorTreeWrapperPass>().print(dbgs());
38 return false;
43 char DomInfoPrinter::ID = 0;
44 static RegisterPass<DomInfoPrinter>
45 DIP("print-dom-info", "Dominator Info Printer", true, true);