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