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

Michael Spencer via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 9 16:59:58 PDT 2019


On Mon, Jul 8, 2019 at 1:20 AM Seiya Nuta via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> 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
>
>
I really dislike the idea of having llvm-objdump do any assembly parsing.

Another solution would be to have MCInstPrinter also be able to store
(range, semantic) pairs that can then be used to insert highlighting.

- Michael Spencer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190709/ec0a8619/attachment.html>


More information about the llvm-dev mailing list