Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 //===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- C++ -*-=// | 1 //===- subzero/src/IceAssemblerX86BaseImpl.h - base x86 assembler -*- C++ -*-=// |
| 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 // | 5 // |
| 6 // Modified by the Subzero authors. | 6 // Modified by the Subzero authors. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // The Subzero Code Generator | 10 // The Subzero Code Generator |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 emitRex(RexTypeIrrelevant, address, RexRegIrrelevant); | 116 emitRex(RexTypeIrrelevant, address, RexRegIrrelevant); |
| 117 emitUint8(0xFF); | 117 emitUint8(0xFF); |
| 118 emitOperand(2, address); | 118 emitOperand(2, address); |
| 119 } | 119 } |
| 120 | 120 |
| 121 template <class Machine> | 121 template <class Machine> |
| 122 void AssemblerX86Base<Machine>::call(const ConstantRelocatable *label) { | 122 void AssemblerX86Base<Machine>::call(const ConstantRelocatable *label) { |
| 123 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 123 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 124 intptr_t call_start = Buffer.getPosition(); | 124 intptr_t call_start = Buffer.getPosition(); |
| 125 emitUint8(0xE8); | 125 emitUint8(0xE8); |
| 126 emitFixup(this->createFixup(Traits::PcRelFixup, label)); | 126 emitFixup(this->createFixup(Traits::FK_PcRel, label)); |
| 127 emitInt32(-4); | 127 emitInt32(-4); |
| 128 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); | 128 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); |
| 129 (void)call_start; | 129 (void)call_start; |
| 130 } | 130 } |
| 131 | 131 |
| 132 template <class Machine> | 132 template <class Machine> |
| 133 void AssemblerX86Base<Machine>::call(const Immediate &abs_address) { | 133 void AssemblerX86Base<Machine>::call(const Immediate &abs_address) { |
| 134 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 134 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 135 intptr_t call_start = Buffer.getPosition(); | 135 intptr_t call_start = Buffer.getPosition(); |
| 136 emitUint8(0xE8); | 136 emitUint8(0xE8); |
| 137 emitFixup(this->createFixup(Traits::PcRelFixup, AssemblerFixup::NullSymbol)); | 137 emitFixup(this->createFixup(Traits::FK_PcRel, AssemblerFixup::NullSymbol)); |
| 138 emitInt32(abs_address.value() - 4); | 138 emitInt32(abs_address.value() - 4); |
| 139 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); | 139 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); |
| 140 (void)call_start; | 140 (void)call_start; |
| 141 } | 141 } |
| 142 | 142 |
| 143 template <class Machine> | 143 template <class Machine> |
| 144 void AssemblerX86Base<Machine>::pushl(typename Traits::GPRRegister reg) { | 144 void AssemblerX86Base<Machine>::pushl(typename Traits::GPRRegister reg) { |
| 145 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 145 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 146 emitRexB(RexTypeIrrelevant, reg); | 146 emitRexB(RexTypeIrrelevant, reg); |
| 147 emitUint8(0x50 + gprEncoding(reg)); | 147 emitUint8(0x50 + gprEncoding(reg)); |
| (...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3217 emitLabelLink(label); | 3217 emitLabelLink(label); |
| 3218 } | 3218 } |
| 3219 } | 3219 } |
| 3220 | 3220 |
| 3221 template <class Machine> | 3221 template <class Machine> |
| 3222 void AssemblerX86Base<Machine>::j(typename Traits::Cond::BrCond condition, | 3222 void AssemblerX86Base<Machine>::j(typename Traits::Cond::BrCond condition, |
| 3223 const ConstantRelocatable *label) { | 3223 const ConstantRelocatable *label) { |
| 3224 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3224 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3225 emitUint8(0x0F); | 3225 emitUint8(0x0F); |
| 3226 emitUint8(0x80 + condition); | 3226 emitUint8(0x80 + condition); |
| 3227 emitFixup(this->createFixup(Traits::PcRelFixup, label)); | 3227 assert(0 && "Untested - please verify and then remove this assert."); |
|
John
2016/01/04 21:33:51
Why isn't this codepath exercised yet? If this ins
Jim Stichnoth
2016/01/04 23:32:12
We don't (yet) have a way to produce a conditional
| |
| 3228 emitFixup(this->createFixup(Traits::FK_PcRel, label)); | |
| 3228 emitInt32(-4); | 3229 emitInt32(-4); |
| 3229 } | 3230 } |
| 3230 | 3231 |
| 3231 template <class Machine> | 3232 template <class Machine> |
| 3232 void AssemblerX86Base<Machine>::jmp(typename Traits::GPRRegister reg) { | 3233 void AssemblerX86Base<Machine>::jmp(typename Traits::GPRRegister reg) { |
| 3233 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3234 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3234 emitRexB(RexTypeIrrelevant, reg); | 3235 emitRexB(RexTypeIrrelevant, reg); |
| 3235 emitUint8(0xFF); | 3236 emitUint8(0xFF); |
| 3236 emitRegisterOperand(4, gprEncoding(reg)); | 3237 emitRegisterOperand(4, gprEncoding(reg)); |
| 3237 } | 3238 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 3257 } else { | 3258 } else { |
| 3258 emitUint8(0xE9); | 3259 emitUint8(0xE9); |
| 3259 emitLabelLink(label); | 3260 emitLabelLink(label); |
| 3260 } | 3261 } |
| 3261 } | 3262 } |
| 3262 | 3263 |
| 3263 template <class Machine> | 3264 template <class Machine> |
| 3264 void AssemblerX86Base<Machine>::jmp(const ConstantRelocatable *label) { | 3265 void AssemblerX86Base<Machine>::jmp(const ConstantRelocatable *label) { |
| 3265 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3266 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3266 emitUint8(0xE9); | 3267 emitUint8(0xE9); |
| 3267 emitFixup(this->createFixup(Traits::PcRelFixup, label)); | 3268 assert(0 && "Untested - please verify and then remove this assert."); |
| 3269 emitFixup(this->createFixup(Traits::FK_PcRel, label)); | |
| 3268 emitInt32(-4); | 3270 emitInt32(-4); |
| 3269 } | 3271 } |
| 3270 | 3272 |
| 3271 template <class Machine> void AssemblerX86Base<Machine>::mfence() { | 3273 template <class Machine> void AssemblerX86Base<Machine>::mfence() { |
| 3272 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3274 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3273 emitUint8(0x0F); | 3275 emitUint8(0x0F); |
| 3274 emitUint8(0xAE); | 3276 emitUint8(0xAE); |
| 3275 emitUint8(0xF0); | 3277 emitUint8(0xF0); |
| 3276 } | 3278 } |
| 3277 | 3279 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3589 (void)shifter; | 3591 (void)shifter; |
| 3590 if (Ty == IceType_i16) | 3592 if (Ty == IceType_i16) |
| 3591 emitOperandSizeOverride(); | 3593 emitOperandSizeOverride(); |
| 3592 emitRexB(Ty, operand.rm()); | 3594 emitRexB(Ty, operand.rm()); |
| 3593 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); | 3595 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); |
| 3594 emitOperand(rm, operand); | 3596 emitOperand(rm, operand); |
| 3595 } | 3597 } |
| 3596 | 3598 |
| 3597 } // end of namespace X86Internal | 3599 } // end of namespace X86Internal |
| 3598 } // end of namespace Ice | 3600 } // end of namespace Ice |
| OLD | NEW |