LLVM  3.7.0
Transforms/IPO.h
Go to the documentation of this file.
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 /// This transform is designed to eliminate available external globals
75 /// (functions or global variables)
76 ///
78 
79 //===----------------------------------------------------------------------===//
80 /// createGVExtractionPass - If deleteFn is true, this pass deletes
81 /// the specified global values. Otherwise, it deletes as much of the module as
82 /// possible, except for the global values specified.
83 ///
84 ModulePass *createGVExtractionPass(std::vector<GlobalValue*>& GVs, bool
85  deleteFn = false);
86 
87 //===----------------------------------------------------------------------===//
88 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
89 /// to inline direct function calls to small functions.
90 ///
91 /// The Threshold can be passed directly, or asked to be computed from the
92 /// given optimization and size optimization arguments.
93 ///
94 /// The -inline-threshold command line option takes precedence over the
95 /// threshold given here.
98 Pass *createFunctionInliningPass(unsigned OptLevel, unsigned SizeOptLevel);
99 
100 //===----------------------------------------------------------------------===//
101 /// createAlwaysInlinerPass - Return a new pass object that inlines only
102 /// functions that are marked as "always_inline".
104 Pass *createAlwaysInlinerPass(bool InsertLifetime);
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 ///
111 
112 //===----------------------------------------------------------------------===//
113 /// createInternalizePass - This pass loops over all of the functions in the
114 /// input module, internalizing all globals (functions and variables) it can.
115 ////
116 /// The symbols in \p ExportList are never internalized.
117 ///
118 /// The symbol in DSOList are internalized if it is safe to drop them from
119 /// the symbol table.
120 ///
121 /// Note that commandline options that are used with the above function are not
122 /// used now!
123 ModulePass *createInternalizePass(ArrayRef<const char *> ExportList);
124 /// createInternalizePass - Same as above, but with an empty exportList.
125 ModulePass *createInternalizePass();
126 
127 //===----------------------------------------------------------------------===//
128 /// createDeadArgEliminationPass - This pass removes arguments from functions
129 /// which are not used by the body of the function.
130 ///
131 ModulePass *createDeadArgEliminationPass();
132 
133 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
134 /// functions as well. This is definitely not safe, and should only be used by
135 /// bugpoint.
136 ModulePass *createDeadArgHackingPass();
137 
138 //===----------------------------------------------------------------------===//
139 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
140 /// be passed by value if the number of elements passed is smaller or
141 /// equal to maxElements (maxElements == 0 means always promote).
142 ///
143 Pass *createArgumentPromotionPass(unsigned maxElements = 3);
144 
145 //===----------------------------------------------------------------------===//
146 /// createIPConstantPropagationPass - This pass propagates constants from call
147 /// sites into the bodies of functions.
148 ///
149 ModulePass *createIPConstantPropagationPass();
150 
151 //===----------------------------------------------------------------------===//
152 /// createIPSCCPPass - This pass propagates constants from call sites into the
153 /// bodies of functions, and keeps track of whether basic blocks are executable
154 /// in the process.
155 ///
156 ModulePass *createIPSCCPPass();
157 
158 //===----------------------------------------------------------------------===//
159 //
160 /// createLoopExtractorPass - This pass extracts all natural loops from the
161 /// program into a function if it can.
162 ///
164 
165 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
166 /// program into a function if it can. This is used by bugpoint.
167 ///
169 
170 /// createBlockExtractorPass - This pass extracts all blocks (except those
171 /// specified in the argument list) from the functions in the module.
172 ///
173 ModulePass *createBlockExtractorPass();
174 
175 /// createStripDeadPrototypesPass - This pass removes any function declarations
176 /// (prototypes) that are not used.
177 ModulePass *createStripDeadPrototypesPass();
178 
179 //===----------------------------------------------------------------------===//
180 /// createFunctionAttrsPass - This pass discovers functions that do not access
181 /// memory, or only read memory, and gives them the readnone/readonly attribute.
182 /// It also discovers function arguments that are not captured by the function
183 /// and marks them with the nocapture attribute.
184 ///
186 
187 //===----------------------------------------------------------------------===//
188 /// createMergeFunctionsPass - This pass discovers identical functions and
189 /// collapses them.
190 ///
191 ModulePass *createMergeFunctionsPass();
192 
193 //===----------------------------------------------------------------------===//
194 /// createPartialInliningPass - This pass inlines parts of functions.
195 ///
196 ModulePass *createPartialInliningPass();
197 
198 //===----------------------------------------------------------------------===//
199 // createMetaRenamerPass - Rename everything with metasyntatic names.
200 //
201 ModulePass *createMetaRenamerPass();
202 
203 //===----------------------------------------------------------------------===//
204 /// createBarrierNoopPass - This pass is purely a module pass barrier in a pass
205 /// manager.
206 ModulePass *createBarrierNoopPass();
207 
208 /// \brief This pass lowers bitset metadata and the llvm.bitset.test intrinsic
209 /// to bitsets.
210 ModulePass *createLowerBitSetsPass();
211 
212 } // End llvm namespace
213 
214 #endif
ModulePass * createIPConstantPropagationPass()
createIPConstantPropagationPass - This pass propagates constants from call sites into the bodies of f...
Various leaf nodes.
Definition: ISDOpcodes.h:60
ModulePass * createMergeFunctionsPass()
createMergeFunctionsPass - This pass discovers identical functions and collapses them.
ModulePass * createIPSCCPPass()
createIPSCCPPass - This pass propagates constants from call sites into the bodies of functions...
Definition: SCCP.cpp:1661
Pass * createSingleLoopExtractorPass()
createSingleLoopExtractorPass - This pass extracts one natural loop from the program into a function ...
ModulePass * createEliminateAvailableExternallyPass()
This transform is designed to eliminate available external globals (functions or global variables) ...
Pass * createAlwaysInlinerPass()
createAlwaysInlinerPass - Return a new pass object that inlines only functions that are marked as "al...
ModulePass * createStripNonDebugSymbolsPass()
Pass * createFunctionAttrsPass()
createFunctionAttrsPass - This pass discovers functions that do not access memory, or only read memory, and gives them the readnone/readonly attribute.
ModulePass * createBlockExtractorPass()
createBlockExtractorPass - This pass extracts all blocks (except those specified in the argument list...
ModulePass * createStripDeadDebugInfoPass()
ModulePass * createDeadArgHackingPass()
DeadArgHacking pass - Same as DAE, but delete arguments of external functions as well.
Pass * createArgumentPromotionPass(unsigned maxElements=3)
createArgumentPromotionPass - This pass promotes "by reference" arguments to be passed by value if th...
ModulePass * createGlobalDCEPass()
createGlobalDCEPass - This transform is designed to eliminate unreachable internal globals (functions...
ModulePass * createLowerBitSetsPass()
This pass lowers bitset metadata and the llvm.bitset.test intrinsic to bitsets.
ModulePass * createDeadArgEliminationPass()
createDeadArgEliminationPass - This pass removes arguments from functions which are not used by the b...
ModulePass * createBarrierNoopPass()
createBarrierNoopPass - This pass is purely a module pass barrier in a pass manager.
ModulePass * createConstantMergePass()
createConstantMergePass - This function returns a new pass that merges duplicate global constants tog...
ModulePass * createGlobalOptimizerPass()
createGlobalOptimizerPass - This function returns a new pass that optimizes non-address taken interna...
Definition: GlobalOpt.cpp:101
ModulePass * createStripDebugDeclarePass()
aarch64 type AArch64 Type Promotion Pass
Pass * createLoopExtractorPass()
createLoopExtractorPass - This pass extracts all natural loops from the program into a function if it...
ModulePass * createInternalizePass(ArrayRef< const char * > ExportList)
createInternalizePass - This pass loops over all of the functions in the input module, internalizing all globals (functions and variables) it can.
static int const Threshold
TODO: Write a new FunctionPass AliasAnalysis so that it can keep a cache.
ModulePass * createPartialInliningPass()
createPartialInliningPass - This pass inlines parts of functions.
Pass * createFunctionInliningPass()
createFunctionInliningPass - Return a new pass object that uses a heuristic to inline direct function...
Pass * createPruneEHPass()
createPruneEHPass - Return a new pass object which transforms invoke instructions into calls...
Definition: PruneEH.cpp:62
ModulePass * createStripDeadPrototypesPass()
createStripDeadPrototypesPass - This pass removes any function declarations (prototypes) that are not...
ModulePass * createStripSymbolsPass(bool OnlyDebugInfo=false)
ModulePass * createGVExtractionPass(std::vector< GlobalValue * > &GVs, bool deleteFn=false)
createGVExtractionPass - If deleteFn is true, this pass deletes the specified global values...
Definition: ExtractGV.cpp:157
ModulePass * createMetaRenamerPass()