Adding comments to 'MachineInstruction'

We’ll be doing something similar for our OpenVMS port. Right now I’m using “AsmStreamer->GetCommentOS()” and writing to the stream at the assembler level but that gets aligned on a right-side column (the column is hardcoded) and you have to be in verbose mode. So if you come up with something or have a quick design, post it so perhaps we can leverage each other’s work. Our prior code generator provided an “annotations” package that would let such comments strings get emitted either as stand-along lines in the machine output or as part of some “end of line” comments.


Hi John,

Actually, I haven’t tried to resolve this. My original question was apreamble to deciding whether or not I needed to devise a solution, but I have not yet started on a solution. My feeling is that it would be useful to add an MI annotation for such comments, and perhaps introduce something to TableGen analogous to ‘${:comment}’ like:


that could allow the TD patterns to provide a comment independent of the BuildMI interface, with the BuildMI interface taking precedence. The 'GetCommentOS' interface is too crude for what I want, and also does not allow me to attach comments when I am building an MI tree.

If I do implement something, I would be quite happy to share it.