<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Helvetica;
        panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua",serif;
        color:#943634;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-IE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>Thanks Matthias,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>All the best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:black;mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'>From:</span></b><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri",sans-serif'> mbraun@apple.com [mailto:mbraun@apple.com] <br><b>Sent:</b> 05 February 2018 17:08<br><b>To:</b> Martin J. O'Riordan <MartinO@theheart.ie><br><b>Cc:</b> LLVM Developers <llvm-dev@lists.llvm.org><br><b>Subject:</b> Re: [llvm-dev] Adding comments to 'MachineInstruction'<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>- Matthias<o:p></o:p></p><div><p class=MsoNormal><br><br><o:p></o:p></p><blockquote style='margin-top:5.0pt;margin-bottom:5.0pt'><div><p class=MsoNormal>On Feb 3, 2018, at 4:40 AM, Martin J. O'Riordan via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'>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 ‘</span><span style='font-family:"Courier New"'>-S -fverbose-asm</span><span style='font-family:"Book Antiqua",serif'>’.  There is a large set of ‘</span><span style='font-family:"Courier New"'>add*</span><span style='font-family:"Book Antiqua",serif'>’ functions to attach additional information to the MI, but I don’t see one for adding comments.</span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'> </span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'>Is there a method I can call to attach an arbitrary string (‘</span><span style='font-family:"Courier New"'>StringRef</span><span style='font-family:"Book Antiqua",serif'>’, ‘</span><span style='font-family:"Courier New"'>const char*</span><span style='font-family:"Book Antiqua",serif'>’, ‘</span><span style='font-family:"Courier New"'>Twine</span><span style='font-family:"Book Antiqua",serif'>’) to an MI with ‘</span><span style='font-family:"Courier New"'>BuildMI</span><span style='font-family:"Book Antiqua",serif'>’ or after?</span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'> </span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'>Thanks,</span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'> </span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'>            MartinO</span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-family:"Book Antiqua",serif'> </span><span style='font-size:11.0pt;font-family:"Calibri",sans-serif'><o:p></o:p></span></p></div><p class=MsoNormal><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'>_______________________________________________<br>LLVM Developers mailing list<br></span><a href="mailto:llvm-dev@lists.llvm.org"><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif;color:#954F72'>llvm-dev@lists.llvm.org</span></a><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif'><br></span><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"><span style='font-size:9.0pt;font-family:"Helvetica",sans-serif;color:#954F72'>http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</span></a><o:p></o:p></p></div></blockquote></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>