IPO.h revision 4eddf37ee31e7b962ad275c591124d90c8955f42
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
18namespace llvm {
19
20class Pass;
21class Function;
22
23//===----------------------------------------------------------------------===//
24// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics to
25// 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//
28Pass* 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//
37Pass *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//
44Pass *createGlobalConstifierPass();
45
46
47//===----------------------------------------------------------------------===//
48// createRaiseAllocationsPass - Return a new pass that transforms malloc and
49// free function calls into malloc and free instructions.
50//
51Pass *createRaiseAllocationsPass();
52
53
54//===----------------------------------------------------------------------===//
55// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
56// table entries for types that are never used.
57//
58Pass *createDeadTypeEliminationPass();
59
60
61//===----------------------------------------------------------------------===//
62// createGlobalDCEPass - This transform is designed to eliminate unreachable
63// internal globals (functions or global variables)
64//
65Pass *createGlobalDCEPass();
66
67
68//===----------------------------------------------------------------------===//
69// createFunctionExtractionPass - This pass deletes as much of the module as
70// possible, except for the function specified.
71//
72Pass *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//
86Pass *createFunctionResolvingPass();
87
88//===----------------------------------------------------------------------===//
89// createFunctionInliningPass - Return a new pass object that uses a heuristic
90// to inline direct function calls to small functions.
91//
92Pass *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//
98Pass *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//
105Pass *createInternalizePass();
106
107//===----------------------------------------------------------------------===//
108// createDeadArgEliminationPass - This pass removes arguments from functions
109// which are not used by the body of the function.
110//
111Pass *createDeadArgEliminationPass();
112
113// DeadArgHacking pass - Same as DAE, but delete arguments of external functions
114// as well.  This is definitely not safe, and should only be used by bugpoint.
115Pass *createDeadArgHackingPass();
116
117//===----------------------------------------------------------------------===//
118// createArgumentPromotionPass - This pass promotes "by reference" arguments to
119// be passed by value.
120//
121Pass *createArgumentPromotionPass();
122
123//===----------------------------------------------------------------------===//
124// createIPConstantPropagationPass - This pass propagates constants from call
125// sites into the bodies of functions.
126//
127Pass *createIPConstantPropagationPass();
128
129
130//===----------------------------------------------------------------------===//
131// These passes are wrappers that can do a few simple structure mutation
132// transformations.
133//
134Pass *createSwapElementsPass();
135Pass *createSortElementsPass();
136
137
138//===----------------------------------------------------------------------===//
139//
140// LoopExtractor - This pass moves every natural loop into its own function.
141// Mostly useful in debugging via bugpoint.
142//
143Pass *createLoopExtractorPass();
144
145} // End llvm namespace
146
147#endif
148