[llvm-commits] [llvm] r152414 - in /llvm/trunk: lib/Target/X86/Disassembler/X86DisassemblerDecoder.c test/MC/Disassembler/X86/simple-tests.txt utils/TableGen/X86RecognizableInstr.cpp
Kevin Enderby
enderby at apple.com
Fri Mar 9 09:52:49 PST 2012
Author: enderby
Date: Fri Mar 9 11:52:49 2012
New Revision: 152414
URL: http://llvm.org/viewvc/llvm-project?rev=152414&view=rev
Log:
Fix the x86 disassembler to at least print the lock prefix if it is the first
prefix. Added a FIXME to remind us this still does not work when it is not the
first prefix.
Modified:
llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
llvm/trunk/test/MC/Disassembler/X86/simple-tests.txt
llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp
Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c?rev=152414&r1=152413&r2=152414&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c (original)
+++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.c Fri Mar 9 11:52:49 2012
@@ -312,6 +312,13 @@
if (consumeByte(insn, &byte))
return -1;
+
+ // If the the first byte is a LOCK prefix break and let it be disassembled
+ // as a lock "instruction", by creating an <MCInst #xxxx LOCK_PREFIX>.
+ // FIXME there is currently no way to get the disassembler to print the
+ // lock prefix if it is not the first byte.
+ if (insn->readerCursor - 1 == insn->startLocation && byte == 0xf0)
+ break;
switch (byte) {
case 0xf0: /* LOCK */
Modified: llvm/trunk/test/MC/Disassembler/X86/simple-tests.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/X86/simple-tests.txt?rev=152414&r1=152413&r2=152414&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/X86/simple-tests.txt (original)
+++ llvm/trunk/test/MC/Disassembler/X86/simple-tests.txt Fri Mar 9 11:52:49 2012
@@ -724,3 +724,8 @@
# CHECK: vpermil2ps $1, 4(%rax), %xmm2, %xmm3, %xmm0
0xc4 0xe3 0xe1 0x48 0x40 0x04 0x21
+
+# rdar://8812056 lldb doesn't print the x86 lock prefix when disassembling
+# CHECK: lock
+# CHECK: xaddq %rcx, %rbx
+0xf0 0x48 0x0f 0xc1 0xcb
Modified: llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp?rev=152414&r1=152413&r2=152414&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp (original)
+++ llvm/trunk/utils/TableGen/X86RecognizableInstr.cpp Fri Mar 9 11:52:49 2012
@@ -405,13 +405,13 @@
return FILTER_STRONG;
- // Filter out artificial instructions
+ // Filter out artificial instructions but leave in the LOCK_PREFIX so it is
+ // printed as a separate "instruction".
if (Name.find("_Int") != Name.npos ||
Name.find("Int_") != Name.npos ||
Name.find("_NOREX") != Name.npos ||
- Name.find("2SDL") != Name.npos ||
- Name == "LOCK_PREFIX")
+ Name.find("2SDL") != Name.npos)
return FILTER_STRONG;
// Filter out instructions with segment override prefixes.
More information about the llvm-commits
mailing list