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