Make the disassembler understand instruction prefixes.
authorLutz Euler <lutz.euler@freenet.de>
Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)
committerLutz Euler <lutz.euler@freenet.de>
Wed, 14 Dec 2011 17:11:53 +0000 (18:11 +0100)
commiteb53f2bf913aa34aee83b35eb2b709a2e0d40366
treeecc6e3fb6800acce169d85df59db53dd7ae48fce
parentd7e55b414d180341d79e0eddc957e1aa52551c38
Make the disassembler understand instruction prefixes.

Instructions having NIL as their printer are treated as prefixes,
meaning that they are printed on the same line as the following
instruction. If an instruction's PRINT-NAME is NIL, too, this prefix
is not printed (but prefilters etc. are run). Any number of prefix
instructions can occur in immediate succession before a non-prefix
instruction.

This commit only provides the infrastructure; its impact is currently
limited as there aren't any instructions having NIL as their printer.

The motivation for this change comes from x86[-64]: One goal is to make
instructions using prefixes like LOCK and REP print nicer, the other
to reduce the combinatorial explosion of instruction formats in the
disassembler that is currently needed to deal with the possible
combinations of the REX and the operand size override (#x66) prefixes
and that would become unbearable once the aforementioned and the segment
override prefixes are added.

Extend the existing beginnings of support for prefix instructions in
MAP-SEGMENT-INSTRUCTIONS to collect prefix names and to print them at
the right time, which is at the next non-prefix instruction, when a
non-decodable instruction is encountered or at the end of the segment.
Change the semantics of DSTATE-INST-PROPERTIES: This list is now emptied
only after a non-prefix instruction has been processed.

Abstract out the filling of the column containing the instruction bytes
into the new function PAD-INST-COLUMN and use it in several places.

Clean up whitespace and improve line breaks.
src/compiler/disassem.lisp
src/compiler/target-disassem.lisp