Chromium Code Reviews| Index: src/IceAssemblerX86Base.h |
| diff --git a/src/IceAssemblerX86Base.h b/src/IceAssemblerX86Base.h |
| index b064365c262a90f9499cb10ac7be4a218b193aa5..49c8ea02e5fa5d606c2275289f7b54fa64d572a0 100644 |
| --- a/src/IceAssemblerX86Base.h |
| +++ b/src/IceAssemblerX86Base.h |
| @@ -918,6 +918,16 @@ private: |
| Label *getOrCreateLabel(SizeT Number, LabelVector &Labels); |
| + template <typename T = Traits> |
|
Jim Stichnoth
2015/12/20 19:27:37
Could you do something like this instead?
void em
John
2015/12/21 13:41:31
Done.
|
| + typename std::enable_if<T::Is64Bit, void>::type emitAddrSizeOverridePrefix() { |
| + static constexpr uint8_t AddrSizeOverridePrefix = 0x67; |
| + emitUint8(AddrSizeOverridePrefix); |
| + } |
| + |
| + template <typename T = Traits> |
| + typename std::enable_if<!T::Is64Bit, void>::type |
| + emitAddrSizeOverridePrefix() {} |
| + |
| // The arith_int() methods factor out the commonality between the encodings |
| // of add(), Or(), adc(), sbb(), And(), sub(), Xor(), and cmp(). The Tag |
| // parameter is statically asserted to be less than 8. |
| @@ -965,8 +975,13 @@ private: |
| std::is_same<typename std::decay<RegType>::type, |
| typename Traits::GPRRegister>::value; |
| + // At this point in the assembler, we have encoded regs, so it is not |
| + // possible to distinguish between the the "new" low byte registers |
|
Jim Stichnoth
2015/12/20 19:27:37
the the
John
2015/12/21 13:41:31
Done.
|
| + // introduced in x86-64 and the legacy [abcd]h registers. Because x86, |
| + // we may still see ah (div) in the assembler, so we whitelist it here. |
| + static uint32_t Encoded_ah = 0x04; |
|
Jim Stichnoth
2015/12/20 19:27:37
constexpr
John
2015/12/21 13:41:31
Done.
|
| return IsGPR && (Reg & 0x04) != 0 && (Reg & 0x08) == 0 && |
| - isByteSizedType(Ty); |
| + isByteSizedType(Ty) && (Reg != Encoded_ah); |
|
Jim Stichnoth
2015/12/20 19:27:37
Could you use something like Traits::RegisterSet::
John
2015/12/21 13:41:31
Sure. I still needed the local Encoded_ah (which I
|
| } |
| // assembleAndEmitRex is used for determining which (if any) rex prefix |