LLVM API Documentation
00001 //===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- 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 header file defines prototypes for accessor functions that expose passes 00011 // in the IPO transformations library. 00012 // 00013 //===----------------------------------------------------------------------===// 00014 00015 #ifndef LLVM_TRANSFORMS_IPO_H 00016 #define LLVM_TRANSFORMS_IPO_H 00017 00018 #include <vector> 00019 00020 namespace llvm { 00021 00022 class FunctionPass; 00023 class ModulePass; 00024 class Function; 00025 class BasicBlock; 00026 00027 //===----------------------------------------------------------------------===// 00028 // 00029 // These functions removes symbols from functions and modules. If OnlyDebugInfo 00030 // is true, only debugging information is removed from the module. 00031 // 00032 ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false); 00033 00034 //===----------------------------------------------------------------------===// 00035 /// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics 00036 /// to invoke/unwind instructions. This should really be part of the C/C++ 00037 /// front-end, but it's so much easier to write transformations in LLVM proper. 00038 /// 00039 ModulePass* createLowerSetJmpPass(); 00040 00041 //===----------------------------------------------------------------------===// 00042 /// createConstantMergePass - This function returns a new pass that merges 00043 /// duplicate global constants together into a single constant that is shared. 00044 /// This is useful because some passes (ie TraceValues) insert a lot of string 00045 /// constants into the program, regardless of whether or not they duplicate an 00046 /// existing string. 00047 /// 00048 ModulePass *createConstantMergePass(); 00049 00050 00051 //===----------------------------------------------------------------------===// 00052 /// createGlobalOptimizerPass - This function returns a new pass that optimizes 00053 /// non-address taken internal globals. 00054 /// 00055 ModulePass *createGlobalOptimizerPass(); 00056 00057 00058 //===----------------------------------------------------------------------===// 00059 /// createRaiseAllocationsPass - Return a new pass that transforms malloc and 00060 /// free function calls into malloc and free instructions. 00061 /// 00062 ModulePass *createRaiseAllocationsPass(); 00063 00064 00065 //===----------------------------------------------------------------------===// 00066 /// createDeadTypeEliminationPass - Return a new pass that eliminates symbol 00067 /// table entries for types that are never used. 00068 /// 00069 ModulePass *createDeadTypeEliminationPass(); 00070 00071 00072 //===----------------------------------------------------------------------===// 00073 /// createGlobalDCEPass - This transform is designed to eliminate unreachable 00074 /// internal globals (functions or global variables) 00075 /// 00076 ModulePass *createGlobalDCEPass(); 00077 00078 00079 //===----------------------------------------------------------------------===// 00080 /// createFunctionExtractionPass - If deleteFn is true, this pass deletes as 00081 /// the specified function. Otherwise, it deletes as much of the module as 00082 /// possible, except for the function specified. 00083 /// 00084 ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false); 00085 00086 00087 //===----------------------------------------------------------------------===// 00088 /// FunctionResolvingPass - Go over the functions that are in the module and 00089 /// look for functions that have the same name. More often than not, there will 00090 /// be things like: 00091 /// void "foo"(...) 00092 /// void "foo"(int, int) 00093 /// because of the way things are declared in C. If this is the case, patch 00094 /// things up. 00095 /// 00096 /// This is an interprocedural pass. 00097 /// 00098 ModulePass *createFunctionResolvingPass(); 00099 00100 //===----------------------------------------------------------------------===// 00101 /// createFunctionInliningPass - Return a new pass object that uses a heuristic 00102 /// to inline direct function calls to small functions. 00103 /// 00104 ModulePass *createFunctionInliningPass(); 00105 00106 //===----------------------------------------------------------------------===// 00107 /// createPruneEHPass - Return a new pass object which transforms invoke 00108 /// instructions into calls, if the callee can _not_ unwind the stack. 00109 /// 00110 ModulePass *createPruneEHPass(); 00111 00112 //===----------------------------------------------------------------------===// 00113 /// createInternalizePass - This pass loops over all of the functions in the 00114 /// input module, looking for a main function. If a list of symbols is 00115 /// specified with the -internalize-public-api-* command line options, those 00116 /// symbols are internalized. Otherwise if InternalizeEverything is set and 00117 /// the main function is found, all other globals are marked as internal. 00118 /// 00119 ModulePass *createInternalizePass(bool InternalizeEverything); 00120 ModulePass *createInternalizePass(const std::vector<const char *> &exportList); 00121 00122 //===----------------------------------------------------------------------===// 00123 /// createDeadArgEliminationPass - This pass removes arguments from functions 00124 /// which are not used by the body of the function. 00125 /// 00126 ModulePass *createDeadArgEliminationPass(); 00127 00128 /// DeadArgHacking pass - Same as DAE, but delete arguments of external 00129 /// functions as well. This is definitely not safe, and should only be used by 00130 /// bugpoint. 00131 ModulePass *createDeadArgHackingPass(); 00132 00133 //===----------------------------------------------------------------------===// 00134 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to 00135 /// be passed by value. 00136 /// 00137 ModulePass *createArgumentPromotionPass(); 00138 00139 //===----------------------------------------------------------------------===// 00140 /// createIPConstantPropagationPass - This pass propagates constants from call 00141 /// sites into the bodies of functions. 00142 /// 00143 ModulePass *createIPConstantPropagationPass(); 00144 00145 //===----------------------------------------------------------------------===// 00146 /// createIPSCCPPass - This pass propagates constants from call sites into the 00147 /// bodies of functions, and keeps track of whether basic blocks are executable 00148 /// in the process. 00149 /// 00150 ModulePass *createIPSCCPPass(); 00151 00152 //===----------------------------------------------------------------------===// 00153 // 00154 /// createLoopExtractorPass - This pass extracts all natural loops from the 00155 /// program into a function if it can. 00156 /// 00157 FunctionPass *createLoopExtractorPass(); 00158 00159 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the 00160 /// program into a function if it can. This is used by bugpoint. 00161 /// 00162 FunctionPass *createSingleLoopExtractorPass(); 00163 00164 // createBlockExtractorPass - This pass extracts all blocks (except those 00165 // specified in the argument list) from the functions in the module. 00166 // 00167 ModulePass *createBlockExtractorPass(std::vector<BasicBlock*> &BTNE); 00168 00169 // createOptimizeWellKnownCallsPass - This pass optimizes specific calls to 00170 // specific well-known (library) functions. 00171 ModulePass *createSimplifyLibCallsPass(); 00172 00173 00174 // createIndMemRemPass - This pass removes potential indirect calls of 00175 // malloc and free 00176 ModulePass *createIndMemRemPass(); 00177 00178 } // End llvm namespace 00179 00180 #endif