1 //===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===//
3 // This header file defines prototypes for accessor functions that expose passes
4 // in the IPO transformations library.
6 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_TRANSFORMS_IPO_H
9 #define LLVM_TRANSFORMS_IPO_H
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.
19 Pass* createLowerSetJmpPass();
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
28 Pass *createConstantMergePass();
31 //===----------------------------------------------------------------------===//
32 // createRaiseAllocationsPass - Return a new pass that transforms malloc and
33 // free function calls into malloc and free instructions.
35 Pass *createRaiseAllocationsPass();
38 //===----------------------------------------------------------------------===//
39 // createDeadTypeEliminationPass - Return a new pass that eliminates symbol
40 // table entries for types that are never used.
42 Pass *createDeadTypeEliminationPass();
45 //===----------------------------------------------------------------------===//
46 // createGlobalDCEPass - This transform is designed to eliminate unreachable
47 // internal globals (functions or global variables)
49 Pass *createGlobalDCEPass();
52 //===----------------------------------------------------------------------===//
53 // createFunctionExtractionPass - This pass deletes as much of the module as
54 // possible, except for the function specified.
56 Pass *createFunctionExtractionPass(Function *F);
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
64 // void "foo"(int, int)
65 // because of the way things are declared in C. If this is the case, patch
68 // This is an interprocedural pass.
70 Pass *createFunctionResolvingPass();
72 //===----------------------------------------------------------------------===//
73 // createFunctionInliningPass - Return a new pass object that uses a heuristic
74 // to inline direct function calls to small functions.
76 Pass *createFunctionInliningPass();
78 //===----------------------------------------------------------------------===//
79 // createPruneEHPass - Return a new pass object which transforms invoke
80 // instructions into calls, if the callee can _not_ unwind the stack.
82 Pass *createPruneEHPass();
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.
89 Pass *createInternalizePass();
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
98 Pass *createDeadArgEliminationPass(bool DeleteFromExternalFunctions=false);
101 //===----------------------------------------------------------------------===//
102 // These passes are wrappers that can do a few simple structure mutation
105 Pass *createSwapElementsPass();
106 Pass *createSortElementsPass();