Add expr reassociation pass prototype
[oota-llvm.git] / include / llvm / Transforms / Scalar.h
1 //===-- Scalar.h - Scalar Transformations ------------------------*- C++ -*-==//
2 //
3 // This header file defines prototypes for accessor functions that expose passes
4 // in the Scalar transformations library.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef LLVM_TRANSFORMS_SCALAR_H
9 #define LLVM_TRANSFORMS_SCALAR_H
10
11 class Pass;
12
13 //===----------------------------------------------------------------------===//
14 //
15 // Constant Propogation Pass - A worklist driven constant propogation pass
16 //
17 Pass *createConstantPropogationPass();
18
19
20 //===----------------------------------------------------------------------===//
21 //
22 // Sparse Conditional Constant Propogation Pass
23 //
24 Pass *createSCCPPass();
25
26
27 //===----------------------------------------------------------------------===//
28 //
29 // DeadInstElimination - This pass quickly removes trivially dead instructions
30 // without modifying the CFG of the function.  It is a BasicBlockPass, so it
31 // runs efficiently when queued next to other BasicBlockPass's.
32 //
33 Pass *createDeadInstEliminationPass();
34
35
36 //===----------------------------------------------------------------------===//
37 //
38 // DeadCodeElimination - This pass is more powerful than DeadInstElimination,
39 // because it is worklist driven that can potentially revisit instructions when
40 // their other instructions become dead, to eliminate chains of dead
41 // computations.
42 //
43 Pass *createDeadCodeEliminationPass();
44
45
46 //===----------------------------------------------------------------------===//
47 //
48 // AggressiveDCE - This pass uses the SSA based Aggressive DCE algorithm.  This
49 // algorithm assumes instructions are dead until proven otherwise, which makes
50 // it more successful are removing non-obviously dead instructions.
51 //
52 Pass *createAggressiveDCEPass();
53
54
55 //===----------------------------------------------------------------------===//
56 // 
57 // DecomposeMultiDimRefs - Convert multi-dimensional references consisting of
58 // any combination of 2 or more array and structure indices into a sequence of
59 // instructions (using getelementpr and cast) so that each instruction has at
60 // most one index (except structure references, which need an extra leading
61 // index of [0]).
62 //
63 Pass *createDecomposeMultiDimRefsPass();
64
65
66 //===----------------------------------------------------------------------===//
67 //
68 // GCSE - This pass is designed to be a very quick global transformation that
69 // eliminates global common subexpressions from a function.  It does this by
70 // examining the SSA value graph of the function, instead of doing slow
71 // bit-vector computations.
72 //
73 Pass *createGCSEPass();
74
75
76 //===----------------------------------------------------------------------===//
77 //
78 // InductionVariableSimplify - Transform induction variables in a program to all
79 // use a single cannonical induction variable per loop.
80 //
81 Pass *createIndVarSimplifyPass();
82
83
84 //===----------------------------------------------------------------------===//
85 //
86 // InstructionCombining - Combine instructions to form fewer, simple
87 //   instructions.  This pass does not modify the CFG, and has a tendancy to
88 //   make instructions dead, so a subsequent DCE pass is useful.
89 //
90 // This pass combines things like:
91 //    %Y = add int 1, %X
92 //    %Z = add int 1, %Y
93 // into:
94 //    %Z = add int 2, %X
95 //
96 Pass *createInstructionCombiningPass();
97
98
99 //===----------------------------------------------------------------------===//
100 //
101 // This pass is used to promote memory references to be register references.  A
102 // simple example of the transformation performed by this pass is:
103 //
104 //        FROM CODE                           TO CODE
105 //   %X = alloca int, uint 1                 ret int 42
106 //   store int 42, int *%X
107 //   %Y = load int* %X
108 //   ret int %Y
109 //
110 Pass *createPromoteMemoryToRegister();
111
112
113 //===----------------------------------------------------------------------===//
114 //
115 // This pass reassociates commutative expressions in an order that is designed
116 // to promote better constant propogation, GCSE, LICM, PRE...
117 //
118 // For example:  4 + (x + 5)  ->  x + (4 + 5)
119 //
120 Pass *createReassociatePass();
121
122
123 //===----------------------------------------------------------------------===//
124 //
125 // These functions removes symbols from functions and modules.
126 //
127 Pass *createSymbolStrippingPass();
128 Pass *createFullSymbolStrippingPass();
129
130 #endif