| 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 3088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3099 if (Ty == IceType_i16) | 3099 if (Ty == IceType_i16) |
| 3100 emitOperandSizeOverride(); | 3100 emitOperandSizeOverride(); |
| 3101 emitRex(Ty, addr, reg); | 3101 emitRex(Ty, addr, reg); |
| 3102 if (isByteSizedArithType(Ty)) | 3102 if (isByteSizedArithType(Ty)) |
| 3103 emitUint8(0x86); | 3103 emitUint8(0x86); |
| 3104 else | 3104 else |
| 3105 emitUint8(0x87); | 3105 emitUint8(0x87); |
| 3106 emitOperand(gprEncoding(reg), addr); | 3106 emitOperand(gprEncoding(reg), addr); |
| 3107 } | 3107 } |
| 3108 | 3108 |
| 3109 template <class Machine> void AssemblerX86Base<Machine>::iaca_start() { |
| 3110 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3111 emitUint8(0x0F); |
| 3112 emitUint8(0x0B); |
| 3113 |
| 3114 // mov $111, ebx |
| 3115 constexpr typename Traits::GPRRegister dst = |
| 3116 Traits::GPRRegister::Encoded_Reg_ebx; |
| 3117 constexpr Type Ty = IceType_i32; |
| 3118 emitRexB(Ty, dst); |
| 3119 emitUint8(0xB8 + gprEncoding(dst)); |
| 3120 emitImmediate(Ty, Immediate(111)); |
| 3121 |
| 3122 emitUint8(0x64); |
| 3123 emitUint8(0x67); |
| 3124 emitUint8(0x90); |
| 3125 } |
| 3126 |
| 3127 template <class Machine> void AssemblerX86Base<Machine>::iaca_end() { |
| 3128 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3129 |
| 3130 // mov $222, ebx |
| 3131 constexpr typename Traits::GPRRegister dst = |
| 3132 Traits::GPRRegister::Encoded_Reg_ebx; |
| 3133 constexpr Type Ty = IceType_i32; |
| 3134 emitRexB(Ty, dst); |
| 3135 emitUint8(0xB8 + gprEncoding(dst)); |
| 3136 emitImmediate(Ty, Immediate(222)); |
| 3137 |
| 3138 emitUint8(0x64); |
| 3139 emitUint8(0x67); |
| 3140 emitUint8(0x90); |
| 3141 |
| 3142 emitUint8(0x0F); |
| 3143 emitUint8(0x0B); |
| 3144 } |
| 3145 |
| 3109 template <class Machine> | 3146 template <class Machine> |
| 3110 void AssemblerX86Base<Machine>::emitSegmentOverride(uint8_t prefix) { | 3147 void AssemblerX86Base<Machine>::emitSegmentOverride(uint8_t prefix) { |
| 3111 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3148 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
| 3112 emitUint8(prefix); | 3149 emitUint8(prefix); |
| 3113 } | 3150 } |
| 3114 | 3151 |
| 3115 template <class Machine> | 3152 template <class Machine> |
| 3116 void AssemblerX86Base<Machine>::align(intptr_t alignment, intptr_t offset) { | 3153 void AssemblerX86Base<Machine>::align(intptr_t alignment, intptr_t offset) { |
| 3117 assert(llvm::isPowerOf2_32(alignment)); | 3154 assert(llvm::isPowerOf2_32(alignment)); |
| 3118 intptr_t pos = offset + Buffer.getPosition(); | 3155 intptr_t pos = offset + Buffer.getPosition(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 (void)shifter; | 3313 (void)shifter; |
| 3277 if (Ty == IceType_i16) | 3314 if (Ty == IceType_i16) |
| 3278 emitOperandSizeOverride(); | 3315 emitOperandSizeOverride(); |
| 3279 emitRexB(Ty, operand.rm()); | 3316 emitRexB(Ty, operand.rm()); |
| 3280 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); | 3317 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); |
| 3281 emitOperand(rm, operand); | 3318 emitOperand(rm, operand); |
| 3282 } | 3319 } |
| 3283 | 3320 |
| 3284 } // end of namespace X86Internal | 3321 } // end of namespace X86Internal |
| 3285 } // end of namespace Ice | 3322 } // end of namespace Ice |
| OLD | NEW |