<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=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@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:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Book Antiqua",serif;
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1926837539;
        mso-list-type:hybrid;
        mso-list-template-ids:1516281460 403243009 403243011 403243013 403243009 403243011 403243013 403243009 403243011 403243013;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>While investigating a new bug in some code using our LLVM v3.9.0 derived compiler, it turns out that it now emits ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.p2align</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ unconditionally if the alignment value is a power of 2.  Previously this was dependent on ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MAI->getAlignmentIsInBytes()</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>We don’t support non-power-of 2 alignment anyway, but our assembler does not support ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.p2align</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ and there appears to be no way of changing this in a target configurable way.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>There have been emails about the fact that the ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ implementation is hidden, and the argument is that if the target needs something different it can implement its own specialisation of ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCStreamer</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’.  While this is technically true, but ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ already does more than 90% of what I need, and to implement my own specialisation really means cloning ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’, and editing those few places where my assembly requirements are different to it.  And then the target that does this clone is required to carefully track future revisions of ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ to ensure that their clone is still a clone.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>Generally it is good practice to reuse existing code, and specialise only for the differences, so it really make a lot more sense to publish it in a header, and allow the target to sub-class it with overrides for each of the methods it wants to handle differently.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>As it is, I have had to add yet another tweak to this code, all of which are relatively trivial:<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:12.0pt;font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer::EmitAssignment</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ changed to implement aliases as ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.alias symA symB</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ instead of ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>symA - symB</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:12.0pt;font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer::EmitBytes</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ to break long ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.byte</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ sequences into multiple ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.byte</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ sequences on multiple lines (actually, I could retire this change as our assembler now handles the long sequences)<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:12.0pt;font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer::EmitFill</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ because we need an additional argument in the directive<o:p></o:p></span></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span style='font-size:12.0pt;font-family:Symbol'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer::EmitValueToAlignment</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ to use ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.align</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ instead of ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>.p2align</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>These are such small changes that it really does not warrant me cloning 1,600 lines of code so that I can tweak 8 of them, and being able to sub-class the otherwise very useful ‘</span><span style='font-size:12.0pt;font-family:"Courier New"'>MCAsmStreamer</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>’ class would greatly simplify adapting LLVM for non-</span><span style='font-size:12.0pt;font-family:"Courier New"'>gas</span><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'> compliant assemblers.  It seems to me that splitting this file into a source and a header is not going to create maintenance problems for LLVM, while at the same time it would greatly simplify the implementation of compilers for non-mainstream assemblers.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Book Antiqua",serif'><o:p> </o:p></span></p></div></body></html>