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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 const char *NoWidthString = ""; | 585 const char *NoWidthString = ""; |
586 const char *WidthString = | 586 const char *WidthString = |
587 isVectorType(Src0->getType()) ? ".64" : NoWidthString; | 587 isVectorType(Src0->getType()) ? ".64" : NoWidthString; |
588 Str << "\t" << ActualOpcode << getPredicate() << WidthString << "\t"; | 588 Str << "\t" << ActualOpcode << getPredicate() << WidthString << "\t"; |
589 Src0->emit(Func); | 589 Src0->emit(Func); |
590 Str << ", "; | 590 Str << ", "; |
591 Dest->emit(Func); | 591 Dest->emit(Func); |
592 } | 592 } |
593 } | 593 } |
594 | 594 |
| 595 void InstARM32Mov::emitIASSingleDestSingleSource(const Cfg *Func) const { |
| 596 ARM32::AssemblerARM32 *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 597 Variable *Dest = getDest(); |
| 598 Operand *Src0 = getSrc(0); |
| 599 // Note: Loop is used so that we can short circuit using break. |
| 600 do { |
| 601 if (Dest->hasReg()) { |
| 602 Type DestTy = Dest->getType(); |
| 603 const bool DestIsVector = isVectorType(DestTy); |
| 604 const bool DestIsScalarFP = isScalarFloatingType(DestTy); |
| 605 const bool CoreVFPMove = isMoveBetweenCoreAndVFPRegisters(Dest, Src0); |
| 606 if (DestIsVector || DestIsScalarFP || CoreVFPMove) |
| 607 break; |
| 608 if (const auto *FlexImm = llvm::dyn_cast<OperandARM32FlexImm>(Src0)) { |
| 609 Asm->mov(static_cast<RegARM32::GPRRegister>(Dest->getRegNum()), |
| 610 *FlexImm, getPredicate()); |
| 611 return; |
| 612 } |
| 613 } |
| 614 } while (0); |
| 615 llvm_unreachable("not yet implemented"); |
| 616 } |
| 617 |
595 void InstARM32Mov::emit(const Cfg *Func) const { | 618 void InstARM32Mov::emit(const Cfg *Func) const { |
596 if (!BuildDefs::dump()) | 619 if (!BuildDefs::dump()) |
597 return; | 620 return; |
598 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); | 621 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); |
599 if (isMultiDest()) { | 622 if (isMultiDest()) { |
600 emitMultiDestSingleSource(Func); | 623 emitMultiDestSingleSource(Func); |
601 return; | 624 return; |
602 } | 625 } |
603 | 626 |
604 if (isMultiSource()) { | 627 if (isMultiSource()) { |
605 emitSingleDestMultiSource(Func); | 628 emitSingleDestMultiSource(Func); |
606 return; | 629 return; |
607 } | 630 } |
608 | 631 |
609 emitSingleDestSingleSource(Func); | 632 emitSingleDestSingleSource(Func); |
610 } | 633 } |
611 | 634 |
612 void InstARM32Mov::emitIAS(const Cfg *Func) const { | 635 void InstARM32Mov::emitIAS(const Cfg *Func) const { |
613 assert(getSrcSize() == 1); | 636 assert(getSrcSize() == 1); |
614 (void)Func; | 637 (void)Func; |
615 llvm_unreachable("Not yet implemented"); | 638 assert(!(isMultiDest() && isMultiSource()) && "Invalid vmov type."); |
| 639 if (isMultiDest()) |
| 640 llvm_unreachable("Not yet implemented"); |
| 641 if (isMultiSource()) |
| 642 llvm_unreachable("Not yet implemented"); |
| 643 // Must be single source/dest. |
| 644 emitIASSingleDestSingleSource(Func); |
616 } | 645 } |
617 | 646 |
618 void InstARM32Mov::dump(const Cfg *Func) const { | 647 void InstARM32Mov::dump(const Cfg *Func) const { |
619 if (!BuildDefs::dump()) | 648 if (!BuildDefs::dump()) |
620 return; | 649 return; |
621 assert(getSrcSize() == 1 || getSrcSize() == 2); | 650 assert(getSrcSize() == 1 || getSrcSize() == 2); |
622 Ostream &Str = Func->getContext()->getStrDump(); | 651 Ostream &Str = Func->getContext()->getStrDump(); |
623 Variable *Dest = getDest(); | 652 Variable *Dest = getDest(); |
624 Variable *DestHi = getDestHi(); | 653 Variable *DestHi = getDestHi(); |
625 Dest->dump(Func); | 654 Dest->dump(Func); |
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 if (getShiftOp() != kNoShift) { | 1417 if (getShiftOp() != kNoShift) { |
1389 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; | 1418 Str << ", " << InstARM32ShiftAttributes[getShiftOp()].EmitString << " "; |
1390 if (Func) | 1419 if (Func) |
1391 getShiftAmt()->dump(Func); | 1420 getShiftAmt()->dump(Func); |
1392 else | 1421 else |
1393 getShiftAmt()->dump(Str); | 1422 getShiftAmt()->dump(Str); |
1394 } | 1423 } |
1395 } | 1424 } |
1396 | 1425 |
1397 } // end of namespace Ice | 1426 } // end of namespace Ice |
OLD | NEW |