IPO.h revision 9b2a14b6f1a7e1dc93f47778adb2d68f327f5ab9
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// 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//
21Pass *createConstantMergePass();
22
23
24//===----------------------------------------------------------------------===//
25// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
26// table entries for types that are never used.
27//
28Pass *createDeadTypeEliminationPass();
29
30
31//===----------------------------------------------------------------------===//
32// createGlobalDCEPass - This transform is designed to eliminate unreachable
33// internal globals (functions or global variables)
34//
35Pass *createGlobalDCEPass();
36
37
38//===----------------------------------------------------------------------===//
39// createFunctionExtractionPass - This pass deletes as much of the module as
40// possible, except for the function specified.
41//
42Pass *createFunctionExtractionPass(Function *F);
43
44
45//===----------------------------------------------------------------------===//
46// FunctionResolvingPass - Go over the functions that are in the module and
47// look for functions that have the same name.  More often than not, there will
48// be things like:
49//    void "foo"(...)
50//    void "foo"(int, int)
51// because of the way things are declared in C.  If this is the case, patch
52// things up.
53//
54// This is an interprocedural pass.
55//
56Pass *createFunctionResolvingPass();
57
58//===----------------------------------------------------------------------===//
59// createFunctionInliningPass - Return a new pass object that uses a heuristic
60// to inline direct function calls to small functions.
61//
62Pass *createFunctionInliningPass();
63
64//===----------------------------------------------------------------------===//
65// createInternalizePass - This pass loops over all of the functions in the
66// input module, looking for a main function.  If a main function is found, all
67// other functions are marked as internal.
68//
69Pass *createInternalizePass();
70
71//===----------------------------------------------------------------------===//
72// createDeadArgEliminationPass - This pass removes arguments from functions
73// which are not used by the body of the function.  If
74// DeleteFromExternalFunctions is true, the pass will modify functions that have
75// external linkage, which is not usually safe (this is used by bugpoint to
76// reduce testcases).
77//
78Pass *createDeadArgEliminationPass(bool DeleteFromExternalFunctions=false);
79
80
81//===----------------------------------------------------------------------===//
82// These passes are wrappers that can do a few simple structure mutation
83// transformations.
84//
85Pass *createSwapElementsPass();
86Pass *createSortElementsPass();
87
88#endif
89