14#ifndef LLVM_CODEGEN_MACHINEDOMINATORS_H
15#define LLVM_CODEGEN_MACHINEDOMINATORS_H
38 this->Roots.push_back(
MBB);
46namespace DomTreeBuilder {
51extern template void Calculate<MBBDomTree>(
MBBDomTree &DT);
52extern template void CalculateWithUpdates<MBBDomTree>(
MBBDomTree &DT,
55extern template void InsertEdge<MBBDomTree>(
MBBDomTree &DT,
59extern template void DeleteEdge<MBBDomTree>(
MBBDomTree &DT,
63extern template void ApplyUpdates<MBBDomTree>(
MBBDomTree &DT,
67extern template bool Verify<MBBDomTree>(
const MBBDomTree &DT,
103 void applySplitCriticalEdges()
const;
119 applySplitCriticalEdges();
124 applySplitCriticalEdges();
125 return Base::getRoot();
129 applySplitCriticalEdges();
137 applySplitCriticalEdges();
138 return Base::dominates(
A,
B);
143 applySplitCriticalEdges();
144 Base::getDescendants(
A, Result);
148 applySplitCriticalEdges();
149 return Base::dominates(
A,
B);
155 applySplitCriticalEdges();
158 return Base::dominates(BBA, BBB);
162 for (; &*
I !=
A && &*
I !=
B; ++
I)
170 applySplitCriticalEdges();
171 return Base::properlyDominates(
A,
B);
176 applySplitCriticalEdges();
177 return Base::properlyDominates(
A,
B);
184 applySplitCriticalEdges();
185 return Base::findNearestCommonDominator(
A,
B);
189 applySplitCriticalEdges();
190 return Base::getNode(BB);
197 applySplitCriticalEdges();
198 return Base::getNode(BB);
206 applySplitCriticalEdges();
207 return Base::addNewBlock(BB, DomBB);
215 applySplitCriticalEdges();
216 Base::changeImmediateDominator(
N, NewIDom);
221 applySplitCriticalEdges();
222 Base::changeImmediateDominator(
N, NewIDom);
229 applySplitCriticalEdges();
236 applySplitCriticalEdges();
237 Base::splitBlock(NewBB);
243 applySplitCriticalEdges();
244 return Base::isReachableFromEntry(
A);
262 bool Inserted = NewBBs.
insert(NewBB).second;
265 "A basic block inserted via edge splitting cannot appear twice");
266 CriticalEdgesToSplit.
push_back({FromBB, ToBB, NewBB});
299 std::optional<MachineDominatorTree> DT;
311 void verifyAnalysis()
const override;
318 void releaseMemory()
override;
328template <
class Node,
class ChildIterator>
338template <
class T>
struct GraphTraits;
BlockVerifier::State From
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
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.
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Base class for the actual dominator tree node.
typename SmallVector< DomTreeNodeBase *, 4 >::const_iterator const_iterator
Core dominator tree base class.
Analysis pass which computes a MachineDominatorTree.
Machine function pass which print MachineDominatorTree.
MachineDominatorTreePrinterPass(raw_ostream &OS)
Analysis pass which computes a MachineDominatorTree.
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
const MachineDominatorTree & getDomTree() const
MachineDominatorTreeWrapperPass()
MachineDominatorTree & getDomTree()
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.
MachineDominatorTree()=default
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
MachineDominatorTree & getBase()
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
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
Representation of each machine instruction.
A Module instance is used to store all the information related to an LLVM module.
A set of analyses that are preserved following a run of a transformation pass.
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)
DomTreeNodeBase< MachineBasicBlock > MachineDomTreeNode
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
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)
A CRTP mix-in to automatically provide informational APIs needed for passes.