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