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
26 //===----------------------------------------------------------------------===//
27 /// createLowerSetJmpPass - This function lowers the setjmp/longjmp intrinsics
28 /// to invoke/unwind instructions. This should really be part of the C/C++
29 /// front-end, but it's so much easier to write transformations in LLVM proper.
31 ModulePass* createLowerSetJmpPass();
33 //===----------------------------------------------------------------------===//
34 /// createConstantMergePass - This function returns a new pass that merges
35 /// duplicate global constants together into a single constant that is shared.
36 /// This is useful because some passes (ie TraceValues) insert a lot of string
37 /// constants into the program, regardless of whether or not they duplicate an
40 ModulePass *createConstantMergePass();
43 //===----------------------------------------------------------------------===//
44 /// createGlobalOptimizerPass - This function returns a new pass that optimizes
45 /// non-address taken internal globals.
47 ModulePass *createGlobalOptimizerPass();
50 //===----------------------------------------------------------------------===//
51 /// createRaiseAllocationsPass - Return a new pass that transforms malloc and
52 /// free function calls into malloc and free instructions.
54 ModulePass *createRaiseAllocationsPass();
57 //===----------------------------------------------------------------------===//
58 /// createDeadTypeEliminationPass - Return a new pass that eliminates symbol
59 /// table entries for types that are never used.
61 ModulePass *createDeadTypeEliminationPass();
64 //===----------------------------------------------------------------------===//
65 /// createGlobalDCEPass - This transform is designed to eliminate unreachable
66 /// internal globals (functions or global variables)
68 ModulePass *createGlobalDCEPass();
71 //===----------------------------------------------------------------------===//
72 /// createFunctionExtractionPass - If deleteFn is true, this pass deletes as
73 /// the specified function. Otherwise, it deletes as much of the module as
74 /// possible, except for the function specified.
76 ModulePass *createFunctionExtractionPass(Function *F, bool deleteFn = false);
79 //===----------------------------------------------------------------------===//
80 /// FunctionResolvingPass - Go over the functions that are in the module and
81 /// look for functions that have the same name. More often than not, there will
84 /// void "foo"(int, int)
85 /// because of the way things are declared in C. If this is the case, patch
88 /// This is an interprocedural pass.
90 ModulePass *createFunctionResolvingPass();
92 //===----------------------------------------------------------------------===//
93 /// createFunctionInliningPass - Return a new pass object that uses a heuristic
94 /// to inline direct function calls to small functions.
96 ModulePass *createFunctionInliningPass();
98 //===----------------------------------------------------------------------===//
99 /// createPruneEHPass - Return a new pass object which transforms invoke
100 /// instructions into calls, if the callee can _not_ unwind the stack.
102 ModulePass *createPruneEHPass();
104 //===----------------------------------------------------------------------===//
105 /// createInternalizePass - This pass loops over all of the functions in the
106 /// input module, looking for a main function. If a main function is found, all
107 /// other functions are marked as internal.
109 ModulePass *createInternalizePass();
111 //===----------------------------------------------------------------------===//
112 /// createDeadArgEliminationPass - This pass removes arguments from functions
113 /// which are not used by the body of the function.
115 ModulePass *createDeadArgEliminationPass();
117 /// DeadArgHacking pass - Same as DAE, but delete arguments of external
118 /// functions as well. This is definitely not safe, and should only be used by
120 ModulePass *createDeadArgHackingPass();
122 //===----------------------------------------------------------------------===//
123 /// createArgumentPromotionPass - This pass promotes "by reference" arguments to
124 /// be passed by value.
126 ModulePass *createArgumentPromotionPass();
128 //===----------------------------------------------------------------------===//
129 /// createIPConstantPropagationPass - This pass propagates constants from call
130 /// sites into the bodies of functions.
132 ModulePass *createIPConstantPropagationPass();
135 //===----------------------------------------------------------------------===//
137 /// createSingleLoopExtractorPass - This pass extracts one natural loop from the
138 /// program into a function if it can. This is used by bugpoint.
140 ModulePass *createSingleLoopExtractorPass();
142 // createBlockExtractorPass - This pass extracts all blocks (except those
143 // specified in the argument list) from the functions in the module.
145 ModulePass *llvm::createBlockExtractorPass(std::vector<BasicBlock*> &BTNE);
147 } // End llvm namespace