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
23 //===----------------------------------------------------------------------===//
24 // createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics to
25 // invoke/unwind instructions. This should really be part of the C/C++
26 // front-end, but it's so much easier to write transformations in LLVM proper.
28 Pass* createLowerSetJmpPass();
30 //===----------------------------------------------------------------------===//
31 // createConstantMergePass - This function returns a new pass that merges
32 // duplicate global constants together into a single constant that is shared.
33 // This is useful because some passes (ie TraceValues) insert a lot of string
34 // constants into the program, regardless of whether or not they duplicate an
37 Pass *createConstantMergePass();
40 //===----------------------------------------------------------------------===//
41 // createRaiseAllocationsPass - Return a new pass that transforms malloc and
42 // free function calls into malloc and free instructions.
44 Pass *createRaiseAllocationsPass();
47 //===----------------------------------------------------------------------===//
48 // createDeadTypeEliminationPass - Return a new pass that eliminates symbol
49 // table entries for types that are never used.
51 Pass *createDeadTypeEliminationPass();
54 //===----------------------------------------------------------------------===//
55 // createGlobalDCEPass - This transform is designed to eliminate unreachable
56 // internal globals (functions or global variables)
58 Pass *createGlobalDCEPass();
61 //===----------------------------------------------------------------------===//
62 // createFunctionExtractionPass - This pass deletes as much of the module as
63 // possible, except for the function specified.
65 Pass *createFunctionExtractionPass(Function *F);
68 //===----------------------------------------------------------------------===//
69 // FunctionResolvingPass - Go over the functions that are in the module and
70 // look for functions that have the same name. More often than not, there will
73 // void "foo"(int, int)
74 // because of the way things are declared in C. If this is the case, patch
77 // This is an interprocedural pass.
79 Pass *createFunctionResolvingPass();
81 //===----------------------------------------------------------------------===//
82 // createFunctionInliningPass - Return a new pass object that uses a heuristic
83 // to inline direct function calls to small functions.
85 Pass *createFunctionInliningPass();
87 //===----------------------------------------------------------------------===//
88 // createPruneEHPass - Return a new pass object which transforms invoke
89 // instructions into calls, if the callee can _not_ unwind the stack.
91 Pass *createPruneEHPass();
93 //===----------------------------------------------------------------------===//
94 // createInternalizePass - This pass loops over all of the functions in the
95 // input module, looking for a main function. If a main function is found, all
96 // other functions are marked as internal.
98 Pass *createInternalizePass();
100 //===----------------------------------------------------------------------===//
101 // createDeadArgEliminationPass - This pass removes arguments from functions
102 // which are not used by the body of the function.
104 Pass *createDeadArgEliminationPass();
106 // DeadArgHacking pass - Same as DAE, but delete arguments of external functions
107 // as well. This is definitely not safe, and should only be used by bugpoint.
108 Pass *createDeadArgHackingPass();
110 //===----------------------------------------------------------------------===//
111 // createIPConstantPropagationPass - This pass propagates constants from call
112 // sites into the bodies of functions.
114 Pass *createIPConstantPropagationPass();
117 //===----------------------------------------------------------------------===//
118 // These passes are wrappers that can do a few simple structure mutation
121 Pass *createSwapElementsPass();
122 Pass *createSortElementsPass();
124 } // End llvm namespace