IPO.h revision 3c0517652645a283e9d1d2ee3aa7d63f6e9af90e
1//===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file was developed by the LLVM research group and is distributed under 6// the University of Illinois Open Source 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 ModulePass; 23class Function; 24class BasicBlock; 25 26//===----------------------------------------------------------------------===// 27// 28// These functions removes symbols from functions and modules. If OnlyDebugInfo 29// is true, only debugging information is removed from the module. 30// 31ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false); 32 33//===----------------------------------------------------------------------===// 34/// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics 35/// to invoke/unwind instructions. This should really be part of the C/C++ 36/// front-end, but it's so much easier to write transformations in LLVM proper. 37/// 38ModulePass* createLowerSetJmpPass(); 39 40//===----------------------------------------------------------------------===// 41/// createConstantMergePass - This function returns a new pass that merges 42/// duplicate global constants together into a single constant that is shared. 43/// This is useful because some passes (ie TraceValues) insert a lot of string 44/// constants into the program, regardless of whether or not they duplicate an 45/// existing string. 46/// 47ModulePass *createConstantMergePass(); 48 49 50//===----------------------------------------------------------------------===// 51/// createGlobalOptimizerPass - This function returns a new pass that optimizes 52/// non-address taken internal globals. 53/// 54ModulePass *createGlobalOptimizerPass(); 55 56 57//===----------------------------------------------------------------------===// 58/// createRaiseAllocationsPass - Return a new pass that transforms malloc and 59/// free function calls into malloc and free instructions. 60/// 61ModulePass *createRaiseAllocationsPass(); 62 63 64//===----------------------------------------------------------------------===// 65/// createDeadTypeEliminationPass - Return a new pass that eliminates symbol 66/// table entries for types that are never used. 67/// 68ModulePass *createDeadTypeEliminationPass(); 69 70 71//===----------------------------------------------------------------------===// 72/// createGlobalDCEPass - This transform is designed to eliminate unreachable 73/// internal globals (functions or global variables) 74/// 75ModulePass *createGlobalDCEPass(); 76 77 78//===----------------------------------------------------------------------===// 79/// createFunctionExtractionPass - If deleteFn is true, this pass deletes as 80/// the specified function. Otherwise, it deletes as much of the module as 81/// possible, except for the function specified. 82/// 83ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false); 84 85 86//===----------------------------------------------------------------------===// 87/// FunctionResolvingPass - Go over the functions that are in the module and 88/// look for functions that have the same name. More often than not, there will 89/// be things like: 90/// void "foo"(...) 91/// void "foo"(int, int) 92/// because of the way things are declared in C. If this is the case, patch 93/// things up. 94/// 95/// This is an interprocedural pass. 96/// 97ModulePass *createFunctionResolvingPass(); 98 99//===----------------------------------------------------------------------===// 100/// createFunctionInliningPass - Return a new pass object that uses a heuristic 101/// to inline direct function calls to small functions. 102/// 103ModulePass *createFunctionInliningPass(); 104 105//===----------------------------------------------------------------------===// 106/// createPruneEHPass - Return a new pass object which transforms invoke 107/// instructions into calls, if the callee can _not_ unwind the stack. 108/// 109ModulePass *createPruneEHPass(); 110 111//===----------------------------------------------------------------------===// 112/// createInternalizePass - This pass loops over all of the functions in the 113/// input module, looking for a main function. If a main function is found, all 114/// other functions are marked as internal. 115/// 116ModulePass *createInternalizePass(); 117 118//===----------------------------------------------------------------------===// 119/// createDeadArgEliminationPass - This pass removes arguments from functions 120/// which are not used by the body of the function. 121/// 122ModulePass *createDeadArgEliminationPass(); 123 124/// DeadArgHacking pass - Same as DAE, but delete arguments of external 125/// functions as well. This is definitely not safe, and should only be used by 126/// bugpoint. 127ModulePass *createDeadArgHackingPass(); 128 129//===----------------------------------------------------------------------===// 130/// createArgumentPromotionPass - This pass promotes "by reference" arguments to 131/// be passed by value. 132/// 133ModulePass *createArgumentPromotionPass(); 134 135//===----------------------------------------------------------------------===// 136/// createIPConstantPropagationPass - This pass propagates constants from call 137/// sites into the bodies of functions. 138/// 139ModulePass *createIPConstantPropagationPass(); 140 141//===----------------------------------------------------------------------===// 142/// createIPSCCPPass - This pass propagates constants from call sites into the 143/// bodies of functions, and keeps track of whether basic blocks are executable 144/// in the process. 145/// 146ModulePass *createIPSCCPPass(); 147 148//===----------------------------------------------------------------------===// 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/// 153ModulePass *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(std::vector<BasicBlock*> &BTNE); 159 160} // End llvm namespace 161 162#endif 163