[llvm-dev] Adding comments to 'MachineInstruction'

John Reagan via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 14 09:28:02 PST 2018


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.

John


On 2/5/18 3:00 PM, via llvm-dev wrote:
> Message: 6
> Date: Mon, 5 Feb 2018 19:31:58 -0000
> From: "Martin J. O'Riordan via llvm-dev" <llvm-dev at lists.llvm.org>
> To: <mbraun at apple.com>
> Cc: 'LLVM Developers' <llvm-dev at lists.llvm.org>
> Subject: Re: [llvm-dev] Adding comments to 'MachineInstruction'
> Message-ID: <006701d39eb7$fda8ac90$f8fa05b0$@theheart.ie>
> Content-Type: text/plain; charset="utf-8"
>
> Thanks Matthias,
>
>  
>
> It looks like the comments that do exist are emitted are pre-cooked and depend on some other attribute of the MI or the context of the MI.  Curiously enough, a couple of years ago I had thought about this, but I wanted to have different comments used for instructions selected by the TableGen pattern matcher versus those crafted directly in the C++ code which would be very useful when debugging obscure code-generation issues.
>
>  
>
> All the best,
>
>  
>
>             MartinO
>
>  
>
> From: mbraun at apple.com [mailto:mbraun at apple.com] 
> Sent: 05 February 2018 17:08
> To: Martin J. O'Riordan <MartinO at theheart.ie>
> Cc: LLVM Developers <llvm-dev at lists.llvm.org>
> Subject: Re: [llvm-dev] Adding comments to 'MachineInstruction'
>
>  
>
> There is no generic mechanism as far as I know. You can look at AsmPrinter.cpp/emitComments() to see what situations trigger comments at the moment.
>
>  
>
> - Matthias
>
>
>
>
>
> On Feb 3, 2018, at 4:40 AM, Martin J. O'Riordan via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > wrote:
>
>  
>
> When I am constructing sequences of instructions during custom lowering, I would like to be able to also add a comment that appears in the generated assembly with ‘-S -fverbose-asm’.  There is a large set of ‘add*’ functions to attach additional information to the MI, but I don’t see one for adding comments.
>
>  
>
> Is there a method I can call to attach an arbitrary string (‘StringRef’, ‘const char*’, ‘Twine’) to an MI with ‘BuildMI’ or after?
>
>  
>
> Thanks,
>
>  
>
>             MartinO
>
>  
>
> _______________________________________________
> LLVM Developers mailing list
>  <mailto:llvm-dev at lists.llvm.org> llvm-dev at lists.llvm.org
>  <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180214/519def50/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180214/519def50/attachment.sig>


More information about the llvm-dev mailing list