31 #ifdef EXPENSIVE_CHECKS
38 cl::desc(
"Verify dominator info (time consuming)"));
42 unsigned NumEdgesToEnd = 0;
46 if (NumEdgesToEnd >= 2)
49 assert(NumEdgesToEnd == 1);
68 typename std::remove_pointer<GraphTraits<BasicBlock *>::NodeRef>::type>
71 template void llvm::Calculate<Function, Inverse<BasicBlock *>>(
100 if (isa<InvokeInst>(Def) || isa<PHINode>(User))
108 for (; &*I != Def && &*I != User; ++
I)
133 if (
const auto *II = dyn_cast<InvokeInst>(Def)) {
148 "This function is not efficient in handling multiple edges");
199 "This function is not efficient in handling multiple edges");
204 if (PN && PN->getParent() == BBE.
getEnd() &&
205 PN->getIncomingBlock(U) == BBE.
getStart())
212 UseBB = PN->getIncomingBlock(U);
226 if (
PHINode *PN = dyn_cast<PHINode>(UserInst))
227 UseBB = PN->getIncomingBlock(U);
244 if (
const InvokeInst *II = dyn_cast<InvokeInst>(Def)) {
258 if (isa<PHINode>(UserInst))
263 for (; &*I != Def && &*I != UserInst; ++
I)
266 return &*I != UserInst;
277 if (
PHINode *PN = dyn_cast<PHINode>(I))
290 errs() <<
"DominatorTree is not up to date!\nComputed:\n";
292 errs() <<
"\nActual:\n";
320 OS <<
"DominatorTree for function: " << F.
getName() <<
"\n";
344 "Dominator Tree Construction",
true,
true)
bool compare(const DominatorTree &Other) const
Returns false if the other dominator tree matches this dominator tree.
static bool VerifyDomInfo
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
A Module instance is used to store all the information related to an LLVM module. ...
template void Calculate< Function, BasicBlock * >(DominatorTreeBaseByGraphTraits< GraphTraits< BasicBlock * >> &DT, Function &F)
const BasicBlock * getStart() const
const Function * getParent() const
Return the enclosing method, or null if none.
Analysis pass which computes a DominatorTree.
StringRef getName() const
Return a constant reference to the value's name.
iterator begin()
Instruction iterator methods.
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
A Use represents the edge between a Value definition and its users.
bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
Base class for the actual dominator tree node.
DominatorTreePrinterPass(raw_ostream &OS)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
unsigned getNumSuccessors() const
Return the number of successors that this terminator has.
Subclasses of this class are all able to terminate a basic block.
A set of analyses that are preserved following a run of a transformation pass.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
LLVM Basic Block Representation.
BasicBlock * getSuccessor(unsigned idx) const
Return the specified successor.
DominatorTree run(Function &F, FunctionAnalysisManager &)
Run the analysis pass over a function and produce a dominator tree.
Interval::pred_iterator pred_begin(Interval *I)
pred_begin/pred_end - define methods so that Intervals may be used just like BasicBlocks can with the...
static const unsigned End
User * getUser() const
Returns the User that contains this Use.
Interval::pred_iterator pred_end(Interval *I)
void verifyDomTree() const
Verify the correctness of the domtree by re-computing it.
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
static cl::opt< bool, true > VerifyDomInfoX("verify-dom-info", cl::location(VerifyDomInfo), cl::desc("Verify dominator info (time consuming)"))
const BasicBlock * getEnd() const
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
Iterator for intrusive lists based on ilist_node.
Generic dominator tree construction - This file provides routines to construct immediate dominator in...
void print(raw_ostream &OS, const Module *M=nullptr) const override
print - Print out the internal state of the pass.
BasicBlock * getSinglePredecessor()
Return the predecessor of this block if it has a single predecessor block.
INITIALIZE_PASS(DominatorTreeWrapperPass,"domtree","Dominator Tree Construction", true, true) bool DominatorTreeWrapperPass
void print(raw_ostream &o) const
print - Convert to human readable form
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
bool isSingleEdge() const
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
This class implements an extremely fast bulk output stream that can only output to a stream...
void recalculate(FT &F)
recalculate - compute a dominator tree for the given function
A container for analyses that lazily runs them and caches their results.
Legacy analysis pass which computes a DominatorTree.
This header defines various interfaces for pass management in LLVM.
A special type used by analysis passes to provide an address that identifies that particular analysis...
LocationClass< Ty > location(Ty &L)
const BasicBlock * getParent() const
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)