OLD | NEW |
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This file implements the skeleton of the TargetLowering class, | 10 // This file implements the skeleton of the TargetLowering class, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // | 129 // |
130 // The lowering method may look ahead in the instruction stream as | 130 // The lowering method may look ahead in the instruction stream as |
131 // desired, and lower additional instructions in conjunction with the | 131 // desired, and lower additional instructions in conjunction with the |
132 // current one, for example fusing a compare and branch. If it does, | 132 // current one, for example fusing a compare and branch. If it does, |
133 // it should advance Context.Cur to point to the next non-deleted | 133 // it should advance Context.Cur to point to the next non-deleted |
134 // instruction to process, and it should delete any additional | 134 // instruction to process, and it should delete any additional |
135 // instructions it consumes. | 135 // instructions it consumes. |
136 void TargetLowering::lower() { | 136 void TargetLowering::lower() { |
137 assert(!Context.atEnd()); | 137 assert(!Context.atEnd()); |
138 Inst *Inst = *Context.getCur(); | 138 Inst *Inst = *Context.getCur(); |
| 139 // Mark the current instruction as deleted before lowering, |
| 140 // otherwise the Dest variable will likely get marked as non-SSA. |
| 141 // See Variable::setDefinition(). |
| 142 Inst->setDeleted(); |
139 switch (Inst->getKind()) { | 143 switch (Inst->getKind()) { |
140 case Inst::Alloca: | 144 case Inst::Alloca: |
141 lowerAlloca(llvm::dyn_cast<InstAlloca>(Inst)); | 145 lowerAlloca(llvm::dyn_cast<InstAlloca>(Inst)); |
142 break; | 146 break; |
143 case Inst::Arithmetic: | 147 case Inst::Arithmetic: |
144 lowerArithmetic(llvm::dyn_cast<InstArithmetic>(Inst)); | 148 lowerArithmetic(llvm::dyn_cast<InstArithmetic>(Inst)); |
145 break; | 149 break; |
146 case Inst::Assign: | 150 case Inst::Assign: |
147 lowerAssign(llvm::dyn_cast<InstAssign>(Inst)); | 151 lowerAssign(llvm::dyn_cast<InstAssign>(Inst)); |
148 break; | 152 break; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 break; | 197 break; |
194 case Inst::FakeDef: | 198 case Inst::FakeDef: |
195 case Inst::FakeUse: | 199 case Inst::FakeUse: |
196 case Inst::FakeKill: | 200 case Inst::FakeKill: |
197 case Inst::Target: | 201 case Inst::Target: |
198 // These are all Target instruction types and shouldn't be | 202 // These are all Target instruction types and shouldn't be |
199 // encountered at this stage. | 203 // encountered at this stage. |
200 Func->setError("Can't lower unsupported instruction type"); | 204 Func->setError("Can't lower unsupported instruction type"); |
201 break; | 205 break; |
202 } | 206 } |
203 Inst->setDeleted(); | |
204 | 207 |
205 postLower(); | 208 postLower(); |
206 | 209 |
207 Context.advanceCur(); | 210 Context.advanceCur(); |
208 Context.advanceNext(); | 211 Context.advanceNext(); |
209 } | 212 } |
210 | 213 |
211 // Drives register allocation, allowing all physical registers (except | 214 // Drives register allocation, allowing all physical registers (except |
212 // perhaps for the frame pointer) to be allocated. This set of | 215 // perhaps for the frame pointer) to be allocated. This set of |
213 // registers could potentially be parameterized if we want to restrict | 216 // registers could potentially be parameterized if we want to restrict |
(...skipping 25 matching lines...) Expand all Loading... |
239 if (Target == Target_ARM64) | 242 if (Target == Target_ARM64) |
240 return IceTargetGlobalInitARM64::create(Ctx); | 243 return IceTargetGlobalInitARM64::create(Ctx); |
241 #endif | 244 #endif |
242 llvm_unreachable("Unsupported target"); | 245 llvm_unreachable("Unsupported target"); |
243 return NULL; | 246 return NULL; |
244 } | 247 } |
245 | 248 |
246 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} | 249 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} |
247 | 250 |
248 } // end of namespace Ice | 251 } // end of namespace Ice |
OLD | NEW |