Add bogus conditional branch before stlx
[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 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 "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/StringRef.h"
20
21 namespace llvm {
22
23 class FunctionInfoIndex;
24 class ModulePass;
25 class Pass;
26 class Function;
27 class BasicBlock;
28 class GlobalValue;
29
30 //===----------------------------------------------------------------------===//
31 //
32 // These functions removes symbols from functions and modules.  If OnlyDebugInfo
33 // is true, only debugging information is removed from the module.
34 //
35 ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false);
36
37 //===----------------------------------------------------------------------===//
38 //
39 // These functions strips symbols from functions and modules.
40 // Only debugging information is not stripped.
41 //
42 ModulePass *createStripNonDebugSymbolsPass();
43
44 //===----------------------------------------------------------------------===//
45 //
46 // These pass removes llvm.dbg.declare intrinsics.
47 ModulePass *createStripDebugDeclarePass();
48
49 //===----------------------------------------------------------------------===//
50 //
51 // These pass removes unused symbols' debug info.
52 ModulePass *createStripDeadDebugInfoPass();
53
54 //===----------------------------------------------------------------------===//
55 /// createConstantMergePass - This function returns a new pass that merges
56 /// duplicate global constants together into a single constant that is shared.
57 /// This is useful because some passes (ie TraceValues) insert a lot of string
58 /// constants into the program, regardless of whether or not they duplicate an
59 /// existing string.
60 ///
61 ModulePass *createConstantMergePass();
62
63 //===----------------------------------------------------------------------===//
64 /// createGlobalOptimizerPass - This function returns a new pass that optimizes
65 /// non-address taken internal globals.
66 ///
67 ModulePass *createGlobalOptimizerPass();
68
69 //===----------------------------------------------------------------------===//
70 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
71 /// internal globals (functions or global variables)
72 ///
73 ModulePass *createGlobalDCEPass();
74
75 //===----------------------------------------------------------------------===//
76 /// This transform is designed to eliminate available external globals
77 /// (functions or global variables)
78 ///
79 ModulePass *createEliminateAvailableExternallyPass();
80
81 //===----------------------------------------------------------------------===//
82 /// createGVExtractionPass - If deleteFn is true, this pass deletes
83 /// the specified global values. Otherwise, it deletes as much of the module as
84 /// possible, except for the global values specified.
85 ///
86 ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
87                                    deleteFn = false);
88
89 //===----------------------------------------------------------------------===//
90 /// This pass performs iterative function importing from other modules.
91 Pass *createFunctionImportPass(const FunctionInfoIndex *Index = nullptr);
92
93 //===----------------------------------------------------------------------===//
94 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
95 /// to inline direct function calls to small functions.
96 ///
97 /// The Threshold can be passed directly, or asked to be computed from the
98 /// given optimization and size optimization arguments.
99 ///
100 /// The -inline-threshold command line option takes precedence over the
101 /// threshold given here.
102 Pass *createFunctionInliningPass();
103 Pass *createFunctionInliningPass(int Threshold);
104 Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel);
105
106 //===----------------------------------------------------------------------===//
107 /// createAlwaysInlinerPass - Return a new pass object that inlines only
108 /// functions that are marked as "always_inline".
109 Pass *createAlwaysInlinerPass();
110 Pass *createAlwaysInlinerPass(bool InsertLifetime);
111
112 //===----------------------------------------------------------------------===//
113 /// createPruneEHPass - Return a new pass object which transforms invoke
114 /// instructions into calls, if the callee can _not_ unwind the stack.
115 ///
116 Pass *createPruneEHPass();
117
118 //===----------------------------------------------------------------------===//
119 /// createInternalizePass - This pass loops over all of the functions in the
120 /// input module, internalizing all globals (functions and variables) it can.
121 ////
122 /// The symbols in \p ExportList are never internalized.
123 ///
124 /// The symbol in DSOList are internalized if it is safe to drop them from
125 /// the symbol table.
126 ///
127 /// Note that commandline options that are used with the above function are not
128 /// used now!
129 ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
130 /// createInternalizePass - Same as above, but with an empty exportList.
131 ModulePass *createInternalizePass();
132
133 //===----------------------------------------------------------------------===//
134 /// createDeadArgEliminationPass - This pass removes arguments from functions
135 /// which are not used by the body of the function.
136 ///
137 ModulePass *createDeadArgEliminationPass();
138
139 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
140 /// functions as well.  This is definitely not safe, and should only be used by
141 /// bugpoint.
142 ModulePass *createDeadArgHackingPass();
143
144 //===----------------------------------------------------------------------===//
145 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
146 /// be passed by value if the number of elements passed is smaller or
147 /// equal to maxElements (maxElements == 0 means always promote).
148 ///
149 Pass *createArgumentPromotionPass(unsigned maxElements = 3);
150
151 //===----------------------------------------------------------------------===//
152 /// createIPConstantPropagationPass - This pass propagates constants from call
153 /// sites into the bodies of functions.
154 ///
155 ModulePass *createIPConstantPropagationPass();
156
157 //===----------------------------------------------------------------------===//
158 /// createIPSCCPPass - This pass propagates constants from call sites into the
159 /// bodies of functions, and keeps track of whether basic blocks are executable
160 /// in the process.
161 ///
162 ModulePass *createIPSCCPPass();
163
164 //===----------------------------------------------------------------------===//
165 //
166 /// createLoopExtractorPass - This pass extracts all natural loops from the
167 /// program into a function if it can.
168 ///
169 Pass *createLoopExtractorPass();
170
171 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
172 /// program into a function if it can.  This is used by bugpoint.
173 ///
174 Pass *createSingleLoopExtractorPass();
175
176 /// createBlockExtractorPass - This pass extracts all blocks (except those
177 /// specified in the argument list) from the functions in the module.
178 ///
179 ModulePass *createBlockExtractorPass();
180
181 /// createStripDeadPrototypesPass - This pass removes any function declarations
182 /// (prototypes) that are not used.
183 ModulePass *createStripDeadPrototypesPass();
184
185 //===----------------------------------------------------------------------===//
186 /// createPostOrderFunctionAttrsPass - This pass walks SCCs of the call graph
187 /// in post-order to deduce and propagate function attributes. It can discover
188 /// functions that do not access memory, or only read memory, and give them the
189 /// readnone/readonly attribute. It also discovers function arguments that are
190 /// not captured by the function and marks them with the nocapture attribute.
191 ///
192 Pass *createPostOrderFunctionAttrsPass();
193
194 //===----------------------------------------------------------------------===//
195 /// createReversePostOrderFunctionAttrsPass - This pass walks SCCs of the call
196 /// graph in RPO to deduce and propagate function attributes. Currently it
197 /// only handles synthesizing norecurse attributes.
198 ///
199 Pass *createReversePostOrderFunctionAttrsPass();
200
201 //===----------------------------------------------------------------------===//
202 /// createMergeFunctionsPass - This pass discovers identical functions and
203 /// collapses them.
204 ///
205 ModulePass *createMergeFunctionsPass();
206
207 //===----------------------------------------------------------------------===//
208 /// createPartialInliningPass - This pass inlines parts of functions.
209 ///
210 ModulePass *createPartialInliningPass();
211
212 //===----------------------------------------------------------------------===//
213 // createMetaRenamerPass - Rename everything with metasyntatic names.
214 //
215 ModulePass *createMetaRenamerPass();
216
217 //===----------------------------------------------------------------------===//
218 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
219 /// manager.
220 ModulePass *createBarrierNoopPass();
221
222 /// \brief This pass lowers bitset metadata and the llvm.bitset.test intrinsic
223 /// to bitsets.
224 ModulePass *createLowerBitSetsPass();
225
226 /// \brief This pass export CFI checks for use by external modules.
227 ModulePass *createCrossDSOCFIPass();
228
229 //===----------------------------------------------------------------------===//
230 // SampleProfilePass - Loads sample profile data from disk and generates
231 // IR metadata to reflect the profile.
232 ModulePass *createSampleProfileLoaderPass();
233 ModulePass *createSampleProfileLoaderPass(StringRef Name);
234
235 } // End llvm namespace
236
237 #endif