<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=iso-8859-1">
<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;}
/* 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;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        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;}
--></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="SV" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">I am in the process of porting our target to GlobalISel, and have encountered a problem. Nearly all instructions in our instruction set make modifications to a CC register, and hence are defined as follows:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">let ..., Defs = [CCReg] in<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-family:"Courier New"">def shfts_a32_imm7: Instruction<(outs OurRC:$dst), ...>;</span><span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">What’s more, many of these instructions have patterns where the instruction itself appears
 inside a nested tree, e.g.:<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">def Pat<(source pattern ...),<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">        (sext_a32 (INSERT_SUBREG (...), (shfts_a32_imm7 OurRC:$src, Imm7:$imm), ...>;<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">Now to the problem: When TableGen processes the instruction above, it includes the
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">CCReg</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"> in the
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">Defs</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"> field along with
 the registers appearing in </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">outs</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">,
 thereby indicating that shfts_a32_imm7 produces two results. Currently, the GlobalISel-backend in TableGen requires that nested instructions appearing in the output pattern produce exactly one result. Consequently, TableGen rejects many of our patterns. But
 in reality, the instruction really only produces a single result and therefore this pattern should be allowed.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">So I wonder, how should registers appear in
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">Defs</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"> be treated? Are they
 equal to those appearing in </span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">outs</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">,
 and therefore interchangeable, or is it valid to disambiguate between them and therefore modify TableGen to only consider
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:#181818;mso-fareast-language:SV">outs
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">as the result of interest when processing the patterns?<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p> </o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV">Gabriel Hjort Åkerlund</span></b><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p></o:p></span></p>
<p class="MsoNormal" style="mso-line-height-alt:3.0pt"><span style="font-size:10.0pt;font-family:"Arial",sans-serif;color:#181818;mso-fareast-language:SV"><o:p> </o:p></span></p>
</div>
</body>
</html>