OLD | NEW |
1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===// | 1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction 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 InstARM32 and OperandARM32 classes, | 10 // This file implements the InstARM32 and OperandARM32 classes, |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 Inst::dump(Func); | 306 Inst::dump(Func); |
307 } | 307 } |
308 | 308 |
309 template <> void InstARM32Mov::emit(const Cfg *Func) const { | 309 template <> void InstARM32Mov::emit(const Cfg *Func) const { |
310 if (!ALLOW_DUMP) | 310 if (!ALLOW_DUMP) |
311 return; | 311 return; |
312 Ostream &Str = Func->getContext()->getStrEmit(); | 312 Ostream &Str = Func->getContext()->getStrEmit(); |
313 assert(getSrcSize() == 1); | 313 assert(getSrcSize() == 1); |
314 Variable *Dest = getDest(); | 314 Variable *Dest = getDest(); |
315 if (Dest->hasReg()) { | 315 if (Dest->hasReg()) { |
316 Str << "\t" | 316 const char *Opcode = "mov"; |
317 << "mov" << getPredicate() << "\t"; | 317 Operand *Src0 = getSrc(0); |
| 318 if (const auto *Src0V = llvm::dyn_cast<Variable>(Src0)) { |
| 319 if (!Src0V->hasReg()) { |
| 320 Opcode = "ldr"; // Always load the full stack slot (vs ldrb, ldrh). |
| 321 } |
| 322 } else { |
| 323 // If Src isn't a variable, it shouldn't be a memory operand either |
| 324 // (otherwise Opcode will have to be ldr). |
| 325 assert(!llvm::isa<OperandARM32Mem>(Src0)); |
| 326 } |
| 327 Str << "\t" << Opcode << getPredicate() << "\t"; |
318 getDest()->emit(Func); | 328 getDest()->emit(Func); |
319 Str << ", "; | 329 Str << ", "; |
320 getSrc(0)->emit(Func); | 330 getSrc(0)->emit(Func); |
321 } else { | 331 } else { |
322 Variable *Src0 = llvm::cast<Variable>(getSrc(0)); | 332 Variable *Src0 = llvm::cast<Variable>(getSrc(0)); |
323 assert(Src0->hasReg()); | 333 assert(Src0->hasReg()); |
324 Str << "\t" | 334 Str << "\t" |
325 << "str" << getPredicate() << "\t"; | 335 << "str" << getPredicate() << "\t"; |
326 Src0->emit(Func); | 336 Src0->emit(Func); |
327 Str << ", "; | 337 Str << ", "; |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 if (getShiftOp() != kNoShift) { | 725 if (getShiftOp() != kNoShift) { |
716 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; | 726 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; |
717 if (Func) | 727 if (Func) |
718 getShiftAmt()->dump(Func); | 728 getShiftAmt()->dump(Func); |
719 else | 729 else |
720 getShiftAmt()->dump(Str); | 730 getShiftAmt()->dump(Str); |
721 } | 731 } |
722 } | 732 } |
723 | 733 |
724 } // end of namespace Ice | 734 } // end of namespace Ice |
OLD | NEW |