LLVM  15.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 
22 namespace llvm {
23 
24 template <>
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 
43 template <>
46 
47  DOTGraphTraits(bool isSimple = false)
49 
50  static std::string getGraphName(DominatorTree *DT) {
51  return "Dominator tree";
52  }
53 
56  G->getRootNode());
57  }
58 };
59 
60 template<>
63 
64  DOTGraphTraits (bool isSimple=false)
66 
67  static std::string getGraphName(PostDominatorTree *DT) {
68  return "Post dominator tree";
69  }
70 
73  return DOTGraphTraits<DomTreeNode*>::getNodeLabel(Node, G->getRootNode());
74  }
75 };
76 
77 struct DomViewer final : DOTGraphTraitsViewer<DominatorTreeAnalysis, false> {
79 };
80 
81 struct DomOnlyViewer final : DOTGraphTraitsViewer<DominatorTreeAnalysis, true> {
84 };
85 
86 struct PostDomViewer final
87  : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, false> {
90 };
91 
92 struct PostDomOnlyViewer final
93  : DOTGraphTraitsViewer<PostDominatorTreeAnalysis, true> {
96 };
97 
98 struct DomPrinter final : DOTGraphTraitsPrinter<DominatorTreeAnalysis, false> {
100 };
101 
102 struct DomOnlyPrinter final
103  : DOTGraphTraitsPrinter<DominatorTreeAnalysis, true> {
106 };
107 
108 struct PostDomPrinter final
109  : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, false> {
112 };
113 
114 struct PostDomOnlyPrinter final
115  : DOTGraphTraitsPrinter<PostDominatorTreeAnalysis, true> {
118 };
119 } // namespace llvm
120 
121 namespace llvm {
122  class FunctionPass;
123  FunctionPass *createDomPrinterWrapperPassPass();
124  FunctionPass *createDomOnlyPrinterWrapperPassPass();
125  FunctionPass *createDomViewerWrapperPassPass();
126  FunctionPass *createDomOnlyViewerWrapperPassPass();
127  FunctionPass *createPostDomPrinterWrapperPassPass();
129  FunctionPass *createPostDomViewerWrapperPassPass();
131 } // End llvm namespace
132 
133 #endif
llvm::DomViewer
Definition: DomPrinter.h:77
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::PostDomPrinter
Definition: DomPrinter.h:108
llvm::DOTGraphTraits< DomTreeNode * >::getNodeLabel
std::string getNodeLabel(DomTreeNode *Node, DomTreeNode *Graph)
Definition: DomPrinter.h:29
llvm::createPostDomOnlyPrinterWrapperPassPass
FunctionPass * createPostDomOnlyPrinterWrapperPassPass()
Definition: DomPrinter.cpp:234
llvm::DOTGraphTraits< PostDominatorTree * >::getNodeLabel
std::string getNodeLabel(DomTreeNode *Node, PostDominatorTree *G)
Definition: DomPrinter.h:71
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:166
llvm::PostDomViewer::PostDomViewer
PostDomViewer()
Definition: DomPrinter.h:88
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1886
llvm::DOTGraphTraitsViewer
Definition: DOTGraphTraitsPass.h:43
llvm::createPostDomPrinterWrapperPassPass
FunctionPass * createPostDomPrinterWrapperPassPass()
Definition: DomPrinter.cpp:230
llvm::DomPrinter::DomPrinter
DomPrinter()
Definition: DomPrinter.h:99
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::createDomViewerWrapperPassPass
FunctionPass * createDomViewerWrapperPassPass()
Definition: DomPrinter.cpp:222
llvm::DOTGraphTraits< DomTreeNode * >
Definition: DomPrinter.h:25
PostDominators.h
llvm::DomOnlyPrinter
Definition: DomPrinter.h:102
false
Definition: StackSlotColoring.cpp:141
llvm::createDomOnlyPrinterWrapperPassPass
FunctionPass * createDomOnlyPrinterWrapperPassPass()
Definition: DomPrinter.cpp:218
llvm::DOTGraphTraits< DominatorTree * >::getGraphName
static std::string getGraphName(DominatorTree *DT)
Definition: DomPrinter.h:50
llvm::createPostDomViewerWrapperPassPass
FunctionPass * createPostDomViewerWrapperPassPass()
Definition: DomPrinter.cpp:238
llvm::DOTGraphTraits
DOTGraphTraits - Template class that can be specialized to customize how graphs are converted to 'dot...
Definition: DOTGraphTraits.h:166
llvm::PostDomOnlyViewer
Definition: DomPrinter.h:92
G
const DataFlowGraph & G
Definition: RDFGraph.cpp:200
llvm::DOTGraphTraits< DomTreeNode * >::DOTGraphTraits
DOTGraphTraits(bool isSimple=false)
Definition: DomPrinter.h:27
llvm::PostDomOnlyViewer::PostDomOnlyViewer
PostDomOnlyViewer()
Definition: DomPrinter.h:94
llvm::PostDomViewer
Definition: DomPrinter.h:86
llvm::PostDomOnlyPrinter::PostDomOnlyPrinter
PostDomOnlyPrinter()
Definition: DomPrinter.h:116
llvm::DOTGraphTraits< DominatorTree * >::DOTGraphTraits
DOTGraphTraits(bool isSimple=false)
Definition: DomPrinter.h:47
llvm::createDomPrinterWrapperPassPass
FunctionPass * createDomPrinterWrapperPassPass()
llvm::PostDomPrinter::PostDomPrinter
PostDomPrinter()
Definition: DomPrinter.h:110
llvm::PostDominatorTree
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
Definition: PostDominators.h:28
Node
Definition: ItaniumDemangle.h:155
llvm::DomTreeNodeBase< BasicBlock >
llvm::DomViewer::DomViewer
DomViewer()
Definition: DomPrinter.h:78
llvm::DomPrinter
Definition: DomPrinter.h:98
PassManager.h
DOTGraphTraitsPass.h
llvm::DomOnlyPrinter::DomOnlyPrinter
DomOnlyPrinter()
Definition: DomPrinter.h:104
isSimple
static bool isSimple(Instruction *I)
Definition: SLPVectorizer.cpp:664
llvm::createPostDomOnlyViewerWrapperPassPass
FunctionPass * createPostDomOnlyViewerWrapperPassPass()
Definition: DomPrinter.cpp:242
llvm::DOTGraphTraits< PostDominatorTree * >::DOTGraphTraits
DOTGraphTraits(bool isSimple=false)
Definition: DomPrinter.h:64
llvm::DominatorTreeAnalysis
Analysis pass which computes a DominatorTree.
Definition: Dominators.h:267
llvm::PostDomOnlyPrinter
Definition: DomPrinter.h:114
Dominators.h
llvm::DOTGraphTraits< PostDominatorTree * >::getGraphName
static std::string getGraphName(PostDominatorTree *DT)
Definition: DomPrinter.h:67
llvm::DefaultDOTGraphTraits::getNodeLabel
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...
Definition: DOTGraphTraits.h:76
llvm::DomOnlyViewer
Definition: DomPrinter.h:81
llvm::DOTGraphTraitsPrinter
Definition: DOTGraphTraitsPass.h:109
llvm::DefaultDOTGraphTraits
DefaultDOTGraphTraits - This class provides the default implementations of all of the DOTGraphTraits ...
Definition: DOTGraphTraits.h:28
llvm::DomOnlyViewer::DomOnlyViewer
DomOnlyViewer()
Definition: DomPrinter.h:82
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::PostDominatorTreeAnalysis
Analysis pass which computes a PostDominatorTree.
Definition: PostDominators.h:47
llvm::createDomOnlyViewerWrapperPassPass
FunctionPass * createDomOnlyViewerWrapperPassPass()
Definition: DomPrinter.cpp:226
llvm::DOTGraphTraits< DominatorTree * >::getNodeLabel
std::string getNodeLabel(DomTreeNode *Node, DominatorTree *G)
Definition: DomPrinter.h:54