4f0809a69dbcd52b7f3e43ead00eecc04771834b
[oota-llvm.git] / include / llvm / Transforms / IPO.h
1 //===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===//
2 //
3 // This header file defines prototypes for accessor functions that expose passes
4 // in the IPO transformations library.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef LLVM_TRANSFORMS_IPO_H
9 #define LLVM_TRANSFORMS_IPO_H
10
11 class Pass;
12 class Function;
13
14 //===----------------------------------------------------------------------===//
15 // createConstantMergePass - This function returns a new pass that merges
16 // duplicate global constants together into a single constant that is shared.
17 // This is useful because some passes (ie TraceValues) insert a lot of string
18 // constants into the program, regardless of whether or not they duplicate an
19 // existing string.
20 //
21 Pass *createConstantMergePass();
22
23
24 //===----------------------------------------------------------------------===//
25 // createRaiseAllocationsPass - Return a new pass that transforms malloc and
26 // free function calls into malloc and free instructions.
27 //
28 Pass *createRaiseAllocationsPass();
29
30
31 //===----------------------------------------------------------------------===//
32 // createDeadTypeEliminationPass - Return a new pass that eliminates symbol
33 // table entries for types that are never used.
34 //
35 Pass *createDeadTypeEliminationPass();
36
37
38 //===----------------------------------------------------------------------===//
39 // createGlobalDCEPass - This transform is designed to eliminate unreachable
40 // internal globals (functions or global variables)
41 //
42 Pass *createGlobalDCEPass();
43
44
45 //===----------------------------------------------------------------------===//
46 // createFunctionExtractionPass - This pass deletes as much of the module as
47 // possible, except for the function specified.
48 //
49 Pass *createFunctionExtractionPass(Function *F);
50
51
52 //===----------------------------------------------------------------------===//
53 // FunctionResolvingPass - Go over the functions that are in the module and
54 // look for functions that have the same name.  More often than not, there will
55 // be things like:
56 //    void "foo"(...)
57 //    void "foo"(int, int)
58 // because of the way things are declared in C.  If this is the case, patch
59 // things up.
60 //
61 // This is an interprocedural pass.
62 //
63 Pass *createFunctionResolvingPass();
64
65 //===----------------------------------------------------------------------===//
66 // createFunctionInliningPass - Return a new pass object that uses a heuristic
67 // to inline direct function calls to small functions.
68 //
69 Pass *createFunctionInliningPass();
70
71 //===----------------------------------------------------------------------===//
72 // createPruneEHPass - Return a new pass object which transforms invoke
73 // instructions into calls, if the callee can _not_ unwind the stack.
74 //
75 Pass *createPruneEHPass();
76
77 //===----------------------------------------------------------------------===//
78 // createInternalizePass - This pass loops over all of the functions in the
79 // input module, looking for a main function.  If a main function is found, all
80 // other functions are marked as internal.
81 //
82 Pass *createInternalizePass();
83
84 //===----------------------------------------------------------------------===//
85 // createDeadArgEliminationPass - This pass removes arguments from functions
86 // which are not used by the body of the function.  If
87 // DeleteFromExternalFunctions is true, the pass will modify functions that have
88 // external linkage, which is not usually safe (this is used by bugpoint to
89 // reduce testcases).
90 //
91 Pass *createDeadArgEliminationPass(bool DeleteFromExternalFunctions=false);
92
93
94 //===----------------------------------------------------------------------===//
95 // These passes are wrappers that can do a few simple structure mutation
96 // transformations.
97 //
98 Pass *createSwapElementsPass();
99 Pass *createSortElementsPass();
100
101 #endif