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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 | 90 |
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 if (Ctx->getFlags().getDisableHybridAssembly()) { | |
101 UnimplementedError(Ctx->getFlags()); | |
102 return; | |
103 } | |
104 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 100 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
105 std::string Buffer; | 101 std::string Buffer; |
106 llvm::raw_string_ostream StrBuf(Buffer); | 102 llvm::raw_string_ostream StrBuf(Buffer); |
107 OstreamLocker L(Ctx); | 103 OstreamLocker L(Ctx); |
108 Ostream &OldStr = Ctx->getStrEmit(); | 104 Ostream &OldStr = Ctx->getStrEmit(); |
109 Ctx->setStrEmit(StrBuf); | 105 Ctx->setStrEmit(StrBuf); |
110 // Start counting instructions here, so that emit() methods don't | 106 // Start counting instructions here, so that emit() methods don't |
111 // need to call this for the first instruction. | 107 // need to call this for the first instruction. |
112 Asm->resetEmitTextSize(); | 108 Asm->resetEmitTextSize(); |
113 Asm->incEmitTextSize(InstSize); | 109 Asm->incEmitTextSize(InstSize); |
114 emit(Func); | 110 emit(Func); |
115 Ctx->setStrEmit(OldStr); | 111 Ctx->setStrEmit(OldStr); |
112 if (Ctx->getFlags().getDisableHybridAssembly()) { | |
113 llvm::errs() << "Can't assemble: " << StrBuf.str() << "\n"; | |
114 UnimplementedError(Ctx->getFlags()); | |
115 return; | |
116 } | |
116 Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize()); | 117 Asm->emitTextInst(StrBuf.str(), Asm->getEmitTextSize()); |
117 } | 118 } |
118 | 119 |
119 void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } | 120 void InstARM32::emitIAS(const Cfg *Func) const { emitUsingTextFixup(Func); } |
120 | 121 |
121 void InstARM32Pred::emitUnaryopGPR(const char *Opcode, | 122 void InstARM32Pred::emitUnaryopGPR(const char *Opcode, |
122 const InstARM32Pred *Inst, const Cfg *Func, | 123 const InstARM32Pred *Inst, const Cfg *Func, |
123 bool NeedsWidthSuffix) { | 124 bool NeedsWidthSuffix) { |
124 Ostream &Str = Func->getContext()->getStrEmit(); | 125 Ostream &Str = Func->getContext()->getStrEmit(); |
125 assert(Inst->getSrcSize() == 1); | 126 assert(Inst->getSrcSize() == 1); |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1676 } | 1677 } |
1677 | 1678 |
1678 template <> void InstARM32Uxt::emitIAS(const Cfg *Func) const { | 1679 template <> void InstARM32Uxt::emitIAS(const Cfg *Func) const { |
1679 assert(getSrcSize() == 1); | 1680 assert(getSrcSize() == 1); |
1680 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1681 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
1681 Asm->uxt(getDest(), getSrc(0), getPredicate()); | 1682 Asm->uxt(getDest(), getSrc(0), getPredicate()); |
1682 if (Asm->needsTextFixup()) | 1683 if (Asm->needsTextFixup()) |
1683 emitUsingTextFixup(Func); | 1684 emitUsingTextFixup(Func); |
1684 } | 1685 } |
1685 | 1686 |
1687 template <InstARM32::InstKindARM32 K> | |
1688 void InstARM32UnaryopFP<K>::emitIAS(const Cfg *Func) const { | |
1689 emitUsingTextFixup(Func); | |
1690 } | |
1691 | |
1692 template <> void InstARM32Vsqrt::emitIAS(const Cfg *Func) const { | |
1693 assert(getSrcSize() == 1); | |
1694 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | |
1695 const Operand *Dest = getDest(); | |
1696 switch (Dest->getType()) { | |
1697 case IceType_f32: | |
1698 Asm->vsqrts(Dest, getSrc(0), getPredicate()); | |
1699 break; | |
1700 case IceType_f64: | |
1701 Asm->vsqrtd(Dest, getSrc(0), getPredicate()); | |
1702 break; | |
1703 default: | |
1704 llvm::report_fatal_error("Vqrt of non-floating type"); | |
Jim Stichnoth
2016/01/29 20:48:02
Vsqrt
Karl
2016/01/29 22:00:55
Done.
| |
1705 } | |
1706 if (Asm->needsTextFixup()) | |
1707 emitUsingTextFixup(Func); | |
1708 } | |
1709 | |
1686 const char *InstARM32Pop::getGPROpcode() const { return "pop"; } | 1710 const char *InstARM32Pop::getGPROpcode() const { return "pop"; } |
1687 | 1711 |
1688 const char *InstARM32Pop::getSRegOpcode() const { return "vpop"; } | 1712 const char *InstARM32Pop::getSRegOpcode() const { return "vpop"; } |
1689 | 1713 |
1690 Variable *InstARM32Pop::getStackReg(SizeT Index) const { return Dests[Index]; } | 1714 Variable *InstARM32Pop::getStackReg(SizeT Index) const { return Dests[Index]; } |
1691 | 1715 |
1692 SizeT InstARM32Pop::getNumStackRegs() const { return Dests.size(); } | 1716 SizeT InstARM32Pop::getNumStackRegs() const { return Dests.size(); } |
1693 | 1717 |
1694 void InstARM32Pop::emitSingleGPR(const Cfg *Func, const EmitForm Form, | 1718 void InstARM32Pop::emitSingleGPR(const Cfg *Func, const EmitForm Form, |
1695 const Variable *Reg) const { | 1719 const Variable *Reg) const { |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2426 | 2450 |
2427 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 2451 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
2428 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 2452 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
2429 | 2453 |
2430 template class InstARM32CmpLike<InstARM32::Cmn>; | 2454 template class InstARM32CmpLike<InstARM32::Cmn>; |
2431 template class InstARM32CmpLike<InstARM32::Cmp>; | 2455 template class InstARM32CmpLike<InstARM32::Cmp>; |
2432 template class InstARM32CmpLike<InstARM32::Tst>; | 2456 template class InstARM32CmpLike<InstARM32::Tst>; |
2433 | 2457 |
2434 } // end of namespace ARM32 | 2458 } // end of namespace ARM32 |
2435 } // end of namespace Ice | 2459 } // end of namespace Ice |
OLD | NEW |