Add in some things I forgot, which Chris helpfully reminded me of...
[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 - This pass deletes as much of the module as
70 /// possible, except for the function specified.
71 ///
72 Pass *createFunctionExtractionPass(Function *F);
73
74
75 //===----------------------------------------------------------------------===//
76 /// FunctionResolvingPass - Go over the functions that are in the module and
77 /// look for functions that have the same name.  More often than not, there will
78 /// be things like:
79 ///    void "foo"(...)
80 ///    void "foo"(int, int)
81 /// because of the way things are declared in C.  If this is the case, patch
82 /// things up.
83 ///
84 /// This is an interprocedural pass.
85 ///
86 Pass *createFunctionResolvingPass();
87
88 //===----------------------------------------------------------------------===//
89 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
90 /// to inline direct function calls to small functions.
91 ///
92 Pass *createFunctionInliningPass();
93
94 //===----------------------------------------------------------------------===//
95 /// createPruneEHPass - Return a new pass object which transforms invoke
96 /// instructions into calls, if the callee can _not_ unwind the stack.
97 ///
98 Pass *createPruneEHPass();
99
100 //===----------------------------------------------------------------------===//
101 /// createInternalizePass - This pass loops over all of the functions in the
102 /// input module, looking for a main function.  If a main function is found, all
103 /// other functions are marked as internal.
104 ///
105 Pass *createInternalizePass();
106
107 //===----------------------------------------------------------------------===//
108 /// createDeadArgEliminationPass - This pass removes arguments from functions
109 /// which are not used by the body of the function.
110 ///
111 Pass *createDeadArgEliminationPass();
112
113 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
114 /// functions as well.  This is definitely not safe, and should only be used by
115 /// bugpoint.
116 Pass *createDeadArgHackingPass();
117
118 //===----------------------------------------------------------------------===//
119 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
120 /// be passed by value.
121 ///
122 Pass *createArgumentPromotionPass();
123
124 //===----------------------------------------------------------------------===//
125 /// createIPConstantPropagationPass - This pass propagates constants from call
126 /// sites into the bodies of functions.
127 ///
128 Pass *createIPConstantPropagationPass();
129
130
131 //===----------------------------------------------------------------------===//
132 /// These passes are wrappers that can do a few simple structure mutation
133 /// transformations.
134 ///
135 Pass *createSwapElementsPass();
136 Pass *createSortElementsPass();
137
138
139 //===----------------------------------------------------------------------===//
140 //
141 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
142 /// program into a function if it can.  This is used by bugpoint.
143 ///
144 Pass *createSingleLoopExtractorPass();
145
146 } // End llvm namespace
147
148 #endif