LLVM API Documentation

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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