Add prototype for the PiNodeInserter pass
[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 // PiNodeInsertion - This pass inserts single entry Phi nodes into basic blocks
102 // that are preceeded by a conditional branch, where the branch gives
103 // information about the operands of the condition.  For example, this C code:
104 //   if (x == 0) { ... = x + 4;
105 // becomes:
106 //   if (x == 0) {
107 //     x2 = phi(x);    // Node that can hold data flow information about X
108 //     ... = x2 + 4;
109 //
110 // Since the direction of the condition branch gives information about X itself
111 // (whether or not it is zero), some passes (like value numbering or ABCD) can
112 // use the inserted Phi/Pi nodes as a place to attach information, in this case
113 // saying that X has a value of 0 in this scope.  The power of this analysis
114 // information is that "in the scope" translates to "for all uses of x2".
115 //
116 // This special form of Phi node is refered to as a Pi node, following the
117 // terminology defined in the "Array Bounds Checks on Demand" paper.
118 //
119 Pass *createPiNodeInsertionPass();
120
121
122 //===----------------------------------------------------------------------===//
123 //
124 // This pass is used to promote memory references to be register references.  A
125 // simple example of the transformation performed by this pass is:
126 //
127 //        FROM CODE                           TO CODE
128 //   %X = alloca int, uint 1                 ret int 42
129 //   store int 42, int *%X
130 //   %Y = load int* %X
131 //   ret int %Y
132 //
133 Pass *createPromoteMemoryToRegister();
134
135
136 //===----------------------------------------------------------------------===//
137 //
138 // This pass reassociates commutative expressions in an order that is designed
139 // to promote better constant propogation, GCSE, LICM, PRE...
140 //
141 // For example:  4 + (x + 5)  ->  x + (4 + 5)
142 //
143 Pass *createReassociatePass();
144
145
146 //===----------------------------------------------------------------------===//
147 //
148 // These functions removes symbols from functions and modules.
149 //
150 Pass *createSymbolStrippingPass();
151 Pass *createFullSymbolStrippingPass();
152
153 #endif