Fixed/added namespace ending comments using clang-tidy. NFC
[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
20 namespace llvm {
21
22 class ModulePass;
23 class Pass;
24 class Function;
25 class BasicBlock;
26 class GlobalValue;
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 //
33 ModulePass *createStripSymbolsPass(bool OnlyDebugInfo = false);
34
35 //===----------------------------------------------------------------------===//
36 //
37 // These functions strips symbols from functions and modules.
38 // Only debugging information is not stripped.
39 //
40 ModulePass *createStripNonDebugSymbolsPass();
41
42 //===----------------------------------------------------------------------===//
43 //
44 // These pass removes llvm.dbg.declare intrinsics.
45 ModulePass *createStripDebugDeclarePass();
46
47 //===----------------------------------------------------------------------===//
48 //
49 // These pass removes unused symbols' debug info.
50 ModulePass *createStripDeadDebugInfoPass();
51
52 //===----------------------------------------------------------------------===//
53 /// createConstantMergePass - This function returns a new pass that merges
54 /// duplicate global constants together into a single constant that is shared.
55 /// This is useful because some passes (ie TraceValues) insert a lot of string
56 /// constants into the program, regardless of whether or not they duplicate an
57 /// existing string.
58 ///
59 ModulePass *createConstantMergePass();
60
61 //===----------------------------------------------------------------------===//
62 /// createGlobalOptimizerPass - This function returns a new pass that optimizes
63 /// non-address taken internal globals.
64 ///
65 ModulePass *createGlobalOptimizerPass();
66
67 //===----------------------------------------------------------------------===//
68 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
69 /// internal globals (functions or global variables)
70 ///
71 ModulePass *createGlobalDCEPass();
72
73 //===----------------------------------------------------------------------===//
74 /// createGVExtractionPass - If deleteFn is true, this pass deletes
75 /// the specified global values. Otherwise, it deletes as much of the module as
76 /// possible, except for the global values specified.
77 ///
78 ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
79                                    deleteFn = false);
80
81 //===----------------------------------------------------------------------===//
82 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
83 /// to inline direct function calls to small functions.
84 ///
85 /// The Threshold can be passed directly, or asked to be computed from the
86 /// given optimization and size optimization arguments.
87 ///
88 /// The -inline-threshold command line option takes precedence over the
89 /// threshold given here.
90 Pass *createFunctionInliningPass();
91 Pass *createFunctionInliningPass(int Threshold);
92 Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel);
93
94 //===----------------------------------------------------------------------===//
95 /// createAlwaysInlinerPass - Return a new pass object that inlines only
96 /// functions that are marked as "always_inline".
97 Pass *createAlwaysInlinerPass();
98 Pass *createAlwaysInlinerPass(bool InsertLifetime);
99
100 //===----------------------------------------------------------------------===//
101 /// createPruneEHPass - Return a new pass object which transforms invoke
102 /// instructions into calls, if the callee can _not_ unwind the stack.
103 ///
104 Pass *createPruneEHPass();
105
106 //===----------------------------------------------------------------------===//
107 /// createInternalizePass - This pass loops over all of the functions in the
108 /// input module, internalizing all globals (functions and variables) it can.
109 ////
110 /// The symbols in \p ExportList are never internalized.
111 ///
112 /// The symbol in DSOList are internalized if it is safe to drop them from
113 /// the symbol table.
114 ///
115 /// Note that commandline options that are used with the above function are not
116 /// used now!
117 ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
118 /// createInternalizePass - Same as above, but with an empty exportList.
119 ModulePass *createInternalizePass();
120
121 //===----------------------------------------------------------------------===//
122 /// createDeadArgEliminationPass - This pass removes arguments from functions
123 /// which are not used by the body of the function.
124 ///
125 ModulePass *createDeadArgEliminationPass();
126
127 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
128 /// functions as well.  This is definitely not safe, and should only be used by
129 /// bugpoint.
130 ModulePass *createDeadArgHackingPass();
131
132 //===----------------------------------------------------------------------===//
133 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
134 /// be passed by value if the number of elements passed is smaller or
135 /// equal to maxElements (maxElements == 0 means always promote).
136 ///
137 Pass *createArgumentPromotionPass(unsigned maxElements = 3);
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 Pass *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 Pass *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();
168
169 /// createStripDeadPrototypesPass - This pass removes any function declarations
170 /// (prototypes) that are not used.
171 ModulePass *createStripDeadPrototypesPass();
172
173 //===----------------------------------------------------------------------===//
174 /// createFunctionAttrsPass - This pass discovers functions that do not access
175 /// memory, or only read memory, and gives them the readnone/readonly attribute.
176 /// It also discovers function arguments that are not captured by the function
177 /// and marks them with the nocapture attribute.
178 ///
179 Pass *createFunctionAttrsPass();
180
181 //===----------------------------------------------------------------------===//
182 /// createMergeFunctionsPass - This pass discovers identical functions and
183 /// collapses them.
184 ///
185 ModulePass *createMergeFunctionsPass();
186
187 //===----------------------------------------------------------------------===//
188 /// createPartialInliningPass - This pass inlines parts of functions.
189 ///
190 ModulePass *createPartialInliningPass();
191
192 //===----------------------------------------------------------------------===//
193 // createMetaRenamerPass - Rename everything with metasyntatic names.
194 //
195 ModulePass *createMetaRenamerPass();
196
197 //===----------------------------------------------------------------------===//
198 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
199 /// manager.
200 ModulePass *createBarrierNoopPass();
201
202 /// \brief This pass lowers bitset metadata and the llvm.bitset.test intrinsic
203 /// to bitsets.
204 ModulePass *createLowerBitSetsPass();
205
206 } // namespace llvm
207
208 #endif