Added LLVM copyright header (for lack of a better term).
[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 class Pass;
19 class Function;
20
21 //===----------------------------------------------------------------------===//
22 // createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics to
23 // invoke/unwind instructions.  This should really be part of the C/C++
24 // front-end, but it's so much easier to write transformations in LLVM proper.
25 //
26 Pass* createLowerSetJmpPass();
27
28 //===----------------------------------------------------------------------===//
29 // createConstantMergePass - This function returns a new pass that merges
30 // duplicate global constants together into a single constant that is shared.
31 // This is useful because some passes (ie TraceValues) insert a lot of string
32 // constants into the program, regardless of whether or not they duplicate an
33 // existing string.
34 //
35 Pass *createConstantMergePass();
36
37
38 //===----------------------------------------------------------------------===//
39 // createRaiseAllocationsPass - Return a new pass that transforms malloc and
40 // free function calls into malloc and free instructions.
41 //
42 Pass *createRaiseAllocationsPass();
43
44
45 //===----------------------------------------------------------------------===//
46 // createDeadTypeEliminationPass - Return a new pass that eliminates symbol
47 // table entries for types that are never used.
48 //
49 Pass *createDeadTypeEliminationPass();
50
51
52 //===----------------------------------------------------------------------===//
53 // createGlobalDCEPass - This transform is designed to eliminate unreachable
54 // internal globals (functions or global variables)
55 //
56 Pass *createGlobalDCEPass();
57
58
59 //===----------------------------------------------------------------------===//
60 // createFunctionExtractionPass - This pass deletes as much of the module as
61 // possible, except for the function specified.
62 //
63 Pass *createFunctionExtractionPass(Function *F);
64
65
66 //===----------------------------------------------------------------------===//
67 // FunctionResolvingPass - Go over the functions that are in the module and
68 // look for functions that have the same name.  More often than not, there will
69 // be things like:
70 //    void "foo"(...)
71 //    void "foo"(int, int)
72 // because of the way things are declared in C.  If this is the case, patch
73 // things up.
74 //
75 // This is an interprocedural pass.
76 //
77 Pass *createFunctionResolvingPass();
78
79 //===----------------------------------------------------------------------===//
80 // createFunctionInliningPass - Return a new pass object that uses a heuristic
81 // to inline direct function calls to small functions.
82 //
83 Pass *createFunctionInliningPass();
84
85 //===----------------------------------------------------------------------===//
86 // createPruneEHPass - Return a new pass object which transforms invoke
87 // instructions into calls, if the callee can _not_ unwind the stack.
88 //
89 Pass *createPruneEHPass();
90
91 //===----------------------------------------------------------------------===//
92 // createInternalizePass - This pass loops over all of the functions in the
93 // input module, looking for a main function.  If a main function is found, all
94 // other functions are marked as internal.
95 //
96 Pass *createInternalizePass();
97
98 //===----------------------------------------------------------------------===//
99 // createDeadArgEliminationPass - This pass removes arguments from functions
100 // which are not used by the body of the function.  If
101 // DeleteFromExternalFunctions is true, the pass will modify functions that have
102 // external linkage, which is not usually safe (this is used by bugpoint to
103 // reduce testcases).
104 //
105 Pass *createDeadArgEliminationPass(bool DeleteFromExternalFunctions=false);
106
107
108 //===----------------------------------------------------------------------===//
109 // These passes are wrappers that can do a few simple structure mutation
110 // transformations.
111 //
112 Pass *createSwapElementsPass();
113 Pass *createSortElementsPass();
114
115 #endif