<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Dear mailing list:</div><div><br></div><div>the attached diff implements a table-driven disassembler for the X86 architecture (16-, 32-, and 64-bit incarnations), integrated into the MC framework. The disassembler is table-driven, using a custom TableGen backend to generate hierarchical tables optimized for fast decode. The disassembler consumes MemoryObjects and produces arrays of MCInsts, adhering to the abstract base class MCDisassembler (llvm/MC/MCDisassembler.h).</div><div><br></div><div>The disassembler is documented in detail in</div><div>–</div><div>- lib/Target/X86/X86Disassembler.h (disassembler runtime)</div><div>- utils/TableGen/X86DisassemblerEmitter.h (table emitter)</div><div>–</div><div>as well as in the individual files, functions, and classes.</div><div><br></div><div>I implemented a use case in tools/llvm-mc/HexDisassembler.cpp, which implements an interactive disassembler for sequences of bytes entered in hex on standard input. Example output:</div><div style="font-size: 11px; ">–</div><div><div>localhost:llvm spyffe$ ./Debug/bin/llvm-mc -disassemble</div><div>74 22 <-- user input</div><div>…</div><div>1 instructions:</div><div>74 22 <span class="Apple-tab-span" style="white-space:pre"> </span>je<span class="Apple-tab-span" style="white-space:pre"> </span>34</div></div><div>–</div><div>The disassembler is currently fully implemented, and testing is ongoing. I still need to handle LEA correctly, and of course the instruction tables (lib/Target/X86/X86InstrInfo.td and friends) always need expanding. However, because this is a non-invasive patch implementing largely independent functionality but its size makes maintaining it outside LLVM is a heavy burden, I am submitting it for consideration now.</div><div><br></div><div>The patch is tested against SVN revision 79306. Please let me know if there are any problems, and tell me what I can fix to make this worthy of inclusion. Thanks for your time.</div><div><br></div><div>Sincerely,</div><div>Sean Callanan</div><div><br></div></body></html>