| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void InstARM32::startNextInst(const Cfg *Func) const { | 91 void InstARM32::startNextInst(const Cfg *Func) const { |
| 92 if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>()) | 92 if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>()) |
| 93 Asm->incEmitTextSize(InstSize); | 93 Asm->incEmitTextSize(InstSize); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void InstARM32::emitUsingTextFixup(const Cfg *Func) const { | 96 void InstARM32::emitUsingTextFixup(const Cfg *Func) const { |
| 97 if (!BuildDefs::dump()) | 97 if (!BuildDefs::dump()) |
| 98 return; | 98 return; |
| 99 GlobalContext *Ctx = Func->getContext(); | 99 GlobalContext *Ctx = Func->getContext(); |
| 100 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 100 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 101 if (Ctx->getFlags().getDisableHybridAssembly() && |
| 102 Ctx->getFlags().getSkipUnimplemented()) { |
| 103 Asm->trap(); |
| 104 Asm->resetNeedsTextFixup(); |
| 105 return; |
| 106 } |
| 101 std::string Buffer; | 107 std::string Buffer; |
| 102 llvm::raw_string_ostream StrBuf(Buffer); | 108 llvm::raw_string_ostream StrBuf(Buffer); |
| 103 OstreamLocker L(Ctx); | 109 OstreamLocker L(Ctx); |
| 104 Ostream &OldStr = Ctx->getStrEmit(); | 110 Ostream &OldStr = Ctx->getStrEmit(); |
| 105 Ctx->setStrEmit(StrBuf); | 111 Ctx->setStrEmit(StrBuf); |
| 106 // Start counting instructions here, so that emit() methods don't | 112 // Start counting instructions here, so that emit() methods don't |
| 107 // need to call this for the first instruction. | 113 // need to call this for the first instruction. |
| 108 Asm->resetEmitTextSize(); | 114 Asm->resetEmitTextSize(); |
| 109 Asm->incEmitTextSize(InstSize); | 115 Asm->incEmitTextSize(InstSize); |
| 110 emit(Func); | 116 emit(Func); |
| 111 Ctx->setStrEmit(OldStr); | 117 Ctx->setStrEmit(OldStr); |
| 112 if (Ctx->getFlags().getDisableHybridAssembly()) { | 118 if (Ctx->getFlags().getDisableHybridAssembly()) { |
| 113 if (Ctx->getFlags().getSkipUnimplemented()) { | 119 if (Ctx->getFlags().getSkipUnimplemented()) { |
| 114 Asm->trap(); | 120 Asm->trap(); |
| 115 } else { | 121 } else { |
| 116 llvm::errs() << "Can't assemble: " << StrBuf.str() << "\n"; | 122 llvm::errs() << "Can't assemble: " << StrBuf.str() << "\n"; |
| 117 UnimplementedError(Ctx->getFlags()); | 123 UnimplementedError(Ctx->getFlags()); |
| 118 } | 124 } |
| 125 Asm->resetNeedsTextFixup(); |
| 119 return; | 126 return; |
| 120 } | 127 } |
| 121 Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize()); | 128 Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize()); |
| 122 } | 129 } |
| 123 | 130 |
| 124 void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } | 131 void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } |
| 125 | 132 |
| 126 void InstARM32Pred::emitUnaryopGPR(const char *Opcode, | 133 void InstARM32Pred::emitUnaryopGPR(const char *Opcode, |
| 127 const InstARM32Pred *Inst, const Cfg *Func, | 134 const InstARM32Pred *Inst, const Cfg *Func, |
| 128 bool NeedsWidthSuffix) { | 135 bool NeedsWidthSuffix) { |
| (...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 } | 735 } |
| 729 } | 736 } |
| 730 | 737 |
| 731 template <> void InstARM32Vmul::emitIAS(const Cfg *Func) const { | 738 template <> void InstARM32Vmul::emitIAS(const Cfg *Func) const { |
| 732 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 739 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
| 733 const Variable *Dest = getDest(); | 740 const Variable *Dest = getDest(); |
| 734 switch (Dest->getType()) { | 741 switch (Dest->getType()) { |
| 735 default: | 742 default: |
| 736 // TODO(kschimpf) Figure if more cases are needed. | 743 // TODO(kschimpf) Figure if more cases are needed. |
| 737 emitUsingTextFixup(Func); | 744 emitUsingTextFixup(Func); |
| 738 break; | 745 return; |
| 739 case IceType_f32: | 746 case IceType_f32: |
| 740 Asm->vmuls(getDest(), getSrc(0), getSrc(1), CondARM32::AL); | 747 Asm->vmuls(getDest(), getSrc(0), getSrc(1), CondARM32::AL); |
| 741 assert(!Asm->needsTextFixup()); | 748 assert(!Asm->needsTextFixup()); |
| 742 break; | 749 return; |
| 743 case IceType_f64: | 750 case IceType_f64: |
| 744 Asm->vmuld(getDest(), getSrc(0), getSrc(1), CondARM32::AL); | 751 Asm->vmuld(getDest(), getSrc(0), getSrc(1), CondARM32::AL); |
| 745 assert(!Asm->needsTextFixup()); | 752 assert(!Asm->needsTextFixup()); |
| 746 break; | 753 return; |
| 747 } | 754 } |
| 748 assert(!Asm->needsTextFixup()); | |
| 749 } | 755 } |
| 750 | 756 |
| 751 InstARM32Call::InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget) | 757 InstARM32Call::InstARM32Call(Cfg *Func, Variable *Dest, Operand *CallTarget) |
| 752 : InstARM32(Func, InstARM32::Call, 1, Dest) { | 758 : InstARM32(Func, InstARM32::Call, 1, Dest) { |
| 753 HasSideEffects = true; | 759 HasSideEffects = true; |
| 754 addSource(CallTarget); | 760 addSource(CallTarget); |
| 755 } | 761 } |
| 756 | 762 |
| 757 InstARM32Label::InstARM32Label(Cfg *Func, TargetARM32 *Target) | 763 InstARM32Label::InstARM32Label(Cfg *Func, TargetARM32 *Target) |
| 758 : InstARM32(Func, InstARM32::Label, 0, nullptr), | 764 : InstARM32(Func, InstARM32::Label, 0, nullptr), |
| (...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 | 2466 |
| 2461 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 2467 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
| 2462 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 2468 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
| 2463 | 2469 |
| 2464 template class InstARM32CmpLike<InstARM32::Cmn>; | 2470 template class InstARM32CmpLike<InstARM32::Cmn>; |
| 2465 template class InstARM32CmpLike<InstARM32::Cmp>; | 2471 template class InstARM32CmpLike<InstARM32::Cmp>; |
| 2466 template class InstARM32CmpLike<InstARM32::Tst>; | 2472 template class InstARM32CmpLike<InstARM32::Tst>; |
| 2467 | 2473 |
| 2468 } // end of namespace ARM32 | 2474 } // end of namespace ARM32 |
| 2469 } // end of namespace Ice | 2475 } // end of namespace Ice |
| OLD | NEW |