IPO.h revision ca891ecf9152791f72f33a0dafff6b4a022642ee
1//===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This header file defines prototypes for accessor functions that expose passes 11// in the IPO transformations library. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef LLVM_TRANSFORMS_IPO_H 16#define LLVM_TRANSFORMS_IPO_H 17 18#include <vector> 19 20namespace llvm { 21 22class FunctionPass; 23class ModulePass; 24class Pass; 25class Function; 26class BasicBlock; 27 28//===----------------------------------------------------------------------===// 29// 30// These functions removes symbols from functions and modules. If OnlyDebugInfo 31// is true, only debugging information is removed from the module. 32// 33ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false); 34 35//===----------------------------------------------------------------------===// 36/// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics 37/// to invoke/unwind instructions. This should really be part of the C/C++ 38/// front-end, but it's so much easier to write transformations in LLVM proper. 39/// 40ModulePass* createLowerSetJmpPass(); 41 42//===----------------------------------------------------------------------===// 43/// createConstantMergePass - This function returns a new pass that merges 44/// duplicate global constants together into a single constant that is shared. 45/// This is useful because some passes (ie TraceValues) insert a lot of string 46/// constants into the program, regardless of whether or not they duplicate an 47/// existing string. 48/// 49ModulePass *createConstantMergePass(); 50 51 52//===----------------------------------------------------------------------===// 53/// createGlobalOptimizerPass - This function returns a new pass that optimizes 54/// non-address taken internal globals. 55/// 56ModulePass *createGlobalOptimizerPass(); 57 58 59//===----------------------------------------------------------------------===// 60/// createRaiseAllocationsPass - Return a new pass that transforms malloc and 61/// free function calls into malloc and free instructions. 62/// 63ModulePass *createRaiseAllocationsPass(); 64 65 66//===----------------------------------------------------------------------===// 67/// createDeadTypeEliminationPass - Return a new pass that eliminates symbol 68/// table entries for types that are never used. 69/// 70ModulePass *createDeadTypeEliminationPass(); 71 72 73//===----------------------------------------------------------------------===// 74/// createGlobalDCEPass - This transform is designed to eliminate unreachable 75/// internal globals (functions or global variables) 76/// 77ModulePass *createGlobalDCEPass(); 78 79 80//===----------------------------------------------------------------------===// 81/// createFunctionExtractionPass - If deleteFn is true, this pass deletes as 82/// the specified function. Otherwise, it deletes as much of the module as 83/// possible, except for the function specified. 84/// 85ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false, 86 bool relinkCallees = false); 87 88 89//===----------------------------------------------------------------------===// 90/// createFunctionInliningPass - Return a new pass object that uses a heuristic 91/// to inline direct function calls to small functions. 92/// 93Pass *createFunctionInliningPass(); 94Pass *createFunctionInliningPass(int Threshold); 95 96//===----------------------------------------------------------------------===// 97/// createPruneEHPass - Return a new pass object which transforms invoke 98/// instructions into calls, if the callee can _not_ unwind the stack. 99/// 100Pass *createPruneEHPass(); 101 102//===----------------------------------------------------------------------===// 103/// createInternalizePass - This pass loops over all of the functions in the 104/// input module, looking for a main function. If a list of symbols is 105/// specified with the -internalize-public-api-* command line options, those 106/// symbols are internalized. Otherwise if InternalizeEverything is set and 107/// the main function is found, all other globals are marked as internal. 108/// 109ModulePass *createInternalizePass(bool InternalizeEverything); 110ModulePass *createInternalizePass(const std::vector<const char *> &exportList); 111 112//===----------------------------------------------------------------------===// 113/// createDeadArgEliminationPass - This pass removes arguments from functions 114/// which are not used by the body of the function. 115/// 116ModulePass *createDeadArgEliminationPass(); 117 118/// DeadArgHacking pass - Same as DAE, but delete arguments of external 119/// functions as well. This is definitely not safe, and should only be used by 120/// bugpoint. 121ModulePass *createDeadArgHackingPass(); 122 123//===----------------------------------------------------------------------===// 124/// createArgumentPromotionPass - This pass promotes "by reference" arguments to 125/// be passed by value. 126/// 127Pass *createArgumentPromotionPass(); 128Pass *createStructRetPromotionPass(); 129 130//===----------------------------------------------------------------------===// 131/// createIPConstantPropagationPass - This pass propagates constants from call 132/// sites into the bodies of functions. 133/// 134ModulePass *createIPConstantPropagationPass(); 135 136//===----------------------------------------------------------------------===// 137/// createIPSCCPPass - This pass propagates constants from call sites into the 138/// bodies of functions, and keeps track of whether basic blocks are executable 139/// in the process. 140/// 141ModulePass *createIPSCCPPass(); 142 143//===----------------------------------------------------------------------===// 144// 145/// createLoopExtractorPass - This pass extracts all natural loops from the 146/// program into a function if it can. 147/// 148FunctionPass *createLoopExtractorPass(); 149 150/// createSingleLoopExtractorPass - This pass extracts one natural loop from the 151/// program into a function if it can. This is used by bugpoint. 152/// 153FunctionPass *createSingleLoopExtractorPass(); 154 155/// createBlockExtractorPass - This pass extracts all blocks (except those 156/// specified in the argument list) from the functions in the module. 157/// 158ModulePass *createBlockExtractorPass(const std::vector<BasicBlock*> &BTNE); 159 160/// createOptimizeWellKnownCallsPass - This pass optimizes specific calls to 161/// specific well-known (library) functions. 162ModulePass *createSimplifyLibCallsPass(); 163 164 165/// createIndMemRemPass - This pass removes potential indirect calls of 166/// malloc and free 167ModulePass *createIndMemRemPass(); 168 169/// createStripDeadPrototypesPass - This pass removes any function declarations 170/// (prototypes) that are not used. 171ModulePass *createStripDeadPrototypesPass(); 172 173} // End llvm namespace 174 175#endif 176