LLVM API Documentation

IPO.h

Go to the documentation of this file.
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 
00121 //===----------------------------------------------------------------------===//
00122 /// createDeadArgEliminationPass - This pass removes arguments from functions
00123 /// which are not used by the body of the function.
00124 ///
00125 ModulePass *createDeadArgEliminationPass();
00126 
00127 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
00128 /// functions as well.  This is definitely not safe, and should only be used by
00129 /// bugpoint.
00130 ModulePass *createDeadArgHackingPass();
00131 
00132 //===----------------------------------------------------------------------===//
00133 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
00134 /// be passed by value.
00135 ///
00136 ModulePass *createArgumentPromotionPass();
00137 
00138 //===----------------------------------------------------------------------===//
00139 /// createIPConstantPropagationPass - This pass propagates constants from call
00140 /// sites into the bodies of functions.
00141 ///
00142 ModulePass *createIPConstantPropagationPass();
00143 
00144 //===----------------------------------------------------------------------===//
00145 /// createIPSCCPPass - This pass propagates constants from call sites into the
00146 /// bodies of functions, and keeps track of whether basic blocks are executable
00147 /// in the process.
00148 ///
00149 ModulePass *createIPSCCPPass();
00150 
00151 //===----------------------------------------------------------------------===//
00152 //
00153 /// createLoopExtractorPass - This pass extracts all natural loops from the
00154 /// program into a function if it can.
00155 ///
00156 FunctionPass *createLoopExtractorPass();
00157 
00158 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
00159 /// program into a function if it can.  This is used by bugpoint.
00160 ///
00161 FunctionPass *createSingleLoopExtractorPass();
00162 
00163 // createBlockExtractorPass - This pass extracts all blocks (except those
00164 // specified in the argument list) from the functions in the module.
00165 //
00166 ModulePass *createBlockExtractorPass(std::vector<BasicBlock*> &BTNE);
00167 
00168 // createOptimizeWellKnownCallsPass - This pass optimizes specific calls to
00169 // specific well-known (library) functions.
00170 ModulePass *createSimplifyLibCallsPass();
00171 
00172 
00173 // createIndMemRemPass - This pass removes potential indirect calls of
00174 // malloc and free
00175 ModulePass *createIndMemRemPass();
00176 
00177 } // End llvm namespace
00178 
00179 #endif