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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 emitRex(RexTypeIrrelevant, address, RexRegIrrelevant); | 120 emitRex(RexTypeIrrelevant, address, RexRegIrrelevant); |
121 emitUint8(0xFF); | 121 emitUint8(0xFF); |
122 emitOperand(2, address); | 122 emitOperand(2, address); |
123 } | 123 } |
124 | 124 |
125 template <typename TraitsType> | 125 template <typename TraitsType> |
126 void AssemblerX86Base<TraitsType>::call(const ConstantRelocatable *label) { | 126 void AssemblerX86Base<TraitsType>::call(const ConstantRelocatable *label) { |
127 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 127 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
128 intptr_t call_start = Buffer.getPosition(); | 128 intptr_t call_start = Buffer.getPosition(); |
129 emitUint8(0xE8); | 129 emitUint8(0xE8); |
130 emitFixup(this->createFixup(Traits::PcRelFixup, label)); | 130 emitFixup(this->createFixup(Traits::FK_PcRel, label)); |
131 emitInt32(-4); | 131 emitInt32(-4); |
132 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); | 132 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); |
133 (void)call_start; | 133 (void)call_start; |
134 } | 134 } |
135 | 135 |
136 template <typename TraitsType> | 136 template <typename TraitsType> |
137 void AssemblerX86Base<TraitsType>::call(const Immediate &abs_address) { | 137 void AssemblerX86Base<TraitsType>::call(const Immediate &abs_address) { |
138 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 138 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
139 intptr_t call_start = Buffer.getPosition(); | 139 intptr_t call_start = Buffer.getPosition(); |
140 emitUint8(0xE8); | 140 emitUint8(0xE8); |
141 emitFixup(this->createFixup(Traits::PcRelFixup, AssemblerFixup::NullSymbol)); | 141 emitFixup(this->createFixup(Traits::FK_PcRel, AssemblerFixup::NullSymbol)); |
142 emitInt32(abs_address.value() - 4); | 142 emitInt32(abs_address.value() - 4); |
143 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); | 143 assert((Buffer.getPosition() - call_start) == kCallExternalLabelSize); |
144 (void)call_start; | 144 (void)call_start; |
145 } | 145 } |
146 | 146 |
147 template <typename TraitsType> | 147 template <typename TraitsType> |
148 void AssemblerX86Base<TraitsType>::pushl(GPRRegister reg) { | 148 void AssemblerX86Base<TraitsType>::pushl(GPRRegister reg) { |
149 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 149 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
150 emitRexB(RexTypeIrrelevant, reg); | 150 emitRexB(RexTypeIrrelevant, reg); |
151 emitUint8(0x50 + gprEncoding(reg)); | 151 emitUint8(0x50 + gprEncoding(reg)); |
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3091 } else { | 3091 } else { |
3092 emitUint8(0x0F); | 3092 emitUint8(0x0F); |
3093 emitUint8(0x80 + condition); | 3093 emitUint8(0x80 + condition); |
3094 emitLabelLink(label); | 3094 emitLabelLink(label); |
3095 } | 3095 } |
3096 } | 3096 } |
3097 | 3097 |
3098 template <typename TraitsType> | 3098 template <typename TraitsType> |
3099 void AssemblerX86Base<TraitsType>::j(BrCond condition, | 3099 void AssemblerX86Base<TraitsType>::j(BrCond condition, |
3100 const ConstantRelocatable *label) { | 3100 const ConstantRelocatable *label) { |
| 3101 llvm::report_fatal_error("Untested - please verify and then reenable."); |
3101 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3102 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
3102 emitUint8(0x0F); | 3103 emitUint8(0x0F); |
3103 emitUint8(0x80 + condition); | 3104 emitUint8(0x80 + condition); |
3104 emitFixup(this->createFixup(Traits::PcRelFixup, label)); | 3105 emitFixup(this->createFixup(Traits::FK_PcRel, label)); |
3105 emitInt32(-4); | 3106 emitInt32(-4); |
3106 } | 3107 } |
3107 | 3108 |
3108 template <typename TraitsType> | 3109 template <typename TraitsType> |
3109 void AssemblerX86Base<TraitsType>::jmp(GPRRegister reg) { | 3110 void AssemblerX86Base<TraitsType>::jmp(GPRRegister reg) { |
3110 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3111 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
3111 emitRexB(RexTypeIrrelevant, reg); | 3112 emitRexB(RexTypeIrrelevant, reg); |
3112 emitUint8(0xFF); | 3113 emitUint8(0xFF); |
3113 emitRegisterOperand(4, gprEncoding(reg)); | 3114 emitRegisterOperand(4, gprEncoding(reg)); |
3114 } | 3115 } |
(...skipping 17 matching lines...) Expand all Loading... |
3132 emitUint8(0xEB); | 3133 emitUint8(0xEB); |
3133 emitNearLabelLink(label); | 3134 emitNearLabelLink(label); |
3134 } else { | 3135 } else { |
3135 emitUint8(0xE9); | 3136 emitUint8(0xE9); |
3136 emitLabelLink(label); | 3137 emitLabelLink(label); |
3137 } | 3138 } |
3138 } | 3139 } |
3139 | 3140 |
3140 template <typename TraitsType> | 3141 template <typename TraitsType> |
3141 void AssemblerX86Base<TraitsType>::jmp(const ConstantRelocatable *label) { | 3142 void AssemblerX86Base<TraitsType>::jmp(const ConstantRelocatable *label) { |
| 3143 llvm::report_fatal_error("Untested - please verify and then reenable."); |
3142 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3144 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
3143 emitUint8(0xE9); | 3145 emitUint8(0xE9); |
3144 emitFixup(this->createFixup(Traits::PcRelFixup, label)); | 3146 emitFixup(this->createFixup(Traits::FK_PcRel, label)); |
3145 emitInt32(-4); | 3147 emitInt32(-4); |
3146 } | 3148 } |
3147 | 3149 |
3148 template <typename TraitsType> void AssemblerX86Base<TraitsType>::mfence() { | 3150 template <typename TraitsType> void AssemblerX86Base<TraitsType>::mfence() { |
3149 AssemblerBuffer::EnsureCapacity ensured(&Buffer); | 3151 AssemblerBuffer::EnsureCapacity ensured(&Buffer); |
3150 emitUint8(0x0F); | 3152 emitUint8(0x0F); |
3151 emitUint8(0xAE); | 3153 emitUint8(0xAE); |
3152 emitUint8(0xF0); | 3154 emitUint8(0xF0); |
3153 } | 3155 } |
3154 | 3156 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3460 (void)shifter; | 3462 (void)shifter; |
3461 if (Ty == IceType_i16) | 3463 if (Ty == IceType_i16) |
3462 emitOperandSizeOverride(); | 3464 emitOperandSizeOverride(); |
3463 emitRexB(Ty, operand.rm()); | 3465 emitRexB(Ty, operand.rm()); |
3464 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); | 3466 emitUint8(isByteSizedArithType(Ty) ? 0xD2 : 0xD3); |
3465 emitOperand(rm, operand); | 3467 emitOperand(rm, operand); |
3466 } | 3468 } |
3467 | 3469 |
3468 } // end of namespace X86NAMESPACE | 3470 } // end of namespace X86NAMESPACE |
3469 } // end of namespace Ice | 3471 } // end of namespace Ice |
OLD | NEW |