LLVM  6.0.0svn
PostDominators.cpp
Go to the documentation of this file.
1 //===- PostDominators.cpp - Post-Dominator Calculation --------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the post-dominator construction algorithms.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "llvm/IR/Function.h"
16 #include "llvm/IR/PassManager.h"
17 #include "llvm/Pass.h"
19 
20 using namespace llvm;
21 
22 #define DEBUG_TYPE "postdomtree"
23 
24 //===----------------------------------------------------------------------===//
25 // PostDominatorTree Implementation
26 //===----------------------------------------------------------------------===//
27 
29 
31  "Post-Dominator Tree Construction", true, true)
32 
34  FunctionAnalysisManager::Invalidator &) {
35  // Check whether the analysis, all analyses on functions, or the function's
36  // CFG have been preserved.
37  auto PAC = PA.getChecker<PostDominatorTreeAnalysis>();
38  return !(PAC.preserved() || PAC.preservedSet<AllAnalysesOn<Function>>() ||
39  PAC.preservedSet<CFGAnalyses>());
40 }
41 
43  DT.recalculate(F);
44  return false;
45 }
46 
48  DT.print(OS);
49 }
50 
52  return new PostDominatorTreeWrapperPass();
53 }
54 
55 AnalysisKey PostDominatorTreeAnalysis::Key;
56 
60  PDT.recalculate(F);
61  return PDT;
62 }
63 
65  : OS(OS) {}
66 
69  OS << "PostDominatorTree for function: " << F.getName() << "\n";
71 
72  return PreservedAnalyses::all();
73 }
PostDominatorTree run(Function &F, FunctionAnalysisManager &)
Run the analysis pass over a function and produce a post dominator tree.
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs... ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:687
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:63
void recalculate(ParentType &Func)
recalculate - compute a dominator tree for the given function
PostDominatorTreePrinterPass(raw_ostream &OS)
F(f)
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:153
void print(raw_ostream &OS, const Module *) const override
print - Print out the internal state of the pass.
FunctionPass class - This class is used to implement most global optimizations.
Definition: Pass.h:285
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
INITIALIZE_PASS(PostDominatorTreeWrapperPass, "postdomtree", "Post-Dominator Tree Construction", true, true) bool PostDominatorTree
bool runOnFunction(Function &F) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:159
void print(raw_ostream &O) const
print - Convert to human readable form
Analysis pass which computes a PostDominatorTree.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
Represents analyses that only rely on functions&#39; control flow.
Definition: PassManager.h:114
StringRef getName() const
Return a constant reference to the value&#39;s name.
Definition: Value.cpp:220
This templated class represents "all analyses that operate over <a particular IR unit>" (e...
Definition: PassManager.h:91
FunctionPass * createPostDomTree()
aarch64 promote const
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
A container for analyses that lazily runs them and caches their results.
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...
Definition: PassManager.h:70