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
25 template<class UnitType> class PassManagerT;
28 PassManagerT<Module> *PM; // This is a straightforward Pimpl class
33 /// add - Add a pass to the queue of passes to run. This passes ownership of
34 /// the Pass to the PassManager. When the PassManager is destroyed, the pass
35 /// will be destroyed as well, so there is no need to delete the pass. This
36 /// implies that all passes MUST be allocated with 'new'.
40 /// run - Execute all of the passes scheduled for execution. Keep track of
41 /// whether any of the passes modifies the module, and if so, return true.
50 class FunctionPassManager {
51 PassManagerT<Function> *PM; // This is a straightforward Pimpl class
54 FunctionPassManager(ModuleProvider *P);
55 ~FunctionPassManager();
57 /// add - Add a pass to the queue of passes to run. This passes
58 /// ownership of the FunctionPass to the PassManager. When the
59 /// PassManager is destroyed, the pass will be destroyed as well, so
60 /// there is no need to delete the pass. This implies that all
61 /// passes MUST be allocated with 'new'.
63 void add(FunctionPass *P);
65 /// add - ImmutablePasses are not FunctionPasses, so we have a
66 /// special hack to get them into a FunctionPassManager.
68 void add(ImmutablePass *IP);
70 /// run - Execute all of the passes scheduled for execution. Keep
71 /// track of whether any of the passes modifies the function, and if
74 bool run(Function &F);
77 } // End llvm namespace