Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: src/IceAssemblerX86Base.h

Issue 1537703002: Subzero. x8664. Resurrects the Target. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pydir/targets.py ('k') | src/IceAssemblerX86BaseImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceAssemblerX86Base.h
diff --git a/src/IceAssemblerX86Base.h b/src/IceAssemblerX86Base.h
index b064365c262a90f9499cb10ac7be4a218b193aa5..5f0f8c7604a1c909cc1d94c1cf456117ce612143 100644
--- a/src/IceAssemblerX86Base.h
+++ b/src/IceAssemblerX86Base.h
@@ -918,6 +918,18 @@ private:
Label *getOrCreateLabel(SizeT Number, LabelVector &Labels);
+ void emitAddrSizeOverridePrefix() {
+ if (!Traits::Is64Bit) {
+ return;
+ }
+ static constexpr uint8_t AddrSizeOverridePrefix = 0x67;
+ emitUint8(AddrSizeOverridePrefix);
+ }
+
+ template <typename T = Traits>
+ typename std::enable_if<!T::Is64Bit, void>::type
Jim Stichnoth 2015/12/21 15:48:47 remove this
+ 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 +977,17 @@ 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 "new" low byte registers 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.
+ //
+ // The "local" uint32_t Encoded_Reg_ah is needed because RegType is an enum
+ // that is not necessarily the same type of
+ // Traits::RegisterSet::Encoded_Reg_ah.
+ constexpr uint32_t Encoded_Reg_ah = Traits::RegisterSet::Encoded_Reg_ah;
return IsGPR && (Reg & 0x04) != 0 && (Reg & 0x08) == 0 &&
- isByteSizedType(Ty);
+ isByteSizedType(Ty) && (Reg != Encoded_Reg_ah);
}
// assembleAndEmitRex is used for determining which (if any) rex prefix
« no previous file with comments | « pydir/targets.py ('k') | src/IceAssemblerX86BaseImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698