<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;}
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.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal-compose;
font-family:"Times New Roman",serif;
color:black;}
.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=SV link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'>I am in the process of porting our target to GlobalISel and have encountered the following problem. In our target, the predicate for conditional branching is placed on the branch instruction instead of the compare instruction. To make this work i</span><span lang=EN-US style='font-size:12.0pt;color:black'>n our SelectionISel-based implementation, we declare our own nodes, e.g.:</span><span lang=EN-US style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";color:black'>def XYZ_COMPARE_SIGNED : SDNode<"XYZISD::COMPARE_SIGNED", SDT_PHXiCmp, [SDNPHasChain, SDNPOutGlue]>;<o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'>During legalization, we lower BR_CC nodes into:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";color:black'>XYZISD::COMPARE_SIGNED <lhs> <rhs><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";color:black'>XYZISD::CONDBRANCH <label> <condition code> <condition reg></span><span lang=EN-US style='font-size:12.0pt;color:black'><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'>These are then used for pattern matching, e.g.:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-family:"Courier New";color:black'>def : Pat<(XYZ_COMPARE_SIGNED i16:$src1, (i16 Imm_m32768_32767_i16:$SImm)), (cmp_nimm16_a16 $src1, imm:$SImm)>;<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;font-family:"Courier New";color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'>Now to my question: What is the best way to achieve the same thing in GlobalISel? Is it possible to introduce new node types in GlobalISel? If so, how? If not, what’s a suitable work-around that allows me to reuse the tablegen-declared patterns?<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'>Cheers,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:12.0pt;color:black'>Gabriel<o:p></o:p></span></p></div></div></body></html>