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