<div dir="ltr">A specific register shouldn't be in the "outs" list. outs is for registers the register allocator has freedom over. The GPR in RISCV tells the register allocator what register class to pick registers from. It's also used to tell the autogenerated assembly parser what type of operand it should be looking for when parsing. The $rd will also be mentioned in an assembly string to know where it goes relative to other operands.<div><br></div><div>If you instruction always write to a specific register this is what we call an implicit definition. It should be listed as "let Defs=[R2] in" before the instruction definition. There's a simpler Uses for implicit uses.<br><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">~Craig</div></div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 26, 2019 at 4:39 PM Chris Sears via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small"><div class="gmail_default">What is the difference between these two fragments (taken from two different tblgen record dumps)?</div><div class="gmail_default"><br></div><div class="gmail_default"> dag OutOperandList = (outs GPR:$rd);<br></div><div class="gmail_default"><div class="gmail_default"> dag OutOperandList = (outs R2);</div><br class="gmail-m_-7726786653221558732gmail-m_-3045113191812868031gmail-Apple-interchange-newline"></div><div class="gmail_default">The first is from the RISCV backend record dump. There will be a substitution at some point for $rd. In the second, I'm specifying R2, no substitution necessary.</div><div class="gmail_default"><br></div><div class="gmail_default">If I specify GPR64:R2 or i64:R2 in my Instruction def, rather than just R2, tblgen complains:</div><div class="gmail_default"><br></div><div class="gmail_default"> error: expected variable name in dag literal<br></div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default">If I use R1000 (which isn't defined) I get what I'd expect:</div><div class="gmail_default"><br></div><div class="gmail_default"> error: Variable not defined: 'R1000'</div></div><div class="gmail_default"><br></div><div class="gmail_default">There isn't any documentation (that I could find) for this syntax. Consequently, I'm a little worried that using R2 rather than something:R2 is somehow wrong.</div><div class="gmail_default"><br></div><div class="gmail_default">Why does the RISCV dag use GPR:$rd rather than just $rd?</div><div class="gmail-m_-7726786653221558732gmail-yj6qo gmail-m_-7726786653221558732gmail-ajU" style="outline:none;padding:10px 0px;width:22px;margin:2px 0px 0px">C</div></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>