@@ -44,6 +44,8 @@ using MachineDomTreeNode = DomTreeNodeBase<MachineBasicBlock>;
44
44
// / compute a normal dominator tree.
45
45
// /
46
46
class MachineDominatorTree : public MachineFunctionPass {
47
+ using DomTreeT = DomTreeBase<MachineBasicBlock>;
48
+
47
49
// / Helper structure used to hold all the basic blocks
48
50
// / involved in the split of a critical edge.
49
51
struct CriticalEdge {
@@ -65,8 +67,8 @@ class MachineDominatorTree : public MachineFunctionPass {
65
67
// / such as BB == elt.NewBB.
66
68
mutable SmallSet<MachineBasicBlock *, 32 > NewBBs;
67
69
68
- // / The DominatorTreeBase that is used to compute a normal dominator tree
69
- std::unique_ptr<DomTreeBase<MachineBasicBlock> > DT;
70
+ // / The DominatorTreeBase that is used to compute a normal dominator tree.
71
+ std::unique_ptr<DomTreeT > DT;
70
72
71
73
// / Apply all the recorded critical edges to the DT.
72
74
// / This updates the underlying DT information in a way that uses
@@ -80,8 +82,8 @@ class MachineDominatorTree : public MachineFunctionPass {
80
82
81
83
MachineDominatorTree ();
82
84
83
- DomTreeBase<MachineBasicBlock> &getBase () {
84
- if (!DT) DT.reset (new DomTreeBase<MachineBasicBlock> ());
85
+ DomTreeT &getBase () {
86
+ if (!DT) DT.reset (new DomTreeT ());
85
87
applySplitCriticalEdges ();
86
88
return *DT;
87
89
}
@@ -92,31 +94,30 @@ class MachineDominatorTree : public MachineFunctionPass {
92
94
// / multiple blocks if we are computing post dominators. For forward
93
95
// / dominators, this will always be a single block (the entry node).
94
96
// /
95
- inline const SmallVectorImpl<MachineBasicBlock*> &getRoots () const {
97
+ const SmallVectorImpl<MachineBasicBlock*> &getRoots () const {
96
98
applySplitCriticalEdges ();
97
99
return DT->getRoots ();
98
100
}
99
101
100
- inline MachineBasicBlock *getRoot () const {
102
+ MachineBasicBlock *getRoot () const {
101
103
applySplitCriticalEdges ();
102
104
return DT->getRoot ();
103
105
}
104
106
105
- inline MachineDomTreeNode *getRootNode () const {
107
+ MachineDomTreeNode *getRootNode () const {
106
108
applySplitCriticalEdges ();
107
109
return DT->getRootNode ();
108
110
}
109
111
110
112
bool runOnMachineFunction (MachineFunction &F) override ;
111
113
112
- inline bool dominates (const MachineDomTreeNode* A,
113
- const MachineDomTreeNode* B) const {
114
+ bool dominates (const MachineDomTreeNode * A,
115
+ const MachineDomTreeNode * B) const {
114
116
applySplitCriticalEdges ();
115
117
return DT->dominates (A, B);
116
118
}
117
119
118
- inline bool dominates (const MachineBasicBlock* A,
119
- const MachineBasicBlock* B) const {
120
+ bool dominates (const MachineBasicBlock *A, const MachineBasicBlock *B) const {
120
121
applySplitCriticalEdges ();
121
122
return DT->dominates (A, B);
122
123
}
@@ -133,83 +134,77 @@ class MachineDominatorTree : public MachineFunctionPass {
133
134
for (; &*I != A && &*I != B; ++I)
134
135
/* empty*/ ;
135
136
136
- // if(!DT.IsPostDominators) {
137
- // A dominates B if it is found first in the basic block.
138
- return &*I == A;
139
- // } else {
140
- // // A post-dominates B if B is found first in the basic block.
141
- // return &*I == B;
142
- // }
137
+ return &*I == A;
143
138
}
144
139
145
- inline bool properlyDominates (const MachineDomTreeNode* A,
146
- const MachineDomTreeNode* B) const {
140
+ bool properlyDominates (const MachineDomTreeNode * A,
141
+ const MachineDomTreeNode * B) const {
147
142
applySplitCriticalEdges ();
148
143
return DT->properlyDominates (A, B);
149
144
}
150
145
151
- inline bool properlyDominates (const MachineBasicBlock* A,
152
- const MachineBasicBlock* B) const {
146
+ bool properlyDominates (const MachineBasicBlock * A,
147
+ const MachineBasicBlock * B) const {
153
148
applySplitCriticalEdges ();
154
149
return DT->properlyDominates (A, B);
155
150
}
156
151
157
152
// / findNearestCommonDominator - Find nearest common dominator basic block
158
153
// / for basic block A and B. If there is no such block then return NULL.
159
- inline MachineBasicBlock *findNearestCommonDominator (MachineBasicBlock *A,
160
- MachineBasicBlock *B) {
154
+ MachineBasicBlock *findNearestCommonDominator (MachineBasicBlock *A,
155
+ MachineBasicBlock *B) {
161
156
applySplitCriticalEdges ();
162
157
return DT->findNearestCommonDominator (A, B);
163
158
}
164
159
165
- inline MachineDomTreeNode *operator [](MachineBasicBlock *BB) const {
160
+ MachineDomTreeNode *operator [](MachineBasicBlock *BB) const {
166
161
applySplitCriticalEdges ();
167
162
return DT->getNode (BB);
168
163
}
169
164
170
165
// / getNode - return the (Post)DominatorTree node for the specified basic
171
166
// / block. This is the same as using operator[] on this class.
172
167
// /
173
- inline MachineDomTreeNode *getNode (MachineBasicBlock *BB) const {
168
+ MachineDomTreeNode *getNode (MachineBasicBlock *BB) const {
174
169
applySplitCriticalEdges ();
175
170
return DT->getNode (BB);
176
171
}
177
172
178
173
// / addNewBlock - Add a new node to the dominator tree information. This
179
174
// / creates a new node as a child of DomBB dominator node,linking it into
180
175
// / the children list of the immediate dominator.
181
- inline MachineDomTreeNode *addNewBlock (MachineBasicBlock *BB,
182
- MachineBasicBlock *DomBB) {
176
+ MachineDomTreeNode *addNewBlock (MachineBasicBlock *BB,
177
+ MachineBasicBlock *DomBB) {
183
178
applySplitCriticalEdges ();
184
179
return DT->addNewBlock (BB, DomBB);
185
180
}
186
181
187
182
// / changeImmediateDominator - This method is used to update the dominator
188
183
// / tree information when a node's immediate dominator changes.
189
184
// /
190
- inline void changeImmediateDominator (MachineBasicBlock *N,
191
- MachineBasicBlock* NewIDom) {
185
+ void changeImmediateDominator (MachineBasicBlock *N,
186
+ MachineBasicBlock * NewIDom) {
192
187
applySplitCriticalEdges ();
193
188
DT->changeImmediateDominator (N, NewIDom);
194
189
}
195
190
196
- inline void changeImmediateDominator (MachineDomTreeNode *N,
197
- MachineDomTreeNode* NewIDom) {
191
+ void changeImmediateDominator (MachineDomTreeNode *N,
192
+ MachineDomTreeNode * NewIDom) {
198
193
applySplitCriticalEdges ();
199
194
DT->changeImmediateDominator (N, NewIDom);
200
195
}
201
196
202
197
// / eraseNode - Removes a node from the dominator tree. Block must not
203
198
// / dominate any other blocks. Removes node from its immediate dominator's
204
199
// / children list. Deletes dominator node associated with basic block BB.
205
- inline void eraseNode (MachineBasicBlock *BB) {
200
+ void eraseNode (MachineBasicBlock *BB) {
206
201
applySplitCriticalEdges ();
207
202
DT->eraseNode (BB);
208
203
}
209
204
210
205
// / splitBlock - BB is split and now it has one successor. Update dominator
211
206
// / tree to reflect this change.
212
- inline void splitBlock (MachineBasicBlock* NewBB) {
207
+ void splitBlock (MachineBasicBlock* NewBB) {
213
208
applySplitCriticalEdges ();
214
209
DT->splitBlock (NewBB);
215
210
}
0 commit comments