Remove old pass manager.
[oota-llvm.git] / include / llvm / PassManager.h
1 //===- llvm/PassManager.h - Container for Passes ----------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the PassManager class.  This class is used to hold,
11 // maintain, and optimize execution of Passes.  The PassManager class ensures
12 // that analysis results are available before a pass runs, and that Pass's are
13 // destroyed when the PassManager is destroyed.
14 //
15 //===----------------------------------------------------------------------===//
16
17 #ifndef LLVM_PASSMANAGER_H
18 #define LLVM_PASSMANAGER_H
19
20 #include "llvm/Pass.h"
21
22 namespace llvm {
23
24 class Pass;
25 class ModulePass;
26 class Module;
27 class ModuleProvider;
28
29 class ModulePassManager;
30 class PassManagerImpl;
31 class FunctionPassManagerImpl;
32
33 /// PassManager manages ModulePassManagers
34 class PassManager {
35
36 public:
37
38   PassManager();
39   ~PassManager();
40
41   /// add - Add a pass to the queue of passes to run.  This passes ownership of
42   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
43   /// will be destroyed as well, so there is no need to delete the pass.  This
44   /// implies that all passes MUST be allocated with 'new'.
45   void add(Pass *P);
46  
47   /// run - Execute all of the passes scheduled for execution.  Keep track of
48   /// whether any of the passes modifies the module, and if so, return true.
49   bool run(Module &M);
50
51 private:
52
53   /// PassManagerImpl_New is the actual class. PassManager is just the 
54   /// wraper to publish simple pass manager interface
55   PassManagerImpl *PM;
56
57 };
58
59 /// FunctionPassManager manages FunctionPasses and BasicBlockPassManagers.
60 class FunctionPassManager {
61 public:
62   FunctionPassManager(ModuleProvider *P);
63   FunctionPassManager();
64   ~FunctionPassManager();
65  
66   /// add - Add a pass to the queue of passes to run.  This passes
67   /// ownership of the Pass to the PassManager.  When the
68   /// PassManager_X is destroyed, the pass will be destroyed as well, so
69   /// there is no need to delete the pass. (TODO delete passes.)
70   /// This implies that all passes MUST be allocated with 'new'.
71   void add(Pass *P);
72
73   /// run - Execute all of the passes scheduled for execution.  Keep
74   /// track of whether any of the passes modifies the function, and if
75   /// so, return true.
76   ///
77   bool run(Function &F);
78   
79   /// doInitialization - Run all of the initializers for the function passes.
80   ///
81   bool doInitialization();
82   
83   /// doFinalization - Run all of the initializers for the function passes.
84   ///
85   bool doFinalization();
86 private:
87   
88   FunctionPassManagerImpl *FPM;
89   ModuleProvider *MP;
90 };
91
92 } // End llvm namespace
93
94 #endif