Put all LLVM code into the llvm namespace, as per bug 109.
[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 namespace llvm {
21
22 class Pass;
23 class Module;
24 class ModuleProvider;
25 template<class UnitType> class PassManagerT;
26
27 class PassManager {
28   PassManagerT<Module> *PM;    // This is a straightforward Pimpl class
29 public:
30   PassManager();
31   ~PassManager();
32
33   /// add - Add a pass to the queue of passes to run.  This passes ownership of
34   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
35   /// will be destroyed as well, so there is no need to delete the pass.  This
36   /// implies that all passes MUST be allocated with 'new'.
37   ///
38   void add(Pass *P);
39
40   /// run - Execute all of the passes scheduled for execution.  Keep track of
41   /// whether any of the passes modifies the module, and if so, return true.
42   ///
43   bool run(Module &M);
44 };
45
46 class FunctionPass;
47 class ImmutablePass;
48 class Function;
49
50 class FunctionPassManager {
51   PassManagerT<Function> *PM;    // This is a straightforward Pimpl class
52   ModuleProvider *MP;
53 public:
54   FunctionPassManager(ModuleProvider *P);
55   ~FunctionPassManager();
56
57   /// add - Add a pass to the queue of passes to run.  This passes
58   /// ownership of the FunctionPass to the PassManager.  When the
59   /// PassManager is destroyed, the pass will be destroyed as well, so
60   /// there is no need to delete the pass.  This implies that all
61   /// passes MUST be allocated with 'new'.
62   ///
63   void add(FunctionPass *P);
64
65   /// add - ImmutablePasses are not FunctionPasses, so we have a 
66   /// special hack to get them into a FunctionPassManager.
67   ///
68   void add(ImmutablePass *IP);
69
70   /// run - Execute all of the passes scheduled for execution.  Keep
71   /// track of whether any of the passes modifies the function, and if
72   /// so, return true.
73   ///
74   bool run(Function &F);
75 };
76
77 } // End llvm namespace
78
79 #endif