diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-28 20:46:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-28 20:46:05 +0000 |
commit | d30efaf56ed1e374240b4c2fe2ea7054cbd7cb52 (patch) | |
tree | d43d3f722d986d153996542d828d9afbb3aa7972 /lib/VMCore/Pass.cpp | |
parent | 3adc069c8ba2bfeec567693565f60ee116298cdf (diff) |
* Add a stub to FunctionPass so that subclasses can declare that they do not
modify the CFG. It currently does nothing, but will in the future.
* Changes to make the public PassManager.h be MUCH smaller, and devoid of
implementation details. Now PassManager is just a Pimpl class that wraps
PassManagerT<Module>, but lib/VMCore/Pass.cpp is now the only class that
has to #include PassManagerT.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2383 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Pass.cpp')
-rw-r--r-- | lib/VMCore/Pass.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp index beef60fd47..ff9ac928b9 100644 --- a/lib/VMCore/Pass.cpp +++ b/lib/VMCore/Pass.cpp @@ -7,11 +7,14 @@ //===----------------------------------------------------------------------===// #include "llvm/PassManager.h" +#include "PassManagerT.h" // PassManagerT implementation #include "llvm/Module.h" #include "llvm/Function.h" #include "llvm/BasicBlock.h" #include "Support/STLExtras.h" -#include <algorithm> +#include "Support/CommandLine.h" +#include <typeinfo> +#include <iostream> // Source of unique analysis ID #'s. unsigned AnalysisID::NextID = 0; @@ -21,15 +24,22 @@ void AnalysisResolver::setAnalysisResolver(Pass *P, AnalysisResolver *AR) { P->Resolver = AR; } +//===----------------------------------------------------------------------===// +// PassManager implementation - The PassManager class is a simple Pimpl class +// that wraps the PassManagerT template. +// +PassManager::PassManager() : PM(new PassManagerT<Module>()) {} +PassManager::~PassManager() { delete PM; } +void PassManager::add(Pass *P) { PM->add(P); } +bool PassManager::run(Module *M) { return PM->run(M); } + +//===----------------------------------------------------------------------===// // Pass debugging information. Often it is useful to find out what pass is // running when a crash occurs in a utility. When this library is compiled with // debugging on, a command line option (--debug-pass) is enabled that causes the // pass name to be printed before it executes. // -#include "Support/CommandLine.h" -#include <typeinfo> -#include <iostream> // Different debug levels that can be enabled... enum PassDebugLevel { @@ -132,6 +142,20 @@ void FunctionPass::addToPassManager(PassManagerT<Function> *PM, PM->addPass(this, AU); } +// doesNotModifyCFG - This function should be called by our subclasses to +// implement the getAnalysisUsage virtual function, iff they do not: +// +// 1. Add or remove basic blocks from the function +// 2. Modify terminator instructions in any way. +// +// This function annotates the AnalysisUsage info object to say that analyses +// that only depend on the CFG are preserved by this pass. +// +void FunctionPass::doesNotModifyCFG(AnalysisUsage &Info) { + +} + + //===----------------------------------------------------------------------===// // BasicBlockPass Implementation // |