Clarify the logic: the flag is renamed to `deleteFn' to signify it will delete
[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 namespace llvm {
19
20 class Pass;
21 class Function;
22
23 //===----------------------------------------------------------------------===//
24 /// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics
25 /// to invoke/unwind instructions.  This should really be part of the C/C++
26 /// front-end, but it's so much easier to write transformations in LLVM proper.
27 ///
28 Pass* createLowerSetJmpPass();
29
30 //===----------------------------------------------------------------------===//
31 /// createConstantMergePass - This function returns a new pass that merges
32 /// duplicate global constants together into a single constant that is shared.
33 /// This is useful because some passes (ie TraceValues) insert a lot of string
34 /// constants into the program, regardless of whether or not they duplicate an
35 /// existing string.
36 ///
37 Pass *createConstantMergePass();
38
39
40 //===----------------------------------------------------------------------===//
41 /// createGlobalConstifierPass - This function returns a new pass that marks
42 /// internal globals "constant" if they are provably never written to.
43 ///
44 Pass *createGlobalConstifierPass();
45
46
47 //===----------------------------------------------------------------------===//
48 /// createRaiseAllocationsPass - Return a new pass that transforms malloc and
49 /// free function calls into malloc and free instructions.
50 ///
51 Pass *createRaiseAllocationsPass();
52
53
54 //===----------------------------------------------------------------------===//
55 /// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
56 /// table entries for types that are never used.
57 ///
58 Pass *createDeadTypeEliminationPass();
59
60
61 //===----------------------------------------------------------------------===//
62 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
63 /// internal globals (functions or global variables)
64 ///
65 Pass *createGlobalDCEPass();
66
67
68 //===----------------------------------------------------------------------===//
69 /// createFunctionExtractionPass - If deleteFn is true, this pass deletes as 
70 /// the specified function. Otherwise, it deletes as much of the module as
71 /// possible, except for the function specified.
72 ///
73 Pass *createFunctionExtractionPass(Function *F, bool deleteFn = false);
74
75
76 //===----------------------------------------------------------------------===//
77 /// FunctionResolvingPass - Go over the functions that are in the module and
78 /// look for functions that have the same name.  More often than not, there will
79 /// be things like:
80 ///    void "foo"(...)
81 ///    void "foo"(int, int)
82 /// because of the way things are declared in C.  If this is the case, patch
83 /// things up.
84 ///
85 /// This is an interprocedural pass.
86 ///
87 Pass *createFunctionResolvingPass();
88
89 //===----------------------------------------------------------------------===//
90 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
91 /// to inline direct function calls to small functions.
92 ///
93 Pass *createFunctionInliningPass();
94
95 //===----------------------------------------------------------------------===//
96 /// createPruneEHPass - Return a new pass object which transforms invoke
97 /// instructions into calls, if the callee can _not_ unwind the stack.
98 ///
99 Pass *createPruneEHPass();
100
101 //===----------------------------------------------------------------------===//
102 /// createInternalizePass - This pass loops over all of the functions in the
103 /// input module, looking for a main function.  If a main function is found, all
104 /// other functions are marked as internal.
105 ///
106 Pass *createInternalizePass();
107
108 //===----------------------------------------------------------------------===//
109 /// createDeadArgEliminationPass - This pass removes arguments from functions
110 /// which are not used by the body of the function.
111 ///
112 Pass *createDeadArgEliminationPass();
113
114 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
115 /// functions as well.  This is definitely not safe, and should only be used by
116 /// bugpoint.
117 Pass *createDeadArgHackingPass();
118
119 //===----------------------------------------------------------------------===//
120 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
121 /// be passed by value.
122 ///
123 Pass *createArgumentPromotionPass();
124
125 //===----------------------------------------------------------------------===//
126 /// createIPConstantPropagationPass - This pass propagates constants from call
127 /// sites into the bodies of functions.
128 ///
129 Pass *createIPConstantPropagationPass();
130
131
132 //===----------------------------------------------------------------------===//
133 /// These passes are wrappers that can do a few simple structure mutation
134 /// transformations.
135 ///
136 Pass *createSwapElementsPass();
137 Pass *createSortElementsPass();
138
139
140 //===----------------------------------------------------------------------===//
141 //
142 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
143 /// program into a function if it can.  This is used by bugpoint.
144 ///
145 Pass *createSingleLoopExtractorPass();
146
147 } // End llvm namespace
148
149 #endif