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 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 // emitted text size. | 1653 // emitted text size. |
1654 if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>()) | 1654 if (auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>()) |
1655 Asm->decEmitTextSize(InstSize); | 1655 Asm->decEmitTextSize(InstSize); |
1656 Ostream &Str = Func->getContext()->getStrEmit(); | 1656 Ostream &Str = Func->getContext()->getStrEmit(); |
1657 Str << getName(Func) << ":"; | 1657 Str << getName(Func) << ":"; |
1658 } | 1658 } |
1659 | 1659 |
1660 void InstARM32Label::emitIAS(const Cfg *Func) const { | 1660 void InstARM32Label::emitIAS(const Cfg *Func) const { |
1661 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1661 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
1662 Asm->bindLocalLabel(Func, this, Number); | 1662 Asm->bindLocalLabel(Func, this, Number); |
| 1663 if (OffsetReloc != nullptr) { |
| 1664 Asm->bindRelocOffset(OffsetReloc); |
| 1665 } |
1663 if (Asm->needsTextFixup()) | 1666 if (Asm->needsTextFixup()) |
1664 emitUsingTextFixup(Func); | 1667 emitUsingTextFixup(Func); |
1665 } | 1668 } |
1666 | 1669 |
1667 void InstARM32Label::dump(const Cfg *Func) const { | 1670 void InstARM32Label::dump(const Cfg *Func) const { |
1668 if (!BuildDefs::dump()) | 1671 if (!BuildDefs::dump()) |
1669 return; | 1672 return; |
1670 Ostream &Str = Func->getContext()->getStrDump(); | 1673 Ostream &Str = Func->getContext()->getStrDump(); |
1671 Str << getName(Func) << ":"; | 1674 Str << getName(Func) << ":"; |
1672 } | 1675 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1792 return; | 1795 return; |
1793 Ostream &Str = Func->getContext()->getStrEmit(); | 1796 Ostream &Str = Func->getContext()->getStrEmit(); |
1794 assert(getSrcSize() == 1); | 1797 assert(getSrcSize() == 1); |
1795 Str << "\t" << Opcode << getPredicate() << "\t"; | 1798 Str << "\t" << Opcode << getPredicate() << "\t"; |
1796 getDest()->emit(Func); | 1799 getDest()->emit(Func); |
1797 Str << ", "; | 1800 Str << ", "; |
1798 auto *Src0 = llvm::cast<Constant>(getSrc(0)); | 1801 auto *Src0 = llvm::cast<Constant>(getSrc(0)); |
1799 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { | 1802 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src0)) { |
1800 Str << "#:lower16:"; | 1803 Str << "#:lower16:"; |
1801 CR->emitWithoutPrefix(Func->getTarget()); | 1804 CR->emitWithoutPrefix(Func->getTarget()); |
| 1805 if (Func->getContext()->getFlags().getUseNonsfi()) { |
| 1806 Str << " - ."; |
| 1807 } |
1802 } else { | 1808 } else { |
1803 Src0->emit(Func); | 1809 Src0->emit(Func); |
1804 } | 1810 } |
1805 } | 1811 } |
1806 | 1812 |
1807 template <> void InstARM32Movw::emitIAS(const Cfg *Func) const { | 1813 template <> void InstARM32Movw::emitIAS(const Cfg *Func) const { |
1808 assert(getSrcSize() == 1); | 1814 assert(getSrcSize() == 1); |
1809 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1815 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
1810 Asm->movw(getDest(), getSrc(0), getPredicate()); | 1816 Asm->movw(getDest(), getSrc(0), getPredicate()); |
1811 if (Asm->needsTextFixup()) | 1817 if (Asm->needsTextFixup()) |
1812 emitUsingTextFixup(Func); | 1818 emitUsingTextFixup(Func); |
1813 } | 1819 } |
1814 | 1820 |
1815 template <> void InstARM32Movt::emit(const Cfg *Func) const { | 1821 template <> void InstARM32Movt::emit(const Cfg *Func) const { |
1816 if (!BuildDefs::dump()) | 1822 if (!BuildDefs::dump()) |
1817 return; | 1823 return; |
1818 Ostream &Str = Func->getContext()->getStrEmit(); | 1824 Ostream &Str = Func->getContext()->getStrEmit(); |
1819 assert(getSrcSize() == 2); | 1825 assert(getSrcSize() == 2); |
1820 Variable *Dest = getDest(); | 1826 Variable *Dest = getDest(); |
1821 auto *Src1 = llvm::cast<Constant>(getSrc(1)); | 1827 auto *Src1 = llvm::cast<Constant>(getSrc(1)); |
1822 Str << "\t" << Opcode << getPredicate() << "\t"; | 1828 Str << "\t" << Opcode << getPredicate() << "\t"; |
1823 Dest->emit(Func); | 1829 Dest->emit(Func); |
1824 Str << ", "; | 1830 Str << ", "; |
1825 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { | 1831 if (auto *CR = llvm::dyn_cast<ConstantRelocatable>(Src1)) { |
1826 Str << "#:upper16:"; | 1832 Str << "#:upper16:"; |
1827 CR->emitWithoutPrefix(Func->getTarget()); | 1833 CR->emitWithoutPrefix(Func->getTarget()); |
| 1834 if (Func->getContext()->getFlags().getUseNonsfi()) { |
| 1835 Str << " - ."; |
| 1836 } |
1828 } else { | 1837 } else { |
1829 Src1->emit(Func); | 1838 Src1->emit(Func); |
1830 } | 1839 } |
1831 } | 1840 } |
1832 | 1841 |
1833 template <> void InstARM32Movt::emitIAS(const Cfg *Func) const { | 1842 template <> void InstARM32Movt::emitIAS(const Cfg *Func) const { |
1834 assert(getSrcSize() == 2); | 1843 assert(getSrcSize() == 2); |
1835 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); | 1844 auto *Asm = Func->getAssembler<ARM32::AssemblerARM32>(); |
1836 Asm->movt(getDest(), getSrc(1), getPredicate()); | 1845 Asm->movt(getDest(), getSrc(1), getPredicate()); |
1837 if (Asm->needsTextFixup()) | 1846 if (Asm->needsTextFixup()) |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2668 | 2677 |
2669 template class InstARM32FourAddrGPR<InstARM32::Mla>; | 2678 template class InstARM32FourAddrGPR<InstARM32::Mla>; |
2670 template class InstARM32FourAddrGPR<InstARM32::Mls>; | 2679 template class InstARM32FourAddrGPR<InstARM32::Mls>; |
2671 | 2680 |
2672 template class InstARM32CmpLike<InstARM32::Cmn>; | 2681 template class InstARM32CmpLike<InstARM32::Cmn>; |
2673 template class InstARM32CmpLike<InstARM32::Cmp>; | 2682 template class InstARM32CmpLike<InstARM32::Cmp>; |
2674 template class InstARM32CmpLike<InstARM32::Tst>; | 2683 template class InstARM32CmpLike<InstARM32::Tst>; |
2675 | 2684 |
2676 } // end of namespace ARM32 | 2685 } // end of namespace ARM32 |
2677 } // end of namespace Ice | 2686 } // end of namespace Ice |
OLD | NEW |