[PATCH] D15150: Add support for "xlat m8"

Marina Yatsina via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 13 09:00:56 PST 2015


myatsina updated this revision to Diff 42667.
myatsina added a comment.

Added warning regarding the fact that these instructions use (R|E)BX instead of the specified memory operand


Repository:
  rL LLVM

http://reviews.llvm.org/D15150

Files:
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  test/MC/X86/intel-syntax.s

Index: lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -2382,6 +2382,17 @@
         }
   }
 
+  // Transforms "xlat mem8" into "xlatb"
+  if ((Name == "xlat" || Name == "xlatb") && Operands.size() == 2) {
+    X86Operand &Op1 = static_cast<X86Operand &>(*Operands[1]);
+    if (Op1.isMem8()) {
+      Warning(Op1.getStartLoc(), "memory operand is only for determining the "
+                                 "size, (R|E)BX will be used for the location");
+      Operands.pop_back();
+      static_cast<X86Operand &>(*Operands[0]).setTokenValue("xlatb");
+    }
+  }
+
   return false;
 }
 
Index: test/MC/X86/intel-syntax.s
===================================================================
--- test/MC/X86/intel-syntax.s
+++ test/MC/X86/intel-syntax.s
@@ -751,3 +751,7 @@
 
 sidt fword ptr [eax]
 // CHECK: sidtq (%eax)
+
+xlat byte ptr [eax]
+// CHECK: xlatb
+// CHECK-STDERR: memory operand is only for determining the size, (R|E)BX will be used for the location


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15150.42667.patch
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151213/5fcca404/attachment.bin>


More information about the llvm-commits mailing list