<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It has been something we've talked about for years, but I'm not aware of anyone working on it right now.<div><br><div><div>On Jan 6, 2013, at 5:34 PM, Justin Holewinski <<a href="mailto:justin.holewinski@gmail.com">justin.holewinski@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Thanks for the info. Is this on someone's list of things to do?</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Jan 6, 2013 at 7:41 PM, Bob Wilson <span dir="ltr"><<a href="mailto:bob.wilson@apple.com" target="_blank">bob.wilson@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div class="im"><div>On Jan 4, 2013, at 9:52 AM, Justin Holewinski <<a href="mailto:justin.holewinski@gmail.com" target="_blank">justin.holewinski@gmail.com</a>> wrote:</div>
<br><blockquote type="cite"><div dir="ltr">Are multi-output patterns in TableGen supposed to work, or is that a known limitation in the current implementation?</div></blockquote><div><br></div></div>It is a known limitation. You have to write C++ code to match patterns with multiple outputs.</div>
<div><br><blockquote type="cite"><div><div class="h5"><div dir="ltr"><div><br></div><div>If I have TableGen code like the following...</div><div><br></div><div>
<div><font face="courier new, monospace">1242 def SDTTestNode : SDTypeProfile<2, 1, [SDTCisSameAs<0, 1>]>;</font></div><div><font face="courier new, monospace">1243 def TestNode : SDNode<"NVPTXISD::TestNode", SDTTestNode>;</font></div>
<div><font face="courier new, monospace">1244 </font></div><div><font face="courier new, monospace">1245 def MyTestNode : NVPTXInst<(outs Int32Regs:$dst0, Int32Regs:$dst1),</font></div><div><font face="courier new, monospace">1246 (ins Int32Regs:$a),</font></div>
<div><font face="courier new, monospace">1247 "test $dst0, $dst1, $a;",</font></div><div><font face="courier new, monospace">1248 [(set Int32Regs:$dst0, Int32Regs:$dst1, (TestNode Int32Regs:$a))]>;</font></div>
<div><br></div><div>... TableGen crashes with the following stack trace:</div><div><br></div><div><div><font face="courier new, monospace">#0 0x00007fff8f372212 in __pthread_kill ()</font></div><div><font face="courier new, monospace">#1 0x00007fff8dc0eaf4 in pthread_kill ()</font></div>
<div><font face="courier new, monospace">#2 0x00000001003a978b in raise (sig=6) at Signals.inc:345</font></div><div><font face="courier new, monospace">#3 0x00000001003a9842 in abort () at Signals.inc:362</font></div><div>
<font face="courier new, monospace">#4 0x00000001003a9821 in __assert_rtn (func=0x1003d0d14 "operator[]", file=0x1003b169e "/Users/jholewinski/projects/llvm/src/llvm/include/llvm/ADT/SmallVector.h", line=139, expr=0x1003b16e7 "begin() + idx < end()") at Signals.inc:358</font></div>
<div><font face="courier new, monospace">#5 0x00000001000ca394 in llvm::SmallVectorTemplateCommon<llvm::EEVT::TypeSet, void>::operator[] (this=0x10384fed0, idx=1) at SmallVector.h:139</font></div><div><font face="courier new, monospace">#6 0x00000001000c965b in llvm::TreePatternNode::getExtType (this=0x10384fed0, ResNo=1) at CodeGenDAGPatterns.h:349</font></div>
<div><font face="courier new, monospace">#7 0x00000001000bd615 in llvm::CodeGenDAGPatterns::ParseInstructions (this=0x7fff5fbff0b0) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2782</font></div>
<div><font face="courier new, monospace">#8 0x00000001000b7143 in llvm::CodeGenDAGPatterns::CodeGenDAGPatterns (this=0x7fff5fbff0b0, R=@0x7fff5fbff670) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2077</font></div>
<div><font face="courier new, monospace">#9 0x00000001000b6a3d in llvm::CodeGenDAGPatterns::CodeGenDAGPatterns (this=0x7fff5fbff0b0, R=@0x7fff5fbff670) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/CodeGenDAGPatterns.cpp:2091</font></div>
<div><font face="courier new, monospace">#10 0x000000010024cd15 in InstrInfoEmitter (this=0x7fff5fbff0a8, R=@0x7fff5fbff670) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/InstrInfoEmitter.cpp:39</font></div>
<div><font face="courier new, monospace">#11 0x0000000100248e8d in InstrInfoEmitter (this=0x7fff5fbff0a8, R=@0x7fff5fbff670) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/InstrInfoEmitter.cpp:39</font></div>
<div><font face="courier new, monospace">#12 0x0000000100248e36 in llvm::EmitInstrInfo (RK=@0x7fff5fbff670, OS=@0x7fff5fbff518) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/InstrInfoEmitter.cpp:420</font></div>
<div><font face="courier new, monospace">#13 0x00000001002d0930 in LLVMTableGenMain (OS=@0x7fff5fbff518, Records=@0x7fff5fbff670) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/TableGen.cpp:106</font></div><div>
<font face="courier new, monospace">#14 0x00000001002e8385 in llvm::TableGenMain (argv0=0x7fff5fbffa88 "/Users/jholewinski/projects/llvm/build/bin/llvm-tblgen", MainFn=0x1002d0880 <LLVMTableGenMain>) at /Users/jholewinski/projects/llvm/src/llvm/lib/TableGen/Main.cpp:117</font></div>
<div><font face="courier new, monospace">#15 0x00000001002d0864 in main (argc=11, argv=0x7fff5fbff8f8) at /Users/jholewinski/projects/llvm/src/llvm/utils/TableGen/TableGen.cpp:181</font></div><div><br></div><div><br></div>
<div>The fault occurs in CodeGenDAGPatterns.cpp:</div><div><br></div><div><div><font face="courier new, monospace">2781 for (unsigned i = 0; i != NumResults; ++i)</font></div><div><font face="courier new, monospace">2782 ResultPattern->setType(i, Res0Node->getExtType(i));</font></div>
</div><div><br></div><div>Res0Node has only 1 type, but it is expected to have 2.</div><div><br></div><div><br></div><div>Looking at the X86 back-end code, it looks like there do exist multi-output instructions, but they all use physical (implicit) registers for the second destination, not arbitrary register types. And if I change the second destination to be a certain physical register, this problem goes away in my code. Is this just not a supported case currently? Or am I doing something wrong?</div>
<div><br></div><div>This is my first time looking into the TableGen internals, so I can't spot anything obviously wrong with the TableGen tool code.</div><div><br></div>-- <br><br><div>Thanks,</div><div>
<br></div><div>Justin Holewinski</div>
</div></div></div></div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><br><div>Thanks,</div><div><br></div><div>Justin Holewinski</div>
</div>
</blockquote></div><br></div></body></html>