1 //===- llvm/Transforms/IPO.h - Interprocedural Transformations --*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This header file defines prototypes for accessor functions that expose passes
11 // in the IPO transformations library.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_IPO_H
16 #define LLVM_TRANSFORMS_IPO_H
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.
26 Pass* createLowerSetJmpPass();
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
35 Pass *createConstantMergePass();
38 //===----------------------------------------------------------------------===//
39 // createRaiseAllocationsPass - Return a new pass that transforms malloc and
40 // free function calls into malloc and free instructions.
42 Pass *createRaiseAllocationsPass();
45 //===----------------------------------------------------------------------===//
46 // createDeadTypeEliminationPass - Return a new pass that eliminates symbol
47 // table entries for types that are never used.
49 Pass *createDeadTypeEliminationPass();
52 //===----------------------------------------------------------------------===//
53 // createGlobalDCEPass - This transform is designed to eliminate unreachable
54 // internal globals (functions or global variables)
56 Pass *createGlobalDCEPass();
59 //===----------------------------------------------------------------------===//
60 // createFunctionExtractionPass - This pass deletes as much of the module as
61 // possible, except for the function specified.
63 Pass *createFunctionExtractionPass(Function *F);
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
71 // void "foo"(int, int)
72 // because of the way things are declared in C. If this is the case, patch
75 // This is an interprocedural pass.
77 Pass *createFunctionResolvingPass();
79 //===----------------------------------------------------------------------===//
80 // createFunctionInliningPass - Return a new pass object that uses a heuristic
81 // to inline direct function calls to small functions.
83 Pass *createFunctionInliningPass();
85 //===----------------------------------------------------------------------===//
86 // createPruneEHPass - Return a new pass object which transforms invoke
87 // instructions into calls, if the callee can _not_ unwind the stack.
89 Pass *createPruneEHPass();
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.
96 Pass *createInternalizePass();
98 //===----------------------------------------------------------------------===//
99 // createDeadArgEliminationPass - This pass removes arguments from functions
100 // which are not used by the body of the function.
102 Pass *createDeadArgEliminationPass();
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.
106 Pass *createDeadArgHackingPass();
108 //===----------------------------------------------------------------------===//
109 // createIPConstantPropagationPass - This pass propagates constants from call
110 // sites into the bodies of functions.
112 Pass *createIPConstantPropagationPass();
115 //===----------------------------------------------------------------------===//
116 // These passes are wrappers that can do a few simple structure mutation
119 Pass *createSwapElementsPass();
120 Pass *createSortElementsPass();