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 /// \file | 10 /// \file |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 Str << "\t" | 533 Str << "\t" |
534 << "vmov" | 534 << "vmov" |
535 << "\t"; | 535 << "\t"; |
536 Dest0->emit(Func); | 536 Dest0->emit(Func); |
537 Str << ", "; | 537 Str << ", "; |
538 Src0->emit(Func); | 538 Src0->emit(Func); |
539 Str << ", "; | 539 Str << ", "; |
540 Src1->emit(Func); | 540 Src1->emit(Func); |
541 } | 541 } |
542 | 542 |
543 namespace { | |
544 bool isVariableWithoutRegister(Operand *Op) { | |
Jim Stichnoth
2015/09/16 21:31:54
Consider declaring these as const Operand * ?
John
2015/09/16 23:12:46
Done.
| |
545 if (const auto *OpV = llvm::dyn_cast<Variable>(Op)) { | |
546 return !OpV->hasReg(); | |
547 } | |
548 return false; | |
549 } | |
550 | |
551 bool isMemoryAccess(Operand *Op) { | |
552 return isVariableWithoutRegister(Op) || llvm::isa<OperandARM32Mem>(Op); | |
553 } | |
554 } // end of anonymous namespace | |
555 | |
543 void InstARM32Vmov::emitSingleDestSingleSource(const Cfg *Func) const { | 556 void InstARM32Vmov::emitSingleDestSingleSource(const Cfg *Func) const { |
544 if (!BuildDefs::dump()) | 557 if (!BuildDefs::dump()) |
545 return; | 558 return; |
546 Ostream &Str = Func->getContext()->getStrEmit(); | 559 Ostream &Str = Func->getContext()->getStrEmit(); |
547 Variable *Dest = getDest(); | 560 Variable *Dest = getDest(); |
548 if (Dest->hasReg()) { | 561 if (Dest->hasReg()) { |
549 IceString ActualOpcode = "vmov"; | |
550 Operand *Src0 = getSrc(0); | 562 Operand *Src0 = getSrc(0); |
551 if (const auto *Src0V = llvm::dyn_cast<Variable>(Src0)) { | 563 const char *ActualOpcode = isMemoryAccess(Src0) ? "vldr" : "vmov"; |
552 if (!Src0V->hasReg()) { | |
553 ActualOpcode = IceString("vldr"); | |
554 } | |
555 } else { | |
556 if (llvm::isa<OperandARM32Mem>(Src0)) | |
557 ActualOpcode = IceString("vldr"); | |
558 } | |
559 Str << "\t" << ActualOpcode << "\t"; | 564 Str << "\t" << ActualOpcode << "\t"; |
560 getDest()->emit(Func); | 565 Dest->emit(Func); |
561 Str << ", "; | 566 Str << ", "; |
562 getSrc(0)->emit(Func); | 567 Src0->emit(Func); |
563 } else { | 568 } else { |
564 Variable *Src0 = llvm::cast<Variable>(getSrc(0)); | 569 Variable *Src0 = llvm::cast<Variable>(getSrc(0)); |
565 assert(Src0->hasReg()); | 570 assert(Src0->hasReg()); |
566 Str << "\t" | 571 Str << "\t" |
567 "vstr" | 572 "vstr" |
568 "\t"; | 573 "\t"; |
569 Src0->emit(Func); | 574 Src0->emit(Func); |
570 Str << ", "; | 575 Str << ", "; |
571 Dest->emit(Func); | 576 Dest->emit(Func); |
572 } | 577 } |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
892 Str << "ret." << Ty << " "; | 897 Str << "ret." << Ty << " "; |
893 dumpSources(Func); | 898 dumpSources(Func); |
894 } | 899 } |
895 | 900 |
896 void InstARM32Str::emit(const Cfg *Func) const { | 901 void InstARM32Str::emit(const Cfg *Func) const { |
897 if (!BuildDefs::dump()) | 902 if (!BuildDefs::dump()) |
898 return; | 903 return; |
899 Ostream &Str = Func->getContext()->getStrEmit(); | 904 Ostream &Str = Func->getContext()->getStrEmit(); |
900 assert(getSrcSize() == 2); | 905 assert(getSrcSize() == 2); |
901 Type Ty = getSrc(0)->getType(); | 906 Type Ty = getSrc(0)->getType(); |
902 Str << "\t" | 907 const char *Opcode = isScalarFloatingType(Ty) ? "vstr" : "str"; |
903 << "str" << getWidthString(Ty) << getPredicate() << "\t"; | 908 Str << "\t" << Opcode << getWidthString(Ty) << getPredicate() << "\t"; |
904 getSrc(0)->emit(Func); | 909 getSrc(0)->emit(Func); |
905 Str << ", "; | 910 Str << ", "; |
906 getSrc(1)->emit(Func); | 911 getSrc(1)->emit(Func); |
907 } | 912 } |
908 | 913 |
909 void InstARM32Str::emitIAS(const Cfg *Func) const { | 914 void InstARM32Str::emitIAS(const Cfg *Func) const { |
910 assert(getSrcSize() == 2); | 915 assert(getSrcSize() == 2); |
911 (void)Func; | 916 (void)Func; |
912 llvm_unreachable("Not yet implemented"); | 917 llvm_unreachable("Not yet implemented"); |
913 } | 918 } |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1151 if (getShiftOp() != kNoShift) { | 1156 if (getShiftOp() != kNoShift) { |
1152 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; | 1157 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; |
1153 if (Func) | 1158 if (Func) |
1154 getShiftAmt()->dump(Func); | 1159 getShiftAmt()->dump(Func); |
1155 else | 1160 else |
1156 getShiftAmt()->dump(Str); | 1161 getShiftAmt()->dump(Str); |
1157 } | 1162 } |
1158 } | 1163 } |
1159 | 1164 |
1160 } // end of namespace Ice | 1165 } // end of namespace Ice |
OLD | NEW |