LLVM disassembler can generate comments for disassembled instructions. The patch enables printing these comments for llvm-objdump -d.
I've done that mostly as a preparation for D104701. I hope that we gradually can provide more useful information in the comments. For example, I plan to annotate some PC-relative constants, similar to what GNU's objdump does; note that they print such comments without additional options. If someone finds the comments unhelpful, we can add an option to disable them, but I believe it's an unlikely case.
For lsl #12 it is useful to display 8192.
But for add z31.d, z31.d, #65280, 0xff00 may be less useful. GNU objdump displays many such immediates in hexadecimal, if I switch it to hexadecimal, then it should be clear the comment will not be needed.
LGTM, with one suggestion and one question. It looks to me like @MaskRay's comment is somewhat unrelated to this patch?
"Stuff" sounds a little unprofessional, although I am struggling to come up with a good alternative!
I'm not really up-to-speed on a lot of the MC stuff, but is there a need to do this?
I guess that a person who added generating the comments, @sdesmalen, found them useful for whatever reason. For my personal taste, it is better to have more comments than fewer. They can always be easily ignored if you do not need them.
Thanks for the suggestion!
CommentStream is local to the function while IP is external, thus the provided reference should be removed. We could set the comment stream somewhere at the top of the function, where it is created, and remove it at the end, but the function is very long and these phases would be too far away from each other. Such code would be a bit fragile to my taste and could be broken unintentionally during development.
There is a nop instruction in X86/disassemble-print-comments.s. There are also lots of existing tests with no-comment instructions. If that is not sufficient, what do you suggest exactly?
I'll append a nop to ELF/AArch64/disassemble-align.s and add a --match-full-lines switch to FileCheck in X86/disassemble-align.s. Do you think that is sufficient?