LLVM API Documentation
00001 //===- llvm/PassManager.h - Container for Passes ----------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the PassManager class. This class is used to hold, 00011 // maintain, and optimize execution of Passes. The PassManager class ensures 00012 // that analysis results are available before a pass runs, and that Pass's are 00013 // destroyed when the PassManager is destroyed. 00014 // 00015 //===----------------------------------------------------------------------===// 00016 00017 #ifndef LLVM_PASSMANAGER_H 00018 #define LLVM_PASSMANAGER_H 00019 00020 namespace llvm { 00021 00022 class Pass; 00023 class ModulePass; 00024 class Module; 00025 class ModuleProvider; 00026 class ModulePassManager; 00027 class FunctionPassManagerT; 00028 class BasicBlockPassManager; 00029 00030 class PassManager { 00031 ModulePassManager *PM; // This is a straightforward Pimpl class 00032 public: 00033 PassManager(); 00034 ~PassManager(); 00035 00036 /// add - Add a pass to the queue of passes to run. This passes ownership of 00037 /// the Pass to the PassManager. When the PassManager is destroyed, the pass 00038 /// will be destroyed as well, so there is no need to delete the pass. This 00039 /// implies that all passes MUST be allocated with 'new'. 00040 /// 00041 void add(Pass *P); 00042 00043 /// run - Execute all of the passes scheduled for execution. Keep track of 00044 /// whether any of the passes modifies the module, and if so, return true. 00045 /// 00046 bool run(Module &M); 00047 }; 00048 00049 class FunctionPass; 00050 class ImmutablePass; 00051 class Function; 00052 00053 class FunctionPassManager { 00054 FunctionPassManagerT *PM; // This is a straightforward Pimpl class 00055 ModuleProvider *MP; 00056 public: 00057 FunctionPassManager(ModuleProvider *P); 00058 ~FunctionPassManager(); 00059 00060 /// add - Add a pass to the queue of passes to run. This passes 00061 /// ownership of the FunctionPass to the PassManager. When the 00062 /// PassManager is destroyed, the pass will be destroyed as well, so 00063 /// there is no need to delete the pass. This implies that all 00064 /// passes MUST be allocated with 'new'. 00065 /// 00066 void add(FunctionPass *P); 00067 00068 /// add - ImmutablePasses are not FunctionPasses, so we have a 00069 /// special hack to get them into a FunctionPassManager. 00070 /// 00071 void add(ImmutablePass *IP); 00072 00073 /// run - Execute all of the passes scheduled for execution. Keep 00074 /// track of whether any of the passes modifies the function, and if 00075 /// so, return true. 00076 /// 00077 bool run(Function &F); 00078 }; 00079 00080 } // End llvm namespace 00081 00082 #endif