<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Monospace;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-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.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-priority:99;
mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-priority:99;
mso-style-link:"Balloon Text";
font-family:"Tahoma","sans-serif";}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.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-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace">This seems to work:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace">
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace">def MOVSUTO_A_iSLo : CLPFPU_A_iSLo<0b1000001101,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace"> (ins IMM32Operand:$ImmA, FPUaOffsetOperand:$OffsetB),<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace"> (outs ),<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace"> [],<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Monospace"> "movsuto_a\t$ImmA,$OffsetB",<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Monospace"> [(store (<span style="background:lime;mso-highlight:lime">i32</span> imm:$ImmA),(frameindex:$OffsetB))],NoItinerary> {</span><span style="color:#1F497D"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Dominique Torette
<br>
<b>Sent:</b> lundi 16 octobre 2017 17:17<br>
<b>To:</b> llvm-dev@lists.llvm.org<br>
<b>Cc:</b> Roel Jordans (r.jordans@tue.nl)<br>
<b>Subject:</b> How to match multiple DAG nodes<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none">Hi,<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none">I’m trying to lower the following DAG fragment into a single MOV immediate value to an offset position of current frame (Offset register family) using DAG to instruction pattern.<o:p></o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""><o:p> </o:p></span></p>
<p class="MsoNormal"><img width="483" height="311" id="Picture_x0020_2" src="cid:image001.png@01D346AB.06A53A80"><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">void test_assign_float() {<o:p></o:p></p>
<p class="MsoNormal"> volatile float res;<o:p></o:p></p>
<p class="MsoNormal"> res = 42.0;<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">SelectionDAG has 9 nodes:<o:p></o:p></p>
<p class="MsoNormal"> t0: ch = EntryToken<o:p></o:p></p>
<p class="MsoNormal"> t3: ch = lifetime.start t0, TargetFrameIndex:i16<0><o:p></o:p></p>
<p class="MsoNormal"> t11: ch = store<Volatile ST4[%res]> t3, Constant:i32<1109917696>, FrameIndex:i16<0>, undef:i16<o:p></o:p></p>
<p class="MsoNormal"> t8: ch = lifetime.end t11, TargetFrameIndex:i16<0><o:p></o:p></p>
<p class="MsoNormal"> <span lang="FR-BE">t9: ch = CLPISD::RET_FLAG t8<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="FR-BE" style="font-size:10.0pt;font-family:"Courier New","serif""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">In my pattern, I have to match multiple nodes: the store node, the Constant node and the FrameIndex node.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> def MOVSUTO_A_iSLo : CLPFPU_A_iSLo<0b1000001101,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> (ins IMM32Operand:$ImmA, FPUaOffsetOperand:$OffsetB),<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> (outs ),<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> [],<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> "movsuto_a\t$ImmA,$OffsetB",<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> [(store (imm:$ImmA),(frameindex:$OffsetB))],NoItinerary> {<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">During TableGen, I got the following error:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">MOVSUTO_A_iSLo: (st (imm:{<span style="background:yellow;mso-highlight:yellow">i16:i32:v2i16:v2i32</span>}):$ImmA, (frameindex:iPTR):$OffsetB)<<P:Predicate_unindexedstore>><<P:Predicate_store>><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">Included from /home/dte/Projects/CLP/clp-llvm/trunk/llvm-project/llvm/lib/Target/CLP/CLP.td:33:<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">/home/dte/Projects/CLP/clp-llvm/trunk/llvm-project/llvm/lib/Target/CLP/CLPInstrInfo.td:13772:2: error:
<span style="background:yellow;mso-highlight:yellow">In MOVSUTO_A_iSLo: Could not infer all types in pattern!</span><o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> def MOVSUTO_A_iSLo : CLPFPU_A_iSLo<0b1000001101,<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> ^<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">../../../bin/llvm-tblgen: 1 errors.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It is understood that the ‘Constant’ node will be matched by the default ‘imm’ pattern.<o:p></o:p></p>
<p class="MsoNormal">It seems that TableGen can’t infer the type for ImmA, even if the operand is defined as is an i32, as per following definition:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">def IMM32Operand:Operand<i32> {
<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif""> let ParserMatchClass= IMM32OperandClass;<o:p></o:p></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:"Courier New","serif"">}<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What do I’have to add to remove the ambiguity on the ImmA type?<o:p></o:p></p>
<p class="MsoNormal">Is there a syntax to specify/coerce the data type of the Constant node in the pattern?<o:p></o:p></p>
<p class="MsoNormal">I’have guess/try some syntaxes using i32 types, but without success.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><br>
<br>
<br>
<br>
<br>
<o:p></o:p></span></p>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" width="536" style="width:402.0pt">
<tbody>
<tr>
<td style="padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><img width="536" height="49" id="_x0000_i1026" src="http://www.spacebel.be/wp-content/uploads/2011/06/image-sign-sbp.jpg" alt="http://www.spacebel.be/wp-content/uploads/2011/06/image-sign-sbp.jpg"><o:p></o:p></span></p>
</td>
</tr>
<tr>
<td style="border:solid silver 1.0pt;padding:0cm 0cm 0cm 0cm">
<p class="MsoNormal" align="center" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-align:center">
<b><span style="font-size:10.0pt">Dominique Torette</span></b><span style="font-size:10.0pt">
<br>
System Architect<br>
Rue des Chas</span><span lang="FR-BE" style="font-size:10.0pt">seurs Ardennais - Liège Science Park - B-4031 Angleur
<br>
Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20 <br>
</span><span style="font-size:10.0pt"><a href="http://www.spacebel.be/"><span lang="FR-BE">www.spacebel.be</span></a></span><span lang="FR-BE" style="font-size:12.0pt;font-family:"Times New Roman","serif""><o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span lang="FR-BE"><o:p> </o:p></span></p>
</div>
<br clear="both">
------------------------------------------------------------------------------<BR>
<BR>
E-MAIL DISCLAIMER<BR>
<BR>
The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden.<BR>
<BR>
SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free.<BR>
Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail.<BR>
<BR>
SPACEBEL denies all liability where E-mail is used for private use.<BR>
<BR>
SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system.<BR>
-------------------------------------------------------------------------------<BR>
</body>
</html>