Go to the documentation of this file.
14 #ifndef LLVM_CODEGEN_MACHINEDOMINATORS_H
15 #define LLVM_CODEGEN_MACHINEDOMINATORS_H
30 class MachineFunction;
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});
259 template <
class Node,
class ChildIterator>
269 template <
class T>
struct GraphTraits;
292 #endif // LLVM_CODEGEN_MACHINEDOMINATORS_H
MachineBasicBlock * findNearestCommonDominator(MachineBasicBlock *A, MachineBasicBlock *B)
findNearestCommonDominator - Find nearest common dominator basic block for basic block A and B.
This is an optimization pass for GlobalISel generic memory operations.
void changeImmediateDominator(MachineDomTreeNode *N, MachineDomTreeNode *NewIDom)
bool dominates(const MachineInstr *A, const MachineInstr *B) const
bool properlyDominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
static NodeRef getEntryNode(MachineDominatorTree *DT)
static ChildIteratorType child_begin(NodeRef N)
void getDescendants(MachineBasicBlock *A, SmallVectorImpl< MachineBasicBlock * > &Result)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
MachineDomTreeNode * getRootNode() const
bool dominates(const MachineDomTreeNode *A, const MachineDomTreeNode *B) const
DomTreeBase< MachineBasicBlock > MachineDomTree
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...
Represent the analysis usage information of a pass.
void changeImmediateDominator(MachineBasicBlock *N, MachineBasicBlock *NewIDom)
changeImmediateDominator - This method is used to update the dominator tree information when a node's...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
This class implements an extremely fast bulk output stream that can only output to a stream.
MachineBasicBlock * getRoot() const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
DomTreeNodeBase< MachineBasicBlock > MachineDomTreeNode
Representation of each machine instruction.
static NodeRef getEntryNode(NodeRef N)
MachineDomTreeNode * getNode(MachineBasicBlock *BB) const
getNode - return the (Post)DominatorTree node for the specified basic block.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
MachineDomTreeNode::const_iterator ChildIteratorType
A Module instance is used to store all the information related to an LLVM module.
Printable print(const GCNRegPressure &RP, const GCNSubtarget *ST=nullptr)
void eraseNode(MachineBasicBlock *BB)
eraseNode - Removes a node from the dominator tree.
MachineDomTreeNode * operator[](MachineBasicBlock *BB) const
void splitBlock(MachineBasicBlock *NewBB)
splitBlock - BB is split and now it has one successor.
Machine Check Debug Module
Core dominator tree base class.
Base class for the actual dominator tree node.
bool dominates(const MachineBasicBlock *A, const MachineBasicBlock *B) const
MachineDominatorTree(MachineFunction &MF)
void recordSplitCriticalEdge(MachineBasicBlock *FromBB, MachineBasicBlock *ToBB, MachineBasicBlock *NewBB)
Record that the critical edge (FromBB, ToBB) has been split with NewBB.
std::pair< const_iterator, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
typename SmallVector< DomTreeNodeBase *, 4 >::const_iterator const_iterator
MachineDomTree & getBase()
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
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
DominatorTree Class - Concrete subclass of DominatorTreeBase that is used to compute a normal dominat...
static ChildIteratorType child_end(NodeRef N)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
bool properlyDominates(const MachineBasicBlock *A, const MachineBasicBlock *B) const