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 Threshold can be passed directly, or asked to be computed from the
00089 /// given optimization and size optimization arguments.
00090 ///
00091 /// The -inline-threshold command line option takes precedence over the
00092 /// threshold given here.
00093 Pass *createFunctionInliningPass();
00094 Pass *createFunctionInliningPass(int Threshold);
00095 Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel);
00096 
00097 //===----------------------------------------------------------------------===//
00098 /// createAlwaysInlinerPass - Return a new pass object that inlines only
00099 /// functions that are marked as "always_inline".
00100 Pass *createAlwaysInlinerPass();
00101 Pass *createAlwaysInlinerPass(bool InsertLifetime);
00102 
00103 //===----------------------------------------------------------------------===//
00104 /// createPruneEHPass - Return a new pass object which transforms invoke
00105 /// instructions into calls, if the callee can _not_ unwind the stack.
00106 ///
00107 Pass *createPruneEHPass();
00108 
00109 //===----------------------------------------------------------------------===//
00110 /// createInternalizePass - This pass loops over all of the functions in the
00111 /// input module, internalizing all globals (functions and variables) it can.
00112 ////
00113 /// The symbols in \p ExportList are never internalized.
00114 ///
00115 /// The symbol in DSOList are internalized if it is safe to drop them from
00116 /// the symbol table.
00117 ///
00118 /// Note that commandline options that are used with the above function are not
00119 /// used now!
00120 ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
00121 /// createInternalizePass - Same as above, but with an empty exportList.
00122 ModulePass *createInternalizePass();
00123 
00124 //===----------------------------------------------------------------------===//
00125 /// createDeadArgEliminationPass - This pass removes arguments from functions
00126 /// which are not used by the body of the function.
00127 ///
00128 ModulePass *createDeadArgEliminationPass();
00129 
00130 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
00131 /// functions as well.  This is definitely not safe, and should only be used by
00132 /// bugpoint.
00133 ModulePass *createDeadArgHackingPass();
00134 
00135 //===----------------------------------------------------------------------===//
00136 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
00137 /// be passed by value if the number of elements passed is smaller or
00138 /// equal to maxElements (maxElements == 0 means always promote).
00139 ///
00140 Pass *createArgumentPromotionPass(unsigned maxElements = 3);
00141 
00142 //===----------------------------------------------------------------------===//
00143 /// createIPConstantPropagationPass - This pass propagates constants from call
00144 /// sites into the bodies of functions.
00145 ///
00146 ModulePass *createIPConstantPropagationPass();
00147 
00148 //===----------------------------------------------------------------------===//
00149 /// createIPSCCPPass - This pass propagates constants from call sites into the
00150 /// bodies of functions, and keeps track of whether basic blocks are executable
00151 /// in the process.
00152 ///
00153 ModulePass *createIPSCCPPass();
00154 
00155 //===----------------------------------------------------------------------===//
00156 //
00157 /// createLoopExtractorPass - This pass extracts all natural loops from the
00158 /// program into a function if it can.
00159 ///
00160 Pass *createLoopExtractorPass();
00161 
00162 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
00163 /// program into a function if it can.  This is used by bugpoint.
00164 ///
00165 Pass *createSingleLoopExtractorPass();
00166 
00167 /// createBlockExtractorPass - This pass extracts all blocks (except those
00168 /// specified in the argument list) from the functions in the module.
00169 ///
00170 ModulePass *createBlockExtractorPass();
00171 
00172 /// createStripDeadPrototypesPass - This pass removes any function declarations
00173 /// (prototypes) that are not used.
00174 ModulePass *createStripDeadPrototypesPass();
00175 
00176 //===----------------------------------------------------------------------===//
00177 /// createFunctionAttrsPass - This pass discovers functions that do not access
00178 /// memory, or only read memory, and gives them the readnone/readonly attribute.
00179 /// It also discovers function arguments that are not captured by the function
00180 /// and marks them with the nocapture attribute.
00181 ///
00182 Pass *createFunctionAttrsPass();
00183 
00184 //===----------------------------------------------------------------------===//
00185 /// createMergeFunctionsPass - This pass discovers identical functions and
00186 /// collapses them.
00187 ///
00188 ModulePass *createMergeFunctionsPass();
00189 
00190 //===----------------------------------------------------------------------===//
00191 /// createPartialInliningPass - This pass inlines parts of functions.
00192 ///
00193 ModulePass *createPartialInliningPass();
00194 
00195 //===----------------------------------------------------------------------===//
00196 // createMetaRenamerPass - Rename everything with metasyntatic names.
00197 //
00198 ModulePass *createMetaRenamerPass();
00199 
00200 //===----------------------------------------------------------------------===//
00201 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
00202 /// manager.
00203 ModulePass *createBarrierNoopPass();
00204 
00205 } // End llvm namespace
00206 
00207 #endif