[PATCH] D13316: Visibly fail if attempting to encode register AH, BH, CH, DH in a REX-prefixed instruction.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 21:23:56 PDT 2015


craig.topper added inline comments.

================
Comment at: lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:1139
@@ -1130,3 +1138,3 @@
   if (is64BitMode(STI)) {
-    if (unsigned REX = DetermineREXPrefix(MI, TSFlags, Desc))
+    if (unsigned REX = DetermineREXPrefix(MI, TSFlags, Desc)) {
       EmitByte(0x40 | REX, CurByte, OS);
----------------
craig.topper wrote:
> I feel like you can just detect the error inside of DetermineREXPrefix rather than thread the EmittedREX everywhere. It examines every operand already to calculate the REX prefix bits. While examining every operand for REX can it also see if any are high registers and at the end if the REX is non-zero and any of the registers was a high register throw the error there?
In fact you could probably just detect it while that function looks for SPL, BPL, SIL, or DIL.


http://reviews.llvm.org/D13316





More information about the llvm-commits mailing list