OSDN Git Service

Fixes disassembler crashes on 2013 Haswell RTM instructions.
authorKevin Enderby <enderby@apple.com>
Mon, 11 Mar 2013 21:17:13 +0000 (21:17 +0000)
committerKevin Enderby <enderby@apple.com>
Mon, 11 Mar 2013 21:17:13 +0000 (21:17 +0000)
rdar://13318048

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176828 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrTSX.td
test/MC/Disassembler/X86/x86-64.txt
utils/TableGen/X86RecognizableInstr.cpp

index ad55058..a37a8cc 100644 (file)
@@ -22,7 +22,7 @@ def XBEGIN : I<0, Pseudo, (outs GR32:$dst), (ins),
 
 let isBranch = 1, isTerminator = 1, Defs = [EAX] in
 def XBEGIN_4 : Ii32PCRel<0xc7, MRM_F8, (outs), (ins brtarget:$dst),
-                         "xbegin\t$dst", []>;
+                         "xbegin\t$dst", []>, Requires<[HasRTM]>;
 
 def XEND : I<0x01, MRM_D5, (outs), (ins),
              "xend", [(int_x86_xend)]>, TB, Requires<[HasRTM]>;
index 1345741..5de1d59 100644 (file)
 
 # CHECK: adoxq (%rax), %rax
 0xf3 0x48 0x0f 0x38 0xf6 0x00
+
+# CHECK: xbegin        53
+0xc7 0xf8 0x35 0x00 0x00 0x00
+
+# CHECK: xend
+0x0f 0x01 0xd5
+
+# CHECK: xabort $13
+0xc6 0xf8 0x0d
index b00f7ea..8471faa 100644 (file)
@@ -764,6 +764,17 @@ void RecognizableInstr::emitInstructionSpecifier(DisassemblerTables &tables) {
     HANDLE_OPERAND(immediate)
     HANDLE_OPERAND(immediate)
     break;
+  case X86Local::MRM_F8:
+    if (Opcode == 0xc6) {
+      assert(numPhysicalOperands == 1 &&
+             "Unexpected number of operands for X86Local::MRM_F8");
+      HANDLE_OPERAND(immediate)
+    } else if (Opcode == 0xc7) {
+      assert(numPhysicalOperands == 1 &&
+             "Unexpected number of operands for X86Local::MRM_F8");
+      HANDLE_OPERAND(relocation)
+    }
+    break;
   case X86Local::MRMInitReg:
     // Ignored.
     break;