| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 EmitLabel(label, kSize); | 84 EmitLabel(label, kSize); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void AssemblerX86::call(const ConstantRelocatable *label) { | 87 void AssemblerX86::call(const ConstantRelocatable *label) { |
| 88 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 88 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 89 intptr_t call_start = buffer_.GetPosition(); | 89 intptr_t call_start = buffer_.GetPosition(); |
| 90 EmitUint8(0xE8); | 90 EmitUint8(0xE8); |
| 91 EmitFixup(DirectCallRelocation::create(this, FK_PcRel_4, label)); | 91 EmitFixup(DirectCallRelocation::create(this, FK_PcRel_4, label)); |
| 92 EmitInt32(-4); | 92 EmitInt32(-4); |
| 93 assert((buffer_.GetPosition() - call_start) == kCallExternalLabelSize); | 93 assert((buffer_.GetPosition() - call_start) == kCallExternalLabelSize); |
| 94 (void)call_start; |
| 94 } | 95 } |
| 95 | 96 |
| 96 void AssemblerX86::pushl(GPRRegister reg) { | 97 void AssemblerX86::pushl(GPRRegister reg) { |
| 97 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 98 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 98 EmitUint8(0x50 + reg); | 99 EmitUint8(0x50 + reg); |
| 99 } | 100 } |
| 100 | 101 |
| 101 void AssemblerX86::pushl(const Address &address) { | 102 void AssemblerX86::pushl(const Address &address) { |
| 102 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 103 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 103 EmitUint8(0xFF); | 104 EmitUint8(0xFF); |
| (...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1742 | 1743 |
| 1743 void AssemblerX86::notl(GPRRegister reg) { | 1744 void AssemblerX86::notl(GPRRegister reg) { |
| 1744 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1745 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1745 EmitUint8(0xF7); | 1746 EmitUint8(0xF7); |
| 1746 EmitUint8(0xD0 | reg); | 1747 EmitUint8(0xD0 | reg); |
| 1747 } | 1748 } |
| 1748 | 1749 |
| 1749 void AssemblerX86::bswap(Type Ty, GPRRegister reg) { | 1750 void AssemblerX86::bswap(Type Ty, GPRRegister reg) { |
| 1750 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1751 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1751 assert(Ty == IceType_i32); | 1752 assert(Ty == IceType_i32); |
| 1753 (void)Ty; |
| 1752 EmitUint8(0x0F); | 1754 EmitUint8(0x0F); |
| 1753 EmitUint8(0xC8 | reg); | 1755 EmitUint8(0xC8 | reg); |
| 1754 } | 1756 } |
| 1755 | 1757 |
| 1756 void AssemblerX86::bsf(Type Ty, GPRRegister dst, GPRRegister src) { | 1758 void AssemblerX86::bsf(Type Ty, GPRRegister dst, GPRRegister src) { |
| 1757 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1759 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1758 assert(Ty == IceType_i16 || Ty == IceType_i32); | 1760 assert(Ty == IceType_i16 || Ty == IceType_i32); |
| 1759 if (Ty == IceType_i16) | 1761 if (Ty == IceType_i16) |
| 1760 EmitOperandSizeOverride(); | 1762 EmitOperandSizeOverride(); |
| 1761 EmitUint8(0x0F); | 1763 EmitUint8(0x0F); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2138 EmitUint8(0xC1); | 2140 EmitUint8(0xC1); |
| 2139 EmitOperand(rm, Operand(reg)); | 2141 EmitOperand(rm, Operand(reg)); |
| 2140 EmitUint8(imm.value() & 0xFF); | 2142 EmitUint8(imm.value() & 0xFF); |
| 2141 } | 2143 } |
| 2142 } | 2144 } |
| 2143 | 2145 |
| 2144 void AssemblerX86::EmitGenericShift(int rm, const Operand &operand, | 2146 void AssemblerX86::EmitGenericShift(int rm, const Operand &operand, |
| 2145 GPRRegister shifter) { | 2147 GPRRegister shifter) { |
| 2146 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 2148 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 2147 assert(shifter == RegX8632::Encoded_Reg_ecx); | 2149 assert(shifter == RegX8632::Encoded_Reg_ecx); |
| 2150 (void)shifter; |
| 2148 EmitUint8(0xD3); | 2151 EmitUint8(0xD3); |
| 2149 EmitOperand(rm, Operand(operand)); | 2152 EmitOperand(rm, Operand(operand)); |
| 2150 } | 2153 } |
| 2151 | 2154 |
| 2152 } // end of namespace x86 | 2155 } // end of namespace x86 |
| 2153 } // end of namespace Ice | 2156 } // end of namespace Ice |
| OLD | NEW |