Seiya Nuta via llvm-dev
2019-Jul-08 08:20 UTC
[llvm-dev] llvm-objdump: syntax highlighting based on rich disassembly
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
Michael Spencer via llvm-dev
2019-Jul-09 23:59 UTC
[llvm-dev] llvm-objdump: syntax highlighting based on rich disassembly
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>
Seiya Nuta via llvm-dev
2019-Jul-24 07:20 UTC
[llvm-dev] llvm-objdump: syntax highlighting based on rich disassembly
Hi all, I've uploaded the series of patches for this feature (you can see some screenshots on the Phabricator): https://reviews.llvm.org/D65191 On Mon, Jul 8, 2019 at 5:20 PM Seiya Nuta <nuta at seiya.me> 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