LLVM  4.0.0
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 
16 #include "llvm/ADT/SetOperations.h"
17 #include "llvm/IR/CFG.h"
18 #include "llvm/IR/Instructions.h"
19 #include "llvm/IR/PassManager.h"
20 #include "llvm/Support/Debug.h"
22 using namespace llvm;
23 
24 #define DEBUG_TYPE "postdomtree"
25 
26 //===----------------------------------------------------------------------===//
27 // PostDominatorTree Implementation
28 //===----------------------------------------------------------------------===//
29 
32  "Post-Dominator Tree Construction", true, true)
33 
35  DT.recalculate(F);
36  return false;
37 }
38 
40  DT.print(OS);
41 }
42 
44  return new PostDominatorTreeWrapperPass();
45 }
46 
47 AnalysisKey PostDominatorTreeAnalysis::Key;
48 
52  PDT.recalculate(F);
53  return PDT;
54 }
55 
57  : OS(OS) {}
58 
61  OS << "PostDominatorTree for function: " << F.getName() << "\n";
62  AM.getResult<PostDominatorTreeAnalysis>(F).print(OS);
63 
64  return PreservedAnalyses::all();
65 }
PostDominatorTree run(Function &F, FunctionAnalysisManager &)
Run the analysis pass over a function and produce a post dominator tree.
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
PostDominatorTreePrinterPass(raw_ostream &OS)
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:191
#define F(x, y, z)
Definition: MD5.cpp:51
A set of analyses that are preserved following a run of a transformation pass.
Definition: PassManager.h:107
PassT::Result & getResult(IRUnitT &IR, ExtraArgTs...ExtraArgs)
Get the result of an analysis pass for a given IR unit.
Definition: PassManager.h:653
INITIALIZE_PASS(PostDominatorTreeWrapperPass,"postdomtree","Post-Dominator Tree Construction", true, true) bool PostDominatorTreeWrapperPass
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:298
static PreservedAnalyses all()
Construct a special preserved set that preserves all passes.
Definition: PassManager.h:113
Generic dominator tree construction - This file provides routines to construct immediate dominator in...
Analysis pass which computes a PostDominatorTree.
PostDominatorTree Class - Concrete subclass of DominatorTree that is used to compute the post-dominat...
void print(raw_ostream &o) const
print - Convert to human readable form
FunctionPass * createPostDomTree()
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
void recalculate(FT &F)
recalculate - compute a dominator tree for the given function
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:64