14#ifndef LLVM_CODEGEN_MACHINEDOMINATORS_H
15#define LLVM_CODEGEN_MACHINEDOMINATORS_H
37 this->Roots.push_back(
MBB);
74 std::unique_ptr<MachineDomTree> DT;
81 void applySplitCriticalEdges()
const;
94 applySplitCriticalEdges();
101 applySplitCriticalEdges();
102 return DT->getRoot();
106 applySplitCriticalEdges();
107 return DT->getRootNode();
116 applySplitCriticalEdges();
117 return DT->dominates(
A,
B);
122 applySplitCriticalEdges();
123 DT->getDescendants(
A, Result);
127 applySplitCriticalEdges();
128 return DT->dominates(
A,
B);
134 applySplitCriticalEdges();
136 if (BBA != BBB)
return DT->dominates(BBA, BBB);
140 for (; &*
I !=
A && &*
I !=
B; ++
I)
148 applySplitCriticalEdges();
149 return DT->properlyDominates(
A,
B);
154 applySplitCriticalEdges();
155 return DT->properlyDominates(
A,
B);
162 applySplitCriticalEdges();
163 return DT->findNearestCommonDominator(
A,
B);
167 applySplitCriticalEdges();
168 return DT->getNode(BB);
175 applySplitCriticalEdges();
176 return DT->getNode(BB);
184 applySplitCriticalEdges();
185 return DT->addNewBlock(BB, DomBB);
193 applySplitCriticalEdges();
194 DT->changeImmediateDominator(
N, NewIDom);
199 applySplitCriticalEdges();
200 DT->changeImmediateDominator(
N, NewIDom);
207 applySplitCriticalEdges();
214 applySplitCriticalEdges();
215 DT->splitBlock(NewBB);
221 applySplitCriticalEdges();
222 return DT->isReachableFromEntry(
A);
225 void releaseMemory()
override;
227 void verifyAnalysis()
const override;
246 bool Inserted = NewBBs.
insert(NewBB).second;
249 "A basic block inserted via edge splitting cannot appear twice");
250 CriticalEdgesToSplit.
push_back({FromBB, ToBB, NewBB});
259template <
class Node,
class ChildIterator>
269template <
class T>
struct GraphTraits;
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
Generic dominator tree construction - this file provides routines to construct immediate dominator in...
This file defines a set of templates that efficiently compute a dominator tree over a generic graph.
Machine Check Debug Module
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallSet class.
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
Base class for the actual dominator tree node.
typename SmallVector< DomTreeNodeBase *, 4 >::const_iterator const_iterator
Core dominator tree base class.
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
bool dominates(const MachineBasicBlock *A, const MachineBasicBlock *B) const
bool dominates(const MachineInstr *A, const MachineInstr *B) const
void changeImmediateDominator(MachineDomTreeNode *N, MachineDomTreeNode *NewIDom)
MachineBasicBlock * findNearestCommonDominator(MachineBasicBlock *A, MachineBasicBlock *B)
findNearestCommonDominator - Find nearest common dominator basic block for basic block A and B.
MachineDomTreeNode * addNewBlock(MachineBasicBlock *BB, MachineBasicBlock *DomBB)
addNewBlock - Add a new node to the dominator tree information.
bool isReachableFromEntry(const MachineBasicBlock *A)
isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it...
MachineDomTreeNode * getRootNode() const
MachineDomTreeNode * getNode(MachineBasicBlock *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
void eraseNode(MachineBasicBlock *BB)
eraseNode - Removes a node from the dominator tree.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool dominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
bool properlyDominates(const MachineBasicBlock *A, const MachineBasicBlock *B) const
void getDescendants(MachineBasicBlock *A, SmallVectorImpl< MachineBasicBlock * > &Result)
void splitBlock(MachineBasicBlock *NewBB)
splitBlock - BB is split and now it has one successor.
bool properlyDominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
MachineBasicBlock * getRoot() const
void changeImmediateDominator(MachineBasicBlock *N, MachineBasicBlock *NewIDom)
changeImmediateDominator - This method is used to update the dominator tree information when a node's...
MachineDominatorTree(MachineFunction &MF)
void recordSplitCriticalEdge(MachineBasicBlock *FromBB, MachineBasicBlock *ToBB, MachineBasicBlock *NewBB)
Record that the critical edge (FromBB, ToBB) has been split with NewBB.
MachineDomTreeNode * operator[](MachineBasicBlock *BB) const
MachineDomTree & getBase()
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
DomTreeBase< MachineBasicBlock > MachineDomTree
DomTreeNodeBase< MachineBasicBlock > MachineDomTreeNode
static NodeRef getEntryNode(MachineDominatorTree *DT)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
ChildIterator ChildIteratorType
static ChildIteratorType child_end(NodeRef N)
static NodeRef getEntryNode(NodeRef N)
static ChildIteratorType child_begin(NodeRef N)