IPO.h revision 3323f2abbdfd2978f05d5260c63504c2325e76f0
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
18class Pass;
19class 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//
26Pass* 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//
35Pass *createConstantMergePass();
36
37
38//===----------------------------------------------------------------------===//
39// createRaiseAllocationsPass - Return a new pass that transforms malloc and
40// free function calls into malloc and free instructions.
41//
42Pass *createRaiseAllocationsPass();
43
44
45//===----------------------------------------------------------------------===//
46// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
47// table entries for types that are never used.
48//
49Pass *createDeadTypeEliminationPass();
50
51
52//===----------------------------------------------------------------------===//
53// createGlobalDCEPass - This transform is designed to eliminate unreachable
54// internal globals (functions or global variables)
55//
56Pass *createGlobalDCEPass();
57
58
59//===----------------------------------------------------------------------===//
60// createFunctionExtractionPass - This pass deletes as much of the module as
61// possible, except for the function specified.
62//
63Pass *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//
77Pass *createFunctionResolvingPass();
78
79//===----------------------------------------------------------------------===//
80// createFunctionInliningPass - Return a new pass object that uses a heuristic
81// to inline direct function calls to small functions.
82//
83Pass *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//
89Pass *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//
96Pass *createInternalizePass();
97
98//===----------------------------------------------------------------------===//
99// createDeadArgEliminationPass - This pass removes arguments from functions
100// which are not used by the body of the function.
101//
102Pass *createDeadArgEliminationPass();
103
104// DeadArgHacking pass - Same as DAE, but delete arguments of external functions
105// as well.  This is definately not safe, and should only be used by bugpoint.
106Pass *createDeadArgHackingPass();
107
108//===----------------------------------------------------------------------===//
109// createIPConstantPropagationPass - This pass propagates constants from call
110// sites into the bodies of functions.
111//
112Pass *createIPConstantPropagationPass();
113
114
115//===----------------------------------------------------------------------===//
116// These passes are wrappers that can do a few simple structure mutation
117// transformations.
118//
119Pass *createSwapElementsPass();
120Pass *createSortElementsPass();
121
122#endif
123