OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // | 4 // |
5 // Modified by the Subzero authors. | 5 // Modified by the Subzero authors. |
6 // | 6 // |
7 //===- subzero/src/assembler_ia32.cpp - Assembler for x86-32 -------------===// | 7 //===- subzero/src/assembler_ia32.cpp - Assembler for x86-32 -------------===// |
8 // | 8 // |
9 // The Subzero Code Generator | 9 // The Subzero Code Generator |
10 // | 10 // |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1103 EmitUint8(0xDB); | 1103 EmitUint8(0xDB); |
1104 EmitOperand(0, src); | 1104 EmitOperand(0, src); |
1105 } | 1105 } |
1106 | 1106 |
1107 void AssemblerX86::fincstp() { | 1107 void AssemblerX86::fincstp() { |
1108 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1108 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1109 EmitUint8(0xD9); | 1109 EmitUint8(0xD9); |
1110 EmitUint8(0xF7); | 1110 EmitUint8(0xF7); |
1111 } | 1111 } |
1112 | 1112 |
1113 void AssemblerX86::xchgl(GPRRegister dst, GPRRegister src) { | |
1114 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1115 EmitUint8(0x87); | |
1116 EmitRegisterOperand(dst, src); | |
1117 } | |
1118 | |
1119 void AssemblerX86::cmpl(GPRRegister reg, const Immediate &imm) { | 1113 void AssemblerX86::cmpl(GPRRegister reg, const Immediate &imm) { |
1120 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1114 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1121 EmitComplex(7, Operand(reg), imm); | 1115 EmitComplex(7, Operand(reg), imm); |
1122 } | 1116 } |
1123 | 1117 |
1124 void AssemblerX86::cmpl(GPRRegister reg0, GPRRegister reg1) { | 1118 void AssemblerX86::cmpl(GPRRegister reg0, GPRRegister reg1) { |
1125 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1119 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1126 EmitUint8(0x3B); | 1120 EmitUint8(0x3B); |
1127 EmitOperand(reg0, Operand(reg1)); | 1121 EmitOperand(reg0, Operand(reg1)); |
1128 } | 1122 } |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1300 EmitUint8(0x2B); | 1294 EmitUint8(0x2B); |
1301 EmitOperand(reg, address); | 1295 EmitOperand(reg, address); |
1302 } | 1296 } |
1303 | 1297 |
1304 void AssemblerX86::subl(const Address &address, GPRRegister reg) { | 1298 void AssemblerX86::subl(const Address &address, GPRRegister reg) { |
1305 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1299 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1306 EmitUint8(0x29); | 1300 EmitUint8(0x29); |
1307 EmitOperand(reg, address); | 1301 EmitOperand(reg, address); |
1308 } | 1302 } |
1309 | 1303 |
1304 void AssemblerX86::cbw() { | |
1305 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1306 EmitOperandSizeOverride(); | |
1307 EmitUint8(0x98); | |
1308 } | |
1309 | |
1310 void AssemblerX86::cwd() { | |
1311 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1312 EmitOperandSizeOverride(); | |
1313 EmitUint8(0x99); | |
1314 } | |
1315 | |
1310 void AssemblerX86::cdq() { | 1316 void AssemblerX86::cdq() { |
1311 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1317 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1312 EmitUint8(0x99); | 1318 EmitUint8(0x99); |
1313 } | 1319 } |
1314 | 1320 |
1315 void AssemblerX86::idivl(GPRRegister reg) { | 1321 void AssemblerX86::idivl(GPRRegister reg) { |
1316 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1322 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1317 EmitUint8(0xF7); | 1323 EmitUint8(0xF7); |
1318 EmitUint8(0xF8 | reg); | 1324 EmitUint8(0xF8 | reg); |
1319 } | 1325 } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1667 EmitUint8(0xE9); | 1673 EmitUint8(0xE9); |
1668 EmitFixup(DirectCallRelocation::create(this, FK_PcRel_4, label)); | 1674 EmitFixup(DirectCallRelocation::create(this, FK_PcRel_4, label)); |
1669 EmitInt32(-4); | 1675 EmitInt32(-4); |
1670 } | 1676 } |
1671 | 1677 |
1672 void AssemblerX86::lock() { | 1678 void AssemblerX86::lock() { |
1673 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1679 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1674 EmitUint8(0xF0); | 1680 EmitUint8(0xF0); |
1675 } | 1681 } |
1676 | 1682 |
1677 void AssemblerX86::cmpxchgl(const Address &address, GPRRegister reg) { | 1683 void AssemblerX86::cmpxchg(Type Ty, const Address &address, GPRRegister reg) { |
1684 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1685 if (Ty == IceType_i16) | |
1686 EmitOperandSizeOverride(); | |
1687 EmitUint8(0x0F); | |
1688 if (Ty == IceType_i1 || Ty == IceType_i8) | |
Jim Stichnoth
2014/09/23 17:21:20
After the dust settles, I think there are a lot of
jvoung (off chromium)
2014/09/23 20:20:56
Acknowledged.
Yep -- Agreed. Technically there s
| |
1689 EmitUint8(0xB0); | |
1690 else | |
1691 EmitUint8(0xB1); | |
1692 EmitOperand(reg, address); | |
1693 } | |
1694 | |
1695 void AssemblerX86::cmpxchg8b(const Address &address) { | |
1678 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1696 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1679 EmitUint8(0x0F); | 1697 EmitUint8(0x0F); |
1680 EmitUint8(0xB1); | 1698 EmitUint8(0xC7); |
1681 EmitOperand(reg, address); | 1699 EmitOperand(1, address); |
1700 } | |
1701 | |
1702 void AssemblerX86::xadd(Type Ty, const Address &addr, GPRRegister reg) { | |
1703 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1704 if (Ty == IceType_i16) | |
1705 EmitOperandSizeOverride(); | |
1706 EmitUint8(0x0F); | |
1707 if (Ty == IceType_i1 || Ty == IceType_i8) | |
1708 EmitUint8(0xC0); | |
1709 else | |
1710 EmitUint8(0xC1); | |
1711 EmitOperand(reg, addr); | |
1712 } | |
1713 | |
1714 void AssemblerX86::xchg(Type Ty, const Address &addr, GPRRegister reg) { | |
1715 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | |
1716 if (Ty == IceType_i16) | |
1717 EmitOperandSizeOverride(); | |
1718 if (Ty == IceType_i1 || Ty == IceType_i8) | |
1719 EmitUint8(0x86); | |
1720 else | |
1721 EmitUint8(0x87); | |
1722 EmitOperand(reg, addr); | |
1682 } | 1723 } |
1683 | 1724 |
1684 void AssemblerX86::Align(intptr_t alignment, intptr_t offset) { | 1725 void AssemblerX86::Align(intptr_t alignment, intptr_t offset) { |
1685 assert(llvm::isPowerOf2_32(alignment)); | 1726 assert(llvm::isPowerOf2_32(alignment)); |
1686 intptr_t pos = offset + buffer_.GetPosition(); | 1727 intptr_t pos = offset + buffer_.GetPosition(); |
1687 intptr_t mod = pos & (alignment - 1); | 1728 intptr_t mod = pos & (alignment - 1); |
1688 if (mod == 0) { | 1729 if (mod == 0) { |
1689 return; | 1730 return; |
1690 } | 1731 } |
1691 intptr_t bytes_needed = alignment - mod; | 1732 intptr_t bytes_needed = alignment - mod; |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1813 void AssemblerX86::EmitGenericShift(int rm, const Operand &operand, | 1854 void AssemblerX86::EmitGenericShift(int rm, const Operand &operand, |
1814 GPRRegister shifter) { | 1855 GPRRegister shifter) { |
1815 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1856 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
1816 assert(shifter == RegX8632::Encoded_Reg_ecx); | 1857 assert(shifter == RegX8632::Encoded_Reg_ecx); |
1817 EmitUint8(0xD3); | 1858 EmitUint8(0xD3); |
1818 EmitOperand(rm, Operand(operand)); | 1859 EmitOperand(rm, Operand(operand)); |
1819 } | 1860 } |
1820 | 1861 |
1821 } // end of namespace x86 | 1862 } // end of namespace x86 |
1822 } // end of namespace Ice | 1863 } // end of namespace Ice |
OLD | NEW |