1 //===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This header file defines prototypes for accessor functions that expose passes
11 // in the IPO transformations library.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_IPO_H
16 #define LLVM_TRANSFORMS_IPO_H
26 //===----------------------------------------------------------------------===//
28 // These functions removes symbols from functions and modules. If OnlyDebugInfo
29 // is true, only debugging information is removed from the module.
31 ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false);
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.
38 ModulePass* createLowerSetJmpPass();
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
47 ModulePass *createConstantMergePass();
50 //===----------------------------------------------------------------------===//
51 /// createGlobalOptimizerPass - This function returns a new pass that optimizes
52 /// non-address taken internal globals.
54 ModulePass *createGlobalOptimizerPass();
57 //===----------------------------------------------------------------------===//
58 /// createRaiseAllocationsPass - Return a new pass that transforms malloc and
59 /// free function calls into malloc and free instructions.
61 ModulePass *createRaiseAllocationsPass();
64 //===----------------------------------------------------------------------===//
65 /// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
66 /// table entries for types that are never used.
68 ModulePass *createDeadTypeEliminationPass();
71 //===----------------------------------------------------------------------===//
72 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
73 /// internal globals (functions or global variables)
75 ModulePass *createGlobalDCEPass();
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.
83 ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false);
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
91 /// void "foo"(int, int)
92 /// because of the way things are declared in C. If this is the case, patch
95 /// This is an interprocedural pass.
97 ModulePass *createFunctionResolvingPass();
99 //===----------------------------------------------------------------------===//
100 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
101 /// to inline direct function calls to small functions.
103 ModulePass *createFunctionInliningPass();
105 //===----------------------------------------------------------------------===//
106 /// createPruneEHPass - Return a new pass object which transforms invoke
107 /// instructions into calls, if the callee can _not_ unwind the stack.
109 ModulePass *createPruneEHPass();
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.
116 ModulePass *createInternalizePass();
118 //===----------------------------------------------------------------------===//
119 /// createDeadArgEliminationPass - This pass removes arguments from functions
120 /// which are not used by the body of the function.
122 ModulePass *createDeadArgEliminationPass();
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
127 ModulePass *createDeadArgHackingPass();
129 //===----------------------------------------------------------------------===//
130 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
131 /// be passed by value.
133 ModulePass *createArgumentPromotionPass();
135 //===----------------------------------------------------------------------===//
136 /// createIPConstantPropagationPass - This pass propagates constants from call
137 /// sites into the bodies of functions.
139 ModulePass *createIPConstantPropagationPass();
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
146 ModulePass *createIPSCCPPass();
148 //===----------------------------------------------------------------------===//
150 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
151 /// program into a function if it can. This is used by bugpoint.
153 ModulePass *createSingleLoopExtractorPass();
155 // createBlockExtractorPass - This pass extracts all blocks (except those
156 // specified in the argument list) from the functions in the module.
158 ModulePass *createBlockExtractorPass(std::vector<BasicBlock*> &BTNE);
160 } // End llvm namespace