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
26 class ModulePassManager;
27 class FunctionPassManagerT;
28 class BasicBlockPassManager;
31 ModulePassManager *PM; // This is a straightforward Pimpl class
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'.
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.
53 class FunctionPassManager {
54 FunctionPassManagerT *PM; // This is a straightforward Pimpl class
57 FunctionPassManager(ModuleProvider *P);
58 ~FunctionPassManager();
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'.
66 void add(FunctionPass *P);
68 /// add - ImmutablePasses are not FunctionPasses, so we have a
69 /// special hack to get them into a FunctionPassManager.
71 void add(ImmutablePass *IP);
73 /// doInitialization - Run all of the initializers for the function passes.
75 bool doInitialization();
77 /// run - Execute all of the passes scheduled for execution. Keep
78 /// track of whether any of the passes modifies the function, and if
81 bool run(Function &F);
83 /// doFinalization - Run all of the initializers for the function passes.
85 bool doFinalization();
88 } // End llvm namespace