[llvm-dev] llvm-objdump: syntax highlighting based on rich disassembly

Seiya Nuta via llvm-dev llvm-dev at lists.llvm.org
Mon Jul 8 01:20:23 PDT 2019


Hi all,

I'm going to implement syntax highlighting in llvm-objdump based on
Rich Disassembly[1] and I'd like to hear your comments on how should I
implement it. Now I have two ideas to implement the feature:

(a) Make MCInstPrinter return a well-typed value and traverse it in
llvm-objdump to highlight the disassembly.
(b) Parse the rich disassembly output string in the llvm-objdump and
highlight the disassembly.

Making MCInstPrinter return the "well-typed" marked-up value just like
abstract syntax tree instead of writing an annotated string into a
raw_ostream sounds more preferable way to me. However, it would
involve large changes to the existing MCInstPrinter implementations.

In contrast, parsing the rich disassembly output in llvm-objdump
sounds a bit awkward, but we don't need to change the MCInstPrinter at
all. That said, parsing the text surely degrades the disassemble
performance so we should disable the parsing and highlighting by
default. I wrote and uploaded a prototype of this [2].

Do you have any thoughts?

Thanks,
Seiya

[1] https://llvm.org/docs/MarkedUpDisassembly.html
[2] https://reviews.llvm.org/D64311


More information about the llvm-dev mailing list