1 //===- llvm/PassManager.h - Container for Passes ----------------*- C++ -*-===//
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.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_PASSMANAGER_H
11 #define LLVM_PASSMANAGER_H
16 template<class UnitType> class PassManagerT;
19 PassManagerT<Module> *PM; // This is a straightforward Pimpl class
24 /// add - Add a pass to the queue of passes to run. This passes ownership of
25 /// the Pass to the PassManager. When the PassManager is destroyed, the pass
26 /// will be destroyed as well, so there is no need to delete the pass. This
27 /// implies that all passes MUST be allocated with 'new'.
31 /// run - Execute all of the passes scheduled for execution. Keep track of
32 /// whether any of the passes modifies the module, and if so, return true.
41 class FunctionPassManager {
42 PassManagerT<Function> *PM; // This is a straightforward Pimpl class
45 FunctionPassManager(ModuleProvider *P);
46 ~FunctionPassManager();
48 /// add - Add a pass to the queue of passes to run. This passes
49 /// ownership of the FunctionPass to the PassManager. When the
50 /// PassManager is destroyed, the pass will be destroyed as well, so
51 /// there is no need to delete the pass. This implies that all
52 /// passes MUST be allocated with 'new'.
54 void add(FunctionPass *P);
56 /// add - ImmutablePasses are not FunctionPasses, so we have a
57 /// special hack to get them into a FunctionPassManager.
59 void add(ImmutablePass *IP);
61 /// run - Execute all of the passes scheduled for execution. Keep
62 /// track of whether any of the passes modifies the function, and if
65 bool run(Function &F);