Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 1 | //===- LevelRaise.cpp - Code to change LLVM to higher level -----------------=// |
| 2 | // |
| 3 | // This file implements the 'raising' part of the LevelChange API. This is |
| 4 | // useful because, in general, it makes the LLVM code terser and easier to |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 5 | // analyze. |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #include "llvm/Transforms/LevelChange.h" |
Chris Lattner | 497c60c | 2002-05-07 18:12:18 +0000 | [diff] [blame] | 10 | #include "llvm/Transforms/Utils/Local.h" |
Chris Lattner | 59cd9f1 | 2001-11-04 23:24:06 +0000 | [diff] [blame] | 11 | #include "TransformInternals.h" |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 12 | #include "llvm/iOther.h" |
| 13 | #include "llvm/iMemory.h" |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 14 | #include "llvm/Pass.h" |
Chris Lattner | 968ddc9 | 2002-04-08 20:18:09 +0000 | [diff] [blame] | 15 | #include "llvm/ConstantHandling.h" |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 16 | #include "llvm/Analysis/Expressions.h" |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 17 | #include "llvm/Analysis/Verifier.h" |
Chris Lattner | 497c60c | 2002-05-07 18:12:18 +0000 | [diff] [blame] | 18 | #include "llvm/Transforms/Utils/BasicBlockUtils.h" |
Chris Lattner | cee8f9a | 2001-11-27 00:03:19 +0000 | [diff] [blame] | 19 | #include "Support/STLExtras.h" |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 20 | #include "Support/StatisticReporter.h" |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 21 | #include "Support/CommandLine.h" |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 22 | #include <algorithm> |
Anand Shukla | cfb22d3 | 2002-06-25 20:55:50 +0000 | [diff] [blame] | 23 | using std::cerr; |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 24 | |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 25 | // StartInst - This enables the -raise-start-inst=foo option to cause the level |
| 26 | // raising pass to start at instruction "foo", which is immensely useful for |
| 27 | // debugging! |
| 28 | // |
| 29 | static cl::String StartInst("raise-start-inst", "Start raise pass at the " |
| 30 | "instruction with the specified name", cl::Hidden); |
| 31 | |
| 32 | static Statistic<> NumLoadStorePeepholes("raise\t\t- Number of load/store " |
| 33 | "peepholes"); |
| 34 | static Statistic<> NumGEPInstFormed("raise\t\t- Number of other " |
| 35 | "getelementptr's formed"); |
| 36 | static Statistic<> NumExprTreesConv("raise\t\t- Number of expression trees" |
| 37 | " converted"); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 38 | static Statistic<> NumCastOfCast("raise\t\t- Number of cast-of-self removed"); |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 39 | static Statistic<> NumDCEorCP("raise\t\t- Number of insts DCEd or constprop'd"); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 40 | |
| 41 | |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 42 | #define PRINT_PEEPHOLE(ID, NUM, I) \ |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 43 | DEBUG(std::cerr << "Inst P/H " << ID << "[" << NUM << "] " << I) |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 44 | |
| 45 | #define PRINT_PEEPHOLE1(ID, I1) do { PRINT_PEEPHOLE(ID, 0, I1); } while (0) |
| 46 | #define PRINT_PEEPHOLE2(ID, I1, I2) \ |
| 47 | do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); } while (0) |
| 48 | #define PRINT_PEEPHOLE3(ID, I1, I2, I3) \ |
| 49 | do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); \ |
| 50 | PRINT_PEEPHOLE(ID, 2, I3); } while (0) |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 51 | #define PRINT_PEEPHOLE4(ID, I1, I2, I3, I4) \ |
| 52 | do { PRINT_PEEPHOLE(ID, 0, I1); PRINT_PEEPHOLE(ID, 1, I2); \ |
| 53 | PRINT_PEEPHOLE(ID, 2, I3); PRINT_PEEPHOLE(ID, 3, I4); } while (0) |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 54 | |
| 55 | |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 56 | // isReinterpretingCast - Return true if the cast instruction specified will |
| 57 | // cause the operand to be "reinterpreted". A value is reinterpreted if the |
| 58 | // cast instruction would cause the underlying bits to change. |
| 59 | // |
| 60 | static inline bool isReinterpretingCast(const CastInst *CI) { |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 61 | return!CI->getOperand(0)->getType()->isLosslesslyConvertableTo(CI->getType()); |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 65 | // Peephole optimize the following instructions: |
| 66 | // %t1 = cast ? to x * |
| 67 | // %t2 = add x * %SP, %t1 ;; Constant must be 2nd operand |
| 68 | // |
| 69 | // Into: %t3 = getelementptr {<...>} * %SP, <element indices> |
| 70 | // %t2 = cast <eltype> * %t3 to {<...>}* |
| 71 | // |
| 72 | static bool HandleCastToPointer(BasicBlock::iterator BI, |
| 73 | const PointerType *DestPTy) { |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 74 | CastInst &CI = cast<CastInst>(*BI); |
| 75 | if (CI.use_empty()) return false; |
Chris Lattner | f3b976e | 2001-11-04 20:21:12 +0000 | [diff] [blame] | 76 | |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 77 | // Scan all of the uses, looking for any uses that are not add |
| 78 | // instructions. If we have non-adds, do not make this transformation. |
| 79 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 80 | for (Value::use_iterator I = CI.use_begin(), E = CI.use_end(); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 81 | I != E; ++I) { |
| 82 | if (BinaryOperator *BO = dyn_cast<BinaryOperator>(*I)) { |
Chris Lattner | 3fb2ddd | 2002-07-16 21:41:31 +0000 | [diff] [blame] | 83 | if (BO->getOpcode() != Instruction::Add || |
| 84 | // Avoid add sbyte* %X, %X cases... |
| 85 | BO->getOperand(0) == BO->getOperand(1)) |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 86 | return false; |
| 87 | } else { |
| 88 | return false; |
| 89 | } |
| 90 | } |
| 91 | |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 92 | std::vector<Value*> Indices; |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 93 | Value *Src = CI.getOperand(0); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 94 | const Type *Result = ConvertableToGEP(DestPTy, Src, Indices, &BI); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 95 | if (Result == 0) return false; // Not convertable... |
| 96 | |
| 97 | PRINT_PEEPHOLE2("cast-add-to-gep:in", Src, CI); |
| 98 | |
| 99 | // If we have a getelementptr capability... transform all of the |
| 100 | // add instruction uses into getelementptr's. |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 101 | while (!CI.use_empty()) { |
| 102 | BinaryOperator *I = cast<BinaryOperator>(*CI.use_begin()); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 103 | assert(I->getOpcode() == Instruction::Add && I->getNumOperands() == 2 && |
| 104 | "Use is not a valid add instruction!"); |
| 105 | |
| 106 | // Get the value added to the cast result pointer... |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 107 | Value *OtherPtr = I->getOperand((I->getOperand(0) == &CI) ? 1 : 0); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 108 | |
Chris Lattner | 45ef5c2 | 2002-03-21 06:22:23 +0000 | [diff] [blame] | 109 | Instruction *GEP = new GetElementPtrInst(OtherPtr, Indices, I->getName()); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 110 | PRINT_PEEPHOLE1("cast-add-to-gep:i", I); |
Chris Lattner | 45ef5c2 | 2002-03-21 06:22:23 +0000 | [diff] [blame] | 111 | |
| 112 | if (GEP->getType() == I->getType()) { |
| 113 | // Replace the old add instruction with the shiny new GEP inst |
| 114 | ReplaceInstWithInst(I, GEP); |
| 115 | } else { |
| 116 | // If the type produced by the gep instruction differs from the original |
| 117 | // add instruction type, insert a cast now. |
| 118 | // |
| 119 | |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 120 | // Insert the GEP instruction before the old add instruction... |
| 121 | I->getParent()->getInstList().insert(I, GEP); |
Chris Lattner | 45ef5c2 | 2002-03-21 06:22:23 +0000 | [diff] [blame] | 122 | |
| 123 | PRINT_PEEPHOLE1("cast-add-to-gep:o", GEP); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 124 | GEP = new CastInst(GEP, I->getType()); |
Chris Lattner | 45ef5c2 | 2002-03-21 06:22:23 +0000 | [diff] [blame] | 125 | |
| 126 | // Replace the old add instruction with the shiny new GEP inst |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 127 | ReplaceInstWithInst(I, GEP); |
Chris Lattner | 45ef5c2 | 2002-03-21 06:22:23 +0000 | [diff] [blame] | 128 | } |
| 129 | |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 130 | PRINT_PEEPHOLE1("cast-add-to-gep:o", GEP); |
| 131 | } |
| 132 | return true; |
| 133 | } |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 134 | |
| 135 | // Peephole optimize the following instructions: |
| 136 | // %t1 = cast ulong <const int> to {<...>} * |
| 137 | // %t2 = add {<...>} * %SP, %t1 ;; Constant must be 2nd operand |
| 138 | // |
| 139 | // or |
| 140 | // %t1 = cast {<...>}* %SP to int* |
| 141 | // %t5 = cast ulong <const int> to int* |
| 142 | // %t2 = add int* %t1, %t5 ;; int is same size as field |
| 143 | // |
| 144 | // Into: %t3 = getelementptr {<...>} * %SP, <element indices> |
| 145 | // %t2 = cast <eltype> * %t3 to {<...>}* |
| 146 | // |
| 147 | static bool PeepholeOptimizeAddCast(BasicBlock *BB, BasicBlock::iterator &BI, |
| 148 | Value *AddOp1, CastInst *AddOp2) { |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 149 | const CompositeType *CompTy; |
| 150 | Value *OffsetVal = AddOp2->getOperand(0); |
| 151 | Value *SrcPtr; // Of type pointer to struct... |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 152 | |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 153 | if ((CompTy = getPointedToComposite(AddOp1->getType()))) { |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 154 | SrcPtr = AddOp1; // Handle the first case... |
| 155 | } else if (CastInst *AddOp1c = dyn_cast<CastInst>(AddOp1)) { |
| 156 | SrcPtr = AddOp1c->getOperand(0); // Handle the second case... |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 157 | CompTy = getPointedToComposite(SrcPtr->getType()); |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | // Only proceed if we have detected all of our conditions successfully... |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 161 | if (!CompTy || !SrcPtr || !OffsetVal->getType()->isIntegral()) |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 162 | return false; |
| 163 | |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 164 | std::vector<Value*> Indices; |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 165 | if (!ConvertableToGEP(SrcPtr->getType(), OffsetVal, Indices, &BI)) |
| 166 | return false; // Not convertable... perhaps next time |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 167 | |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 168 | if (getPointedToComposite(AddOp1->getType())) { // case 1 |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 169 | PRINT_PEEPHOLE2("add-to-gep1:in", AddOp2, *BI); |
| 170 | } else { |
| 171 | PRINT_PEEPHOLE3("add-to-gep2:in", AddOp1, AddOp2, *BI); |
| 172 | } |
| 173 | |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 174 | GetElementPtrInst *GEP = new GetElementPtrInst(SrcPtr, Indices, |
| 175 | AddOp2->getName()); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 176 | BI = ++BB->getInstList().insert(BI, GEP); |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 177 | |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 178 | Instruction *NCI = new CastInst(GEP, AddOp1->getType()); |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 179 | ReplaceInstWithInst(BB->getInstList(), BI, NCI); |
| 180 | PRINT_PEEPHOLE2("add-to-gep:out", GEP, NCI); |
| 181 | return true; |
| 182 | } |
| 183 | |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 184 | static bool PeepholeOptimize(BasicBlock *BB, BasicBlock::iterator &BI) { |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 185 | Instruction *I = BI; |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 186 | |
| 187 | if (CastInst *CI = dyn_cast<CastInst>(I)) { |
| 188 | Value *Src = CI->getOperand(0); |
| 189 | Instruction *SrcI = dyn_cast<Instruction>(Src); // Nonnull if instr source |
| 190 | const Type *DestTy = CI->getType(); |
| 191 | |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 192 | // Peephole optimize the following instruction: |
| 193 | // %V2 = cast <ty> %V to <ty> |
| 194 | // |
| 195 | // Into: <nothing> |
| 196 | // |
| 197 | if (DestTy == Src->getType()) { // Check for a cast to same type as src!! |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 198 | PRINT_PEEPHOLE1("cast-of-self-ty", CI); |
| 199 | CI->replaceAllUsesWith(Src); |
| 200 | if (!Src->hasName() && CI->hasName()) { |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 201 | std::string Name = CI->getName(); |
Chris Lattner | f3b976e | 2001-11-04 20:21:12 +0000 | [diff] [blame] | 202 | CI->setName(""); |
| 203 | Src->setName(Name, BB->getParent()->getSymbolTable()); |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 204 | } |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 205 | |
| 206 | // DCE the instruction now, to avoid having the iterative version of DCE |
| 207 | // have to worry about it. |
| 208 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 209 | BI = BB->getInstList().erase(BI); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 210 | |
| 211 | ++NumCastOfCast; |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 212 | return true; |
| 213 | } |
| 214 | |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 215 | // Check to see if it's a cast of an instruction that does not depend on the |
| 216 | // specific type of the operands to do it's job. |
Chris Lattner | f3b976e | 2001-11-04 20:21:12 +0000 | [diff] [blame] | 217 | if (!isReinterpretingCast(CI)) { |
Chris Lattner | b980e18 | 2001-11-04 21:32:11 +0000 | [diff] [blame] | 218 | ValueTypeCache ConvertedTypes; |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 219 | |
Chris Lattner | d20a98e | 2002-05-24 20:41:51 +0000 | [diff] [blame] | 220 | // Check to see if we can convert the source of the cast to match the |
| 221 | // destination type of the cast... |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 222 | // |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 223 | ConvertedTypes[CI] = CI->getType(); // Make sure the cast doesn't change |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 224 | if (ExpressionConvertableToType(Src, DestTy, ConvertedTypes)) { |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 225 | PRINT_PEEPHOLE3("CAST-SRC-EXPR-CONV:in ", Src, CI, BB->getParent()); |
Chris Lattner | c0b90e7 | 2001-11-08 20:19:56 +0000 | [diff] [blame] | 226 | |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 227 | DEBUG(cerr << "\nCONVERTING SRC EXPR TYPE:\n"); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 228 | ValueMapCache ValueMap; |
| 229 | Value *E = ConvertExpressionToType(Src, DestTy, ValueMap); |
| 230 | if (Constant *CPV = dyn_cast<Constant>(E)) |
| 231 | CI->replaceAllUsesWith(CPV); |
Chris Lattner | c0b90e7 | 2001-11-08 20:19:56 +0000 | [diff] [blame] | 232 | |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 233 | BI = BB->begin(); // Rescan basic block. BI might be invalidated. |
| 234 | PRINT_PEEPHOLE1("CAST-SRC-EXPR-CONV:out", E); |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 235 | DEBUG(cerr << "DONE CONVERTING SRC EXPR TYPE: \n" << BB->getParent()); |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 236 | |
| 237 | DEBUG(assert(verifyFunction(*BB->getParent()) == false && |
| 238 | "Function broken!")); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 239 | ++NumExprTreesConv; |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 240 | return true; |
| 241 | } |
| 242 | |
Chris Lattner | d20a98e | 2002-05-24 20:41:51 +0000 | [diff] [blame] | 243 | // Check to see if we can convert the users of the cast value to match the |
| 244 | // source type of the cast... |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 245 | // |
| 246 | ConvertedTypes.clear(); |
Chris Lattner | a66c7bf | 2002-07-16 18:12:55 +0000 | [diff] [blame] | 247 | ConvertedTypes[Src] = Src->getType(); // Make sure the source doesn't change type |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 248 | if (ValueConvertableToType(CI, Src->getType(), ConvertedTypes)) { |
| 249 | PRINT_PEEPHOLE3("CAST-DEST-EXPR-CONV:in ", Src, CI, BB->getParent()); |
| 250 | |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 251 | DEBUG(cerr << "\nCONVERTING EXPR TYPE:\n"); |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 252 | ValueMapCache ValueMap; |
| 253 | ConvertValueToNewType(CI, Src, ValueMap); // This will delete CI! |
| 254 | |
| 255 | BI = BB->begin(); // Rescan basic block. BI might be invalidated. |
| 256 | PRINT_PEEPHOLE1("CAST-DEST-EXPR-CONV:out", Src); |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 257 | DEBUG(cerr << "DONE CONVERTING EXPR TYPE: \n\n" << BB->getParent()); |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 258 | |
| 259 | DEBUG(assert(verifyFunction(*BB->getParent()) == false && |
| 260 | "Function broken!")); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 261 | ++NumExprTreesConv; |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 262 | return true; |
Chris Lattner | f3b976e | 2001-11-04 20:21:12 +0000 | [diff] [blame] | 263 | } |
Chris Lattner | f17a09d | 2001-12-06 18:06:13 +0000 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | // Otherwise find out it this cast is a cast to a pointer type, which is |
| 267 | // then added to some other pointer, then loaded or stored through. If |
| 268 | // so, convert the add into a getelementptr instruction... |
| 269 | // |
| 270 | if (const PointerType *DestPTy = dyn_cast<PointerType>(DestTy)) { |
| 271 | if (HandleCastToPointer(BI, DestPTy)) { |
| 272 | BI = BB->begin(); // Rescan basic block. BI might be invalidated. |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 273 | ++NumGEPInstFormed; |
Chris Lattner | f17a09d | 2001-12-06 18:06:13 +0000 | [diff] [blame] | 274 | return true; |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 275 | } |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 276 | } |
| 277 | |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 278 | // Check to see if we are casting from a structure pointer to a pointer to |
| 279 | // the first element of the structure... to avoid munching other peepholes, |
| 280 | // we only let this happen if there are no add uses of the cast. |
| 281 | // |
| 282 | // Peephole optimize the following instructions: |
| 283 | // %t1 = cast {<...>} * %StructPtr to <ty> * |
| 284 | // |
| 285 | // Into: %t2 = getelementptr {<...>} * %StructPtr, <0, 0, 0, ...> |
| 286 | // %t1 = cast <eltype> * %t1 to <ty> * |
| 287 | // |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 288 | if (const CompositeType *CTy = getPointedToComposite(Src->getType())) |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 289 | if (const PointerType *DestPTy = dyn_cast<PointerType>(DestTy)) { |
| 290 | |
| 291 | // Loop over uses of the cast, checking for add instructions. If an add |
| 292 | // exists, this is probably a part of a more complex GEP, so we don't |
| 293 | // want to mess around with the cast. |
| 294 | // |
| 295 | bool HasAddUse = false; |
| 296 | for (Value::use_iterator I = CI->use_begin(), E = CI->use_end(); |
| 297 | I != E; ++I) |
| 298 | if (isa<Instruction>(*I) && |
| 299 | cast<Instruction>(*I)->getOpcode() == Instruction::Add) { |
| 300 | HasAddUse = true; break; |
| 301 | } |
| 302 | |
| 303 | // If it doesn't have an add use, check to see if the dest type is |
| 304 | // losslessly convertable to one of the types in the start of the struct |
| 305 | // type. |
| 306 | // |
| 307 | if (!HasAddUse) { |
Chris Lattner | 7a17675 | 2001-12-04 00:03:30 +0000 | [diff] [blame] | 308 | const Type *DestPointedTy = DestPTy->getElementType(); |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 309 | unsigned Depth = 1; |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 310 | const CompositeType *CurCTy = CTy; |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 311 | const Type *ElTy = 0; |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 312 | |
| 313 | // Build the index vector, full of all zeros |
Chris Lattner | 697954c | 2002-01-20 22:54:45 +0000 | [diff] [blame] | 314 | std::vector<Value*> Indices; |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 315 | Indices.push_back(ConstantUInt::get(Type::UIntTy, 0)); |
| 316 | while (CurCTy && !isa<PointerType>(CurCTy)) { |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 317 | if (const StructType *CurSTy = dyn_cast<StructType>(CurCTy)) { |
| 318 | // Check for a zero element struct type... if we have one, bail. |
| 319 | if (CurSTy->getElementTypes().size() == 0) break; |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 320 | |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 321 | // Grab the first element of the struct type, which must lie at |
| 322 | // offset zero in the struct. |
| 323 | // |
| 324 | ElTy = CurSTy->getElementTypes()[0]; |
| 325 | } else { |
| 326 | ElTy = cast<ArrayType>(CurCTy)->getElementType(); |
| 327 | } |
| 328 | |
| 329 | // Insert a zero to index through this type... |
Chris Lattner | e9bb2df | 2001-12-03 22:26:30 +0000 | [diff] [blame] | 330 | Indices.push_back(ConstantUInt::get(CurCTy->getIndexType(), 0)); |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 331 | |
| 332 | // Did we find what we're looking for? |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 333 | if (ElTy->isLosslesslyConvertableTo(DestPointedTy)) break; |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 334 | |
| 335 | // Nope, go a level deeper. |
| 336 | ++Depth; |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 337 | CurCTy = dyn_cast<CompositeType>(ElTy); |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 338 | ElTy = 0; |
| 339 | } |
| 340 | |
| 341 | // Did we find what we were looking for? If so, do the transformation |
| 342 | if (ElTy) { |
| 343 | PRINT_PEEPHOLE1("cast-for-first:in", CI); |
| 344 | |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 345 | // Insert the new T cast instruction... stealing old T's name |
| 346 | GetElementPtrInst *GEP = new GetElementPtrInst(Src, Indices, |
| 347 | CI->getName()); |
| 348 | CI->setName(""); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 349 | BI = ++BB->getInstList().insert(BI, GEP); |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 350 | |
| 351 | // Make the old cast instruction reference the new GEP instead of |
| 352 | // the old src value. |
| 353 | // |
| 354 | CI->setOperand(0, GEP); |
| 355 | |
| 356 | PRINT_PEEPHOLE2("cast-for-first:out", GEP, CI); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 357 | ++NumGEPInstFormed; |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 358 | return true; |
| 359 | } |
| 360 | } |
| 361 | } |
Chris Lattner | e99c66b | 2001-11-01 17:05:27 +0000 | [diff] [blame] | 362 | |
Chris Lattner | 8d38e54 | 2001-11-01 03:12:34 +0000 | [diff] [blame] | 363 | } else if (StoreInst *SI = dyn_cast<StoreInst>(I)) { |
| 364 | Value *Val = SI->getOperand(0); |
Chris Lattner | 65ea171 | 2001-11-14 11:27:58 +0000 | [diff] [blame] | 365 | Value *Pointer = SI->getPointerOperand(); |
Chris Lattner | 8d38e54 | 2001-11-01 03:12:34 +0000 | [diff] [blame] | 366 | |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 367 | // Peephole optimize the following instructions: |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 368 | // %t = cast <T1>* %P to <T2> * ;; If T1 is losslessly convertable to T2 |
| 369 | // store <T2> %V, <T2>* %t |
| 370 | // |
| 371 | // Into: |
| 372 | // %t = cast <T2> %V to <T1> |
| 373 | // store <T1> %t2, <T1>* %P |
| 374 | // |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 375 | // Note: This is not taken care of by expr conversion because there might |
| 376 | // not be a cast available for the store to convert the incoming value of. |
| 377 | // This code is basically here to make sure that pointers don't have casts |
| 378 | // if possible. |
| 379 | // |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 380 | if (CastInst *CI = dyn_cast<CastInst>(Pointer)) |
| 381 | if (Value *CastSrc = CI->getOperand(0)) // CSPT = CastSrcPointerType |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 382 | if (const PointerType *CSPT = dyn_cast<PointerType>(CastSrc->getType())) |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 383 | // convertable types? |
Chris Lattner | 7a17675 | 2001-12-04 00:03:30 +0000 | [diff] [blame] | 384 | if (Val->getType()->isLosslesslyConvertableTo(CSPT->getElementType()) && |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 385 | !SI->hasIndices()) { // No subscripts yet! |
| 386 | PRINT_PEEPHOLE3("st-src-cast:in ", Pointer, Val, SI); |
| 387 | |
| 388 | // Insert the new T cast instruction... stealing old T's name |
Chris Lattner | 7a17675 | 2001-12-04 00:03:30 +0000 | [diff] [blame] | 389 | CastInst *NCI = new CastInst(Val, CSPT->getElementType(), |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 390 | CI->getName()); |
| 391 | CI->setName(""); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 392 | BI = ++BB->getInstList().insert(BI, NCI); |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 393 | |
| 394 | // Replace the old store with a new one! |
| 395 | ReplaceInstWithInst(BB->getInstList(), BI, |
| 396 | SI = new StoreInst(NCI, CastSrc)); |
| 397 | PRINT_PEEPHOLE3("st-src-cast:out", NCI, CastSrc, SI); |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 398 | ++NumLoadStorePeepholes; |
Chris Lattner | dedee7b | 2001-11-01 05:57:59 +0000 | [diff] [blame] | 399 | return true; |
| 400 | } |
| 401 | |
Chris Lattner | c99428f | 2002-05-14 05:23:45 +0000 | [diff] [blame] | 402 | } else if (LoadInst *LI = dyn_cast<LoadInst>(I)) { |
| 403 | Value *Pointer = LI->getOperand(0); |
| 404 | const Type *PtrElType = |
| 405 | cast<PointerType>(Pointer->getType())->getElementType(); |
| 406 | |
| 407 | // Peephole optimize the following instructions: |
| 408 | // %Val = cast <T1>* to <T2>* ;; If T1 is losslessly convertable to T2 |
| 409 | // %t = load <T2>* %P |
| 410 | // |
| 411 | // Into: |
| 412 | // %t = load <T1>* %P |
| 413 | // %Val = cast <T1> to <T2> |
| 414 | // |
| 415 | // Note: This is not taken care of by expr conversion because there might |
| 416 | // not be a cast available for the store to convert the incoming value of. |
| 417 | // This code is basically here to make sure that pointers don't have casts |
| 418 | // if possible. |
| 419 | // |
| 420 | if (CastInst *CI = dyn_cast<CastInst>(Pointer)) |
| 421 | if (Value *CastSrc = CI->getOperand(0)) // CSPT = CastSrcPointerType |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 422 | if (const PointerType *CSPT = dyn_cast<PointerType>(CastSrc->getType())) |
Chris Lattner | c99428f | 2002-05-14 05:23:45 +0000 | [diff] [blame] | 423 | // convertable types? |
| 424 | if (PtrElType->isLosslesslyConvertableTo(CSPT->getElementType()) && |
| 425 | !LI->hasIndices()) { // No subscripts yet! |
| 426 | PRINT_PEEPHOLE2("load-src-cast:in ", Pointer, LI); |
| 427 | |
| 428 | // Create the new load instruction... loading the pre-casted value |
| 429 | LoadInst *NewLI = new LoadInst(CastSrc, LI->getName()); |
| 430 | |
| 431 | // Insert the new T cast instruction... stealing old T's name |
| 432 | CastInst *NCI = new CastInst(NewLI, LI->getType(), CI->getName()); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 433 | BI = ++BB->getInstList().insert(BI, NewLI); |
Chris Lattner | c99428f | 2002-05-14 05:23:45 +0000 | [diff] [blame] | 434 | |
| 435 | // Replace the old store with a new one! |
| 436 | ReplaceInstWithInst(BB->getInstList(), BI, NCI); |
| 437 | PRINT_PEEPHOLE3("load-src-cast:out", NCI, CastSrc, NewLI); |
| 438 | ++NumLoadStorePeepholes; |
| 439 | return true; |
| 440 | } |
| 441 | |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 442 | } else if (I->getOpcode() == Instruction::Add && |
| 443 | isa<CastInst>(I->getOperand(1))) { |
| 444 | |
Chris Lattner | d5b48ca | 2001-11-14 11:02:49 +0000 | [diff] [blame] | 445 | if (PeepholeOptimizeAddCast(BB, BI, I->getOperand(0), |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 446 | cast<CastInst>(I->getOperand(1)))) { |
| 447 | ++NumGEPInstFormed; |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 448 | return true; |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 449 | } |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 450 | } |
| 451 | |
| 452 | return false; |
| 453 | } |
| 454 | |
| 455 | |
| 456 | |
| 457 | |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 458 | static bool DoRaisePass(Function &F) { |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 459 | bool Changed = false; |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 460 | for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB) |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 461 | for (BasicBlock::iterator BI = BB->begin(); BI != BB->end();) { |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 462 | DEBUG(cerr << "Processing: " << *BI); |
Chris Lattner | 16da494 | 2002-05-26 20:18:18 +0000 | [diff] [blame] | 463 | if (dceInstruction(BI) || doConstantPropogation(BI)) { |
Chris Lattner | c0b90e7 | 2001-11-08 20:19:56 +0000 | [diff] [blame] | 464 | Changed = true; |
Chris Lattner | 3c01937 | 2002-05-10 15:29:25 +0000 | [diff] [blame] | 465 | ++NumDCEorCP; |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 466 | DEBUG(cerr << "***\t\t^^-- DeadCode Elinated!\n"); |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 467 | } else if (PeepholeOptimize(BB, BI)) { |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 468 | Changed = true; |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 469 | } else { |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 470 | ++BI; |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 471 | } |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 472 | } |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 473 | |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 474 | return Changed; |
| 475 | } |
| 476 | |
| 477 | |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 478 | // RaisePointerReferences::doit - Raise a function representation to a higher |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 479 | // level. |
| 480 | // |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 481 | static bool doRPR(Function &F) { |
| 482 | DEBUG(cerr << "\n\n\nStarting to work on Function '" << F.getName() << "'\n"); |
Chris Lattner | 68b07b7 | 2001-11-01 07:00:51 +0000 | [diff] [blame] | 483 | |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 484 | // Insert casts for all incoming pointer pointer values that are treated as |
| 485 | // arrays... |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 486 | // |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 487 | bool Changed = false, LocalChange; |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 488 | |
Chris Lattner | 3378a5b | 2002-07-16 23:49:24 +0000 | [diff] [blame^] | 489 | |
| 490 | // If the StartInst option was specified, then Peephole optimize that |
| 491 | // instruction first if it occurs in this function. |
| 492 | // |
| 493 | if (!StartInst.empty()) { |
| 494 | for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB) |
| 495 | for (BasicBlock::iterator BI = BB->begin(); BI != BB->end(); ++BI) |
| 496 | if (BI->getName() == StartInst) { |
| 497 | bool SavedDebug = DebugFlag; // Save the DEBUG() controlling flag. |
| 498 | DebugFlag = true; // Turn on DEBUG's |
| 499 | Changed |= PeepholeOptimize(BB, BI); |
| 500 | DebugFlag = SavedDebug; // Restore DebugFlag to previous state |
| 501 | } |
| 502 | } |
| 503 | |
Chris Lattner | 4b770a3 | 2001-12-04 08:12:53 +0000 | [diff] [blame] | 504 | do { |
Chris Lattner | b3abf9d | 2002-05-22 17:27:12 +0000 | [diff] [blame] | 505 | DEBUG(cerr << "Looping: \n" << F); |
Chris Lattner | a8b6d43 | 2001-12-05 06:34:00 +0000 | [diff] [blame] | 506 | |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 507 | // Iterate over the function, refining it, until it converges on a stable |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 508 | // state |
Chris Lattner | d554380 | 2001-12-14 16:37:52 +0000 | [diff] [blame] | 509 | LocalChange = false; |
Chris Lattner | 2fbfdcf | 2002-04-07 20:49:59 +0000 | [diff] [blame] | 510 | while (DoRaisePass(F)) LocalChange = true; |
Chris Lattner | 3cc7dde | 2001-11-26 16:58:14 +0000 | [diff] [blame] | 511 | Changed |= LocalChange; |
| 512 | |
| 513 | } while (LocalChange); |
Chris Lattner | d32a961 | 2001-11-01 02:42:08 +0000 | [diff] [blame] | 514 | |
| 515 | return Changed; |
| 516 | } |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 517 | |
| 518 | namespace { |
Chris Lattner | f57b845 | 2002-04-27 06:56:12 +0000 | [diff] [blame] | 519 | struct RaisePointerReferences : public FunctionPass { |
Chris Lattner | 96c466b | 2002-04-29 14:57:45 +0000 | [diff] [blame] | 520 | const char *getPassName() const { return "Raise Pointer References"; } |
| 521 | |
Chris Lattner | 7e70829 | 2002-06-25 16:13:24 +0000 | [diff] [blame] | 522 | virtual bool runOnFunction(Function &F) { return doRPR(F); } |
Chris Lattner | 97e52e4 | 2002-04-28 21:27:06 +0000 | [diff] [blame] | 523 | |
| 524 | virtual void getAnalysisUsage(AnalysisUsage &AU) const { |
| 525 | AU.preservesCFG(); |
| 526 | } |
Chris Lattner | bd0ef77 | 2002-02-26 21:46:54 +0000 | [diff] [blame] | 527 | }; |
| 528 | } |
| 529 | |
| 530 | Pass *createRaisePointerReferencesPass() { |
| 531 | return new RaisePointerReferences(); |
| 532 | } |
| 533 | |
| 534 | |