Use 'F' for Function instead of 'M'.
[oota-llvm.git] / include / llvm / PassManager.h
1 //===- llvm/PassManager.h - Container for Passes ----------------*- C++ -*-===//
2 //
3 // This file defines the PassManager class.  This class is used to hold,
4 // maintain, and optimize execution of Passes.  The PassManager class ensures
5 // that analysis results are available before a pass runs, and that Pass's are
6 // destroyed when the PassManager is destroyed.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_PASSMANAGER_H
11 #define LLVM_PASSMANAGER_H
12
13 class Pass;
14 class Module;
15 template<class UnitType> class PassManagerT;
16
17 class PassManager {
18   PassManagerT<Module> *PM;    // This is a straightforward Pimpl class
19 public:
20   PassManager();
21   ~PassManager();
22
23   /// add - Add a pass to the queue of passes to run.  This passes ownership of
24   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
25   /// will be destroyed as well, so there is no need to delete the pass.  This
26   /// implies that all passes MUST be allocated with 'new'.
27   ///
28   void add(Pass *P);
29
30   /// run - Execute all of the passes scheduled for execution.  Keep track of
31   /// whether any of the passes modifies the module, and if so, return true.
32   ///
33   bool run(Module &M);
34 };
35
36 class FunctionPass;
37 class ImmutablePass;
38 class Function;
39
40 class FunctionPassManager {
41   PassManagerT<Function> *PM;    // This is a straightforward Pimpl class
42 public:
43   FunctionPassManager();
44   ~FunctionPassManager();
45
46   /// add - Add a pass to the queue of passes to run.  This passes
47   /// ownership of the FunctionPass to the PassManager.  When the
48   /// PassManager is destroyed, the pass will be destroyed as well, so
49   /// there is no need to delete the pass.  This implies that all
50   /// passes MUST be allocated with 'new'.
51   ///
52   void add(FunctionPass *P);
53
54   /// add - ImmutablePasses are not FunctionPasses, so we have a 
55   /// special hack to get them into a FunctionPassManager.
56   ///
57   void add(ImmutablePass *IP);
58
59   /// run - Execute all of the passes scheduled for execution.  Keep
60   /// track of whether any of the passes modifies the function, and if
61   /// so, return true.
62   ///
63   bool run(Function &F);
64 };
65
66 #endif