LLVM 19.0.0git
DomPrinter.h
Go to the documentation of this file.
1//===-- DomPrinter.h - Dom printer external interface ------------*- C++ -*-===//
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 external functions that can be called to explicitly
10// instantiate the dominance tree printer.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_ANALYSIS_DOMPRINTER_H
15#define LLVM_ANALYSIS_DOMPRINTER_H
16
19#include "llvm/IR/Dominators.h"
20#include "llvm/IR/PassManager.h"
21
22namespace llvm {
23
24template <>
26
28
29 std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph) {
30
31 BasicBlock *BB = Node->getBlock();
32
33 if (!BB)
34 return "Post dominance root node";
35
36 if (isSimple())
38
40 }
41};
42
43template <>
46
49
50 static std::string getGraphName(DominatorTree *DT) {
51 return "Dominator tree";
52 }
53
56 G->getRootNode());
57 }
58};
59
60template<>
63
66
67 static std::string getGraphName(PostDominatorTree *DT) {
68 return "Post dominator tree";
69 }
70
74 }
75};
76
77struct DomViewer final : DOTGraphTraitsViewer<DominatorTreeAnalysis, false> {
79};
80
81struct DomOnlyViewer final : DOTGraphTraitsViewer<DominatorTreeAnalysis, true> {
84};
85
86struct PostDomViewer final
87 : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, false> {
90};
91
93 : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, true> {
96};
97
98struct DomPrinter final : DOTGraphTraitsPrinter<DominatorTreeAnalysis, false> {
100};
101
102struct DomOnlyPrinter final
103 : DOTGraphTraitsPrinter<DominatorTreeAnalysis, true> {
106};
107
108struct PostDomPrinter final
109 : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, false> {
112};
113
115 : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, true> {
118};
119} // namespace llvm
120
121namespace llvm {
122 class FunctionPass;
131} // End llvm namespace
132
133#endif
basic Basic Alias true
#define G(x, y, z)
Definition: MD5.cpp:56
This header defines various interfaces for pass management in LLVM.
static bool isSimple(Instruction *I)
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
Analysis pass which computes a DominatorTree.
Definition: Dominators.h:279
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:162
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:311
Analysis pass which computes a PostDominatorTree.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
FunctionPass * createDomOnlyPrinterWrapperPassPass()
Definition: DomPrinter.cpp:218
FunctionPass * createPostDomOnlyViewerWrapperPassPass()
Definition: DomPrinter.cpp:242
FunctionPass * createPostDomViewerWrapperPassPass()
Definition: DomPrinter.cpp:238
FunctionPass * createPostDomOnlyPrinterWrapperPassPass()
Definition: DomPrinter.cpp:234
FunctionPass * createDomOnlyViewerWrapperPassPass()
Definition: DomPrinter.cpp:226
FunctionPass * createPostDomPrinterWrapperPassPass()
Definition: DomPrinter.cpp:230
FunctionPass * createDomPrinterWrapperPassPass()
FunctionPass * createDomViewerWrapperPassPass()
Definition: DomPrinter.cpp:222
DOTGraphTraits(bool isSimple=false)
Definition: DomPrinter.h:27
std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph)
Definition: DomPrinter.h:29
static std::string getGraphName(DominatorTree *DT)
Definition: DomPrinter.h:50
std::string getNodeLabel(DomTreeNode *Node, DominatorTree *G)
Definition: DomPrinter.h:54
DOTGraphTraits(bool isSimple=false)
Definition: DomPrinter.h:47
std::string getNodeLabel(DomTreeNode *Node, PostDominatorTree *G)
Definition: DomPrinter.h:71
static std::string getGraphName(PostDominatorTree *DT)
Definition: DomPrinter.h:67
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
std::string getNodeLabel(const void *, const GraphType &)
getNodeLabel - Given a node and a pointer to the top level graph, return the label to print in the no...