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 /// createGlobalOptimizerPass - This function returns a new pass that optimizes
00063 /// non-address taken internal globals.
00064 ///
00065 ModulePass *createGlobalOptimizerPass();
00066 
00067 //===----------------------------------------------------------------------===//
00068 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
00069 /// internal globals (functions or global variables)
00070 ///
00071 ModulePass *createGlobalDCEPass();
00072 
00073 //===----------------------------------------------------------------------===//
00074 /// createGVExtractionPass - If deleteFn is true, this pass deletes
00075 /// the specified global values. Otherwise, it deletes as much of the module as
00076 /// possible, except for the global values specified.
00077 ///
00078 ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
00079                                    deleteFn = false);
00080 
00081 //===----------------------------------------------------------------------===//
00082 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
00083 /// to inline direct function calls to small functions.
00084 ///
00085 /// The Threshold can be passed directly, or asked to be computed from the
00086 /// given optimization and size optimization arguments.
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 Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel);
00093 
00094 //===----------------------------------------------------------------------===//
00095 /// createAlwaysInlinerPass - Return a new pass object that inlines only
00096 /// functions that are marked as "always_inline".
00097 Pass *createAlwaysInlinerPass();
00098 Pass *createAlwaysInlinerPass(bool InsertLifetime);
00099 
00100 //===----------------------------------------------------------------------===//
00101 /// createPruneEHPass - Return a new pass object which transforms invoke
00102 /// instructions into calls, if the callee can _not_ unwind the stack.
00103 ///
00104 Pass *createPruneEHPass();
00105 
00106 //===----------------------------------------------------------------------===//
00107 /// createInternalizePass - This pass loops over all of the functions in the
00108 /// input module, internalizing all globals (functions and variables) it can.
00109 ////
00110 /// The symbols in \p ExportList are never internalized.
00111 ///
00112 /// The symbol in DSOList are internalized if it is safe to drop them from
00113 /// the symbol table.
00114 ///
00115 /// Note that commandline options that are used with the above function are not
00116 /// used now!
00117 ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
00118 /// createInternalizePass - Same as above, but with an empty exportList.
00119 ModulePass *createInternalizePass();
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 if the number of elements passed is smaller or
00135 /// equal to maxElements (maxElements == 0 means always promote).
00136 ///
00137 Pass *createArgumentPromotionPass(unsigned maxElements = 3);
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 Pass *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 Pass *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();
00168 
00169 /// createStripDeadPrototypesPass - This pass removes any function declarations
00170 /// (prototypes) that are not used.
00171 ModulePass *createStripDeadPrototypesPass();
00172 
00173 //===----------------------------------------------------------------------===//
00174 /// createFunctionAttrsPass - This pass discovers functions that do not access
00175 /// memory, or only read memory, and gives them the readnone/readonly attribute.
00176 /// It also discovers function arguments that are not captured by the function
00177 /// and marks them with the nocapture attribute.
00178 ///
00179 Pass *createFunctionAttrsPass();
00180 
00181 //===----------------------------------------------------------------------===//
00182 /// createMergeFunctionsPass - This pass discovers identical functions and
00183 /// collapses them.
00184 ///
00185 ModulePass *createMergeFunctionsPass();
00186 
00187 //===----------------------------------------------------------------------===//
00188 /// createPartialInliningPass - This pass inlines parts of functions.
00189 ///
00190 ModulePass *createPartialInliningPass();
00191 
00192 //===----------------------------------------------------------------------===//
00193 // createMetaRenamerPass - Rename everything with metasyntatic names.
00194 //
00195 ModulePass *createMetaRenamerPass();
00196 
00197 //===----------------------------------------------------------------------===//
00198 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
00199 /// manager.
00200 ModulePass *createBarrierNoopPass();
00201 
00202 } // End llvm namespace
00203 
00204 #endif