LLVM API Documentation

Transforms/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 is distributed under the University of Illinois Open Source
00006 // 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 "llvm/ADT/ArrayRef.h"
00019 
00020 namespace llvm {
00021 
00022 class ModulePass;
00023 class Pass;
00024 class Function;
00025 class BasicBlock;
00026 class GlobalValue;
00027 
00028 //===----------------------------------------------------------------------===//
00029 //
00030 // These functions removes symbols from functions and modules.  If OnlyDebugInfo
00031 // is true, only debugging information is removed from the module.
00032 //
00033 ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false);
00034 
00035 //===----------------------------------------------------------------------===//
00036 //
00037 // These functions strips symbols from functions and modules.  
00038 // Only debugging information is not stripped.
00039 //
00040 ModulePass *createStripNonDebugSymbolsPass();
00041 
00042 //===----------------------------------------------------------------------===//
00043 //
00044 // These pass removes llvm.dbg.declare intrinsics.
00045 ModulePass *createStripDebugDeclarePass();
00046 
00047 //===----------------------------------------------------------------------===//
00048 //
00049 // These pass removes unused symbols' debug info.
00050 ModulePass *createStripDeadDebugInfoPass();
00051 
00052 //===----------------------------------------------------------------------===//
00053 /// createConstantMergePass - This function returns a new pass that merges
00054 /// duplicate global constants together into a single constant that is shared.
00055 /// This is useful because some passes (ie TraceValues) insert a lot of string
00056 /// constants into the program, regardless of whether or not they duplicate an
00057 /// existing string.
00058 ///
00059 ModulePass *createConstantMergePass();
00060 
00061 
00062 //===----------------------------------------------------------------------===//
00063 /// createGlobalOptimizerPass - This function returns a new pass that optimizes
00064 /// non-address taken internal globals.
00065 ///
00066 ModulePass *createGlobalOptimizerPass();
00067 
00068 
00069 //===----------------------------------------------------------------------===//
00070 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
00071 /// internal globals (functions or global variables)
00072 ///
00073 ModulePass *createGlobalDCEPass();
00074 
00075 
00076 //===----------------------------------------------------------------------===//
00077 /// createGVExtractionPass - If deleteFn is true, this pass deletes
00078 /// the specified global values. Otherwise, it deletes as much of the module as
00079 /// possible, except for the global values specified.
00080 ///
00081 ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool 
00082                                    deleteFn = false);
00083 
00084 //===----------------------------------------------------------------------===//
00085 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
00086 /// to inline direct function calls to small functions.
00087 ///
00088 /// The -inline-threshold command line option takes precedence over the
00089 /// threshold given here.
00090 Pass *createFunctionInliningPass();
00091 Pass *createFunctionInliningPass(int Threshold);
00092 
00093 //===----------------------------------------------------------------------===//
00094 /// createAlwaysInlinerPass - Return a new pass object that inlines only 
00095 /// functions that are marked as "always_inline".
00096 Pass *createAlwaysInlinerPass();
00097 Pass *createAlwaysInlinerPass(bool InsertLifetime);
00098 
00099 //===----------------------------------------------------------------------===//
00100 /// createPruneEHPass - Return a new pass object which transforms invoke
00101 /// instructions into calls, if the callee can _not_ unwind the stack.
00102 ///
00103 Pass *createPruneEHPass();
00104 
00105 //===----------------------------------------------------------------------===//
00106 /// createInternalizePass - This pass loops over all of the functions in the
00107 /// input module, internalizing all globals (functions and variables) not in the
00108 /// given exportList.
00109 ///
00110 /// Note that commandline options that are used with the above function are not
00111 /// used now!
00112 ModulePass *createInternalizePass(ArrayRef<const char *> exportList);
00113 /// createInternalizePass - Same as above, but with an empty exportList.
00114 ModulePass *createInternalizePass();
00115 
00116 //===----------------------------------------------------------------------===//
00117 /// createDeadArgEliminationPass - This pass removes arguments from functions
00118 /// which are not used by the body of the function.
00119 ///
00120 ModulePass *createDeadArgEliminationPass();
00121 
00122 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
00123 /// functions as well.  This is definitely not safe, and should only be used by
00124 /// bugpoint.
00125 ModulePass *createDeadArgHackingPass();
00126 
00127 //===----------------------------------------------------------------------===//
00128 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
00129 /// be passed by value if the number of elements passed is smaller or
00130 /// equal to maxElements (maxElements == 0 means always promote).
00131 ///
00132 Pass *createArgumentPromotionPass(unsigned maxElements = 3);
00133 
00134 //===----------------------------------------------------------------------===//
00135 /// createIPConstantPropagationPass - This pass propagates constants from call
00136 /// sites into the bodies of functions.
00137 ///
00138 ModulePass *createIPConstantPropagationPass();
00139 
00140 //===----------------------------------------------------------------------===//
00141 /// createIPSCCPPass - This pass propagates constants from call sites into the
00142 /// bodies of functions, and keeps track of whether basic blocks are executable
00143 /// in the process.
00144 ///
00145 ModulePass *createIPSCCPPass();
00146 
00147 //===----------------------------------------------------------------------===//
00148 //
00149 /// createLoopExtractorPass - This pass extracts all natural loops from the
00150 /// program into a function if it can.
00151 ///
00152 Pass *createLoopExtractorPass();
00153 
00154 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
00155 /// program into a function if it can.  This is used by bugpoint.
00156 ///
00157 Pass *createSingleLoopExtractorPass();
00158 
00159 /// createBlockExtractorPass - This pass extracts all blocks (except those
00160 /// specified in the argument list) from the functions in the module.
00161 ///
00162 ModulePass *createBlockExtractorPass();
00163 
00164 /// createStripDeadPrototypesPass - This pass removes any function declarations
00165 /// (prototypes) that are not used.
00166 ModulePass *createStripDeadPrototypesPass();
00167 
00168 //===----------------------------------------------------------------------===//
00169 /// createFunctionAttrsPass - This pass discovers functions that do not access
00170 /// memory, or only read memory, and gives them the readnone/readonly attribute.
00171 /// It also discovers function arguments that are not captured by the function
00172 /// and marks them with the nocapture attribute.
00173 ///
00174 Pass *createFunctionAttrsPass();
00175 
00176 //===----------------------------------------------------------------------===//
00177 /// createMergeFunctionsPass - This pass discovers identical functions and
00178 /// collapses them.
00179 ///
00180 ModulePass *createMergeFunctionsPass();
00181 
00182 //===----------------------------------------------------------------------===//
00183 /// createPartialInliningPass - This pass inlines parts of functions.
00184 ///
00185 ModulePass *createPartialInliningPass();
00186   
00187 //===----------------------------------------------------------------------===//
00188 // createMetaRenamerPass - Rename everything with metasyntatic names.
00189 //
00190 ModulePass *createMetaRenamerPass();
00191 
00192 //===----------------------------------------------------------------------===//
00193 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
00194 /// manager.
00195 ModulePass *createBarrierNoopPass();
00196 
00197 } // End llvm namespace
00198 
00199 #endif