LLVM  4.0.0
DominanceFrontier.cpp
Go to the documentation of this file.
1 //===- DominanceFrontier.cpp - Dominance Frontier 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 
12 #include "llvm/IR/PassManager.h"
13 
14 using namespace llvm;
15 
16 namespace llvm {
19 }
20 
22 
24  "Dominance Frontier Construction", true, true)
27  "Dominance Frontier Construction", true, true)
28 
29  DominanceFrontierWrapperPass::DominanceFrontierWrapperPass()
30  : FunctionPass(ID), DF() {
32 }
33 
35  DF.releaseMemory();
36 }
37 
39  releaseMemory();
40  DF.analyze(getAnalysis<DominatorTreeWrapperPass>().getDomTree());
41  return false;
42 }
43 
45  AU.setPreservesAll();
47 }
48 
50  DF.print(OS);
51 }
52 
53 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
55  print(dbgs());
56 }
57 #endif
58 
59 AnalysisKey DominanceFrontierAnalysis::Key;
60 
65  return DF;
66 }
67 
69  : OS(OS) {}
70 
73  OS << "DominanceFrontier for function: " << F.getName() << "\n";
74  AM.getResult<DominanceFrontierAnalysis>(F).print(OS);
75 
76  return PreservedAnalyses::all();
77 }
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds...
Definition: Compiler.h:450
A Module instance is used to store all the information related to an LLVM module. ...
Definition: Module.h:52
Analysis pass which computes a DominatorTree.
Definition: Dominators.h:189
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:191
AnalysisUsage & addRequired()
#define INITIALIZE_PASS_DEPENDENCY(depName)
Definition: PassSupport.h:53
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Analysis pass which computes a DominanceFrontier.
#define F(x, y, z)
Definition: MD5.cpp:51
Dominance Frontier Construction
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
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
Represent the analysis usage information of a pass.
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE,"Assign register bank of generic virtual registers", false, false) RegBankSelect
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
void initializeDominanceFrontierWrapperPassPass(PassRegistry &)
DominanceFrontier run(Function &F, FunctionAnalysisManager &AM)
Run the analysis pass over a function and produce a dominator tree.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
void print(raw_ostream &OS, const Module *=nullptr) const override
print - Print out the internal state of the pass.
bool runOnFunction(Function &) override
runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass...
void setPreservesAll()
Set by analyses that do not transform their input at all.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
void print(raw_ostream &OS) const
print - Convert to human readable form
This class implements an extremely fast bulk output stream that can only output to a stream...
Definition: raw_ostream.h:44
Dominance Frontier true
A container for analyses that lazily runs them and caches their results.
Legacy analysis pass which computes a DominatorTree.
Definition: Dominators.h:217
This header defines various interfaces for pass management in LLVM.
INITIALIZE_PASS_BEGIN(DominanceFrontierWrapperPass,"domfrontier","Dominance Frontier Construction", true, true) INITIALIZE_PASS_END(DominanceFrontierWrapperPass
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition: PassManager.h:64