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