<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:"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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Book Antiqua",serif;
        color:windowtext;}
span.EmailStyle19
        {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:#943634;mso-fareast-language:EN-US'>Found it.  An idiot mistake in my ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>LowerCall</span><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>’ implementation where I had a cut’n’paste argument error to ‘</span><span style='font-family:"Courier New";color:black;mso-fareast-language:EN-US'>getCALLSEQ_END</span><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>’ that has been wrong for a very long time, but this change has exposed it.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;mso-fareast-language:EN-US'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;color:#943634;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'> llvm-dev [mailto:llvm-dev-bounces@lists.llvm.org] <b>On Behalf Of </b>ORiordan, Martin via llvm-dev<br><b>Sent:</b> 19 September 2017 13:37<br><b>To:</b> Serge Pavlov <sepavloff@gmail.com>; llvm-dev <llvm-dev@lists.llvm.org><br><b>Subject:</b> Re: [llvm-dev] Changes to 'ADJCALLSTACK*' and 'callseq_*' between LLVM v4.0 and v5.0<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>Hi Serge,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>Thanks for your help.  I have looked at the change log, and so far as I can tell, my implementation is pretty much identical to all of the in-tree targets, but I’m missing something and can’t see what it is.  I have simplified my TD description to just:<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>def MyCallseqStart : SDNode<"ISD::CALLSEQ_START",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                            SDCallSeqStart<[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                            [SDNPHasChain, SDNPOutGlue]>;<br>def MyCallseqEnd : SDNode<"ISD::CALLSEQ_END",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                          SDCallSeqEnd<[SDTCisVT<0, i32>, SDTCisVT<1, i32>]>,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                          [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue]>;<br><br>def my_call : SDNode<"MyISD::CALL",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                     SDTypeProfile<0, -1, [SDTCisPtrTy<0>]>,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                     [SDNPHasChain, SDNPOptInGlue, SDNPOutGlue, SDNPVariadic]>;<br>def my_ret : SDNode<"MyISD::RET_FLAG",<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                    SDTNone,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>                    [SDNPHasChain, SDNPOptInGlue, SDNPVariadic]>;<br><br>let hasCtrlDep = 1,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>    hasSideEffects = 1,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>    isCodeGenOnly = 1,<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>    Defs = [SP],<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>    Uses = [SP] in {<br>  def ADJCALLSTACKDOWN : Pseudo<(outs),<br>                                (ins i32imm:$amt1, i32imm:$amt2),<br>                                [(MyCallseqStart timm:$amt1, timm:$amt2)]>;<br>  def ADJCALLSTACKUP   : Pseudo<(outs),<br>                                (ins i32imm:$amt1, i32imm:$amt2),<br>                                [(MyCallseqEnd timm:$amt1, timm:$amt2)]>;<br>}<br><br>def Custom_CALL      : Pseudo<(outs),<br>                              (ins IRF32:$target, variable_ops),<br>                              [(my_call IRF32:$target)]> {<br>  let isCall = 1;<br>  let usesCustomInserter = 1;<br>}<br><br>def Custom_RETURN    : Pseudo<(outs),<br>                              (ins variable_ops),<br>                              [(my_ret)]> {<br>  let isReturn = 1;<br>  let usesCustomInserter = 1;<br>}</span><span style='font-family:"Courier New";mso-fareast-language:EN-US'><o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>but when I compile the following C code:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>int foo(int);<br>int bar() { return foo(42); }<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>it crashes with the following dump:<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-family:"Courier New"'>fatal error: error in backend: Cannot select: 0x1ede6ae3648: ch,glue = callseq_end 0x1ede6ae35e0, TargetConstant:i32<0>, TargetGlobalAddress:i32<i32 (i32)* @foo> 0, 0x1ede6ae35e0:1<br>  0x1ede6ae33d8: i32 = TargetConstant<0><br>  0x1ede6ae3370: i32 = TargetGlobalAddress<i32 (i32)* @foo> 0<br>  0x1ede6ae35e0: ch,glue = MyISD::CALL 0x1ede6ae3510, TargetGlobalAddress:i32<i32 (i32)* @foo> 0, Register:i32 %I18, RegisterMask:Untyped, 0x1ede6ae3510:1<br>    0x1ede6ae3370: i32 = TargetGlobalAddress<i32 (i32)* @foo> 0<br>    0x1ede6ae34a8: i32 = Register %I18<br>    0x1ede6ae3578: Untyped = RegisterMask<br>    0x1ede6ae3510: ch,glue = CopyToReg 0x1ede6ae3440, Register:i32 %I18, Constant:i32<42><br>      0x1ede6ae34a8: i32 = Register %I18<br>      0x1ede6ae3308: i32 = Constant<42></span><span style='font-family:"Courier New";mso-fareast-language:EN-US'><o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>I have tried disabling the custom inserters just in case they were causing the problem but it crashes in the same way.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>Must admit, I’m stumped on this one.<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>All the best,<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'>            MartinO<o:p></o:p></span></p><p class=MsoNormal><span style='font-family:"Book Antiqua",serif;mso-fareast-language:EN-US'><o:p> </o:p></span></p><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'> llvm-dev [<a href="mailto:llvm-dev-bounces@lists.llvm.org">mailto:llvm-dev-bounces@lists.llvm.org</a>] <b>On Behalf Of </b>Serge Pavlov via llvm-dev<br><b>Sent:</b> Friday, September 15, 2017 5:40 PM<br><b>To:</b> Martin J. O'Riordan <<a href="mailto:MartinO@theheart.ie">MartinO@theheart.ie</a>><br><b>Cc:</b> LLVM Developers <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [llvm-dev] Changes to 'ADJCALLSTACK*' and 'callseq_*' between LLVM v4.0 and v5.0<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Hi Martin,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Pseudo CALLSEQ_START was changed in r302527, commit message contains details on the changes.<o:p></o:p></p></div><div><p class=MsoNormal>However CALLSEQ_END was not modified. If your made changes to  ADJCALLSTACKUP to add<o:p></o:p></p></div><div><p class=MsoNormal>additional argument, that may result in error.<o:p></o:p></p></div><div><p class=MsoNormal><br clear=all><o:p></o:p></p><div><div><p class=MsoNormal>Thanks,<br>--Serge<o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p></div></div><p>--------------------------------------------------------------<br>Intel Research and Development Ireland Limited<br>Registered in Ireland<br>Registered Office: Collinstown Industrial Park, Leixlip, County Kildare<br>Registered Number: 308263<o:p></o:p></p><p>This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.<o:p></o:p></p></div></body></html>