1 //===- llvm/PassManager.h - Container for Passes ----------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
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.
15 //===----------------------------------------------------------------------===//
17 #ifndef LLVM_PASSMANAGER_H
18 #define LLVM_PASSMANAGER_H
20 #include "llvm/Pass.h"
29 class PassManagerImpl;
30 class FunctionPassManagerImpl;
32 /// PassManager manages ModulePassManagers
40 /// add - Add a pass to the queue of passes to run. This passes ownership of
41 /// the Pass to the PassManager. When the PassManager is destroyed, the pass
42 /// will be destroyed as well, so there is no need to delete the pass. This
43 /// implies that all passes MUST be allocated with 'new'.
46 /// run - Execute all of the passes scheduled for execution. Keep track of
47 /// whether any of the passes modifies the module, and if so, return true.
52 /// PassManagerImpl_New is the actual class. PassManager is just the
53 /// wraper to publish simple pass manager interface
58 /// FunctionPassManager manages FunctionPasses and BasicBlockPassManagers.
59 class FunctionPassManager {
61 explicit FunctionPassManager(ModuleProvider *P);
62 FunctionPassManager();
63 ~FunctionPassManager();
65 /// add - Add a pass to the queue of passes to run. This passes
66 /// ownership of the Pass to the PassManager. When the
67 /// PassManager_X is destroyed, the pass will be destroyed as well, so
68 /// there is no need to delete the pass. (TODO delete passes.)
69 /// This implies that all passes MUST be allocated with 'new'.
72 /// run - Execute all of the passes scheduled for execution. Keep
73 /// track of whether any of the passes modifies the function, and if
76 bool run(Function &F);
78 /// doInitialization - Run all of the initializers for the function passes.
80 bool doInitialization();
82 /// doFinalization - Run all of the initializers for the function passes.
84 bool doFinalization();
87 FunctionPassManagerImpl *FPM;
91 } // End llvm namespace