LLVM 20.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
21namespace llvm {
22
23template <>
25
27
28 std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph) {
29
30 BasicBlock *BB = Node->getBlock();
31
32 if (!BB)
33 return "Post dominance root node";
34
35 if (isSimple())
37
39 }
40};
41
42template <>
45
48
49 static std::string getGraphName(DominatorTree *DT) {
50 return "Dominator tree";
51 }
52
55 G->getRootNode());
56 }
57};
58
59template<>
62
65
66 static std::string getGraphName(PostDominatorTree *DT) {
67 return "Post dominator tree";
68 }
69
73 }
74};
75
76struct DomViewer final : DOTGraphTraitsViewer<DominatorTreeAnalysis, false> {
78};
79
80struct DomOnlyViewer final : DOTGraphTraitsViewer<DominatorTreeAnalysis, true> {
83};
84
85struct PostDomViewer final
86 : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, false> {
89};
90
92 : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, true> {
95};
96
97struct DomPrinter final : DOTGraphTraitsPrinter<DominatorTreeAnalysis, false> {
99};
100
101struct DomOnlyPrinter final
102 : DOTGraphTraitsPrinter<DominatorTreeAnalysis, true> {
105};
106
107struct PostDomPrinter final
108 : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, false> {
111};
112
114 : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, true> {
117};
118} // namespace llvm
119
120namespace llvm {
121 class FunctionPass;
130} // End llvm namespace
131
132#endif
basic Basic Alias true
#define G(x, y, z)
Definition: MD5.cpp:56
static bool isSimple(Instruction *I)
LLVM Basic Block Representation.
Definition: BasicBlock.h:61
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:310
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:26
std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph)
Definition: DomPrinter.h:28
static std::string getGraphName(DominatorTree *DT)
Definition: DomPrinter.h:49
std::string getNodeLabel(DomTreeNode *Node, DominatorTree *G)
Definition: DomPrinter.h:53
DOTGraphTraits(bool isSimple=false)
Definition: DomPrinter.h:46
std::string getNodeLabel(DomTreeNode *Node, PostDominatorTree *G)
Definition: DomPrinter.h:70
static std::string getGraphName(PostDominatorTree *DT)
Definition: DomPrinter.h:66
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...