<div dir="ltr">Hmm, okay. Then what's the problem being reported here? I'm not sure what I'm supposed to do with "<span style="font-family:monospace;font-size:10.5625px">LLVM ERROR: Cannot select: t1: i16 = Constant<127>".</span>BTW, the function is:<div><font face="monospace"><span style="font-size:10.5625px"><br></span></font></div><div><font face="monospace"><div style="">; ModuleID = 'return.c'</div><div style="">source_filename = "return.c"</div><div style="">target datalayout = "E-m:e-p:16:16:16-i1:16:16-i8:16:16-i16:16:16-i32:16:16-i64:16:16-S16-n16"</div><div style="">target triple = "tms9900"</div><div style=""><br></div><div style="">; Function Attrs: noinline nounwind optnone</div><div style="">define signext i16 @my_func() #0 {</div><div style="">entry:</div><div style="">  ret i16 127</div><div style="">}</div><div style="font-size:10.5625px"><br></div><div style="font-size:10.5625px">------- debug output --------</div></font><div><font face="monospace"><span style="font-size:10.5625px"><br></span></font></div><div><font face="monospace"><div style="">Optimized legalized selection DAG: BB#0 'my_func:entry'</div><div style="">SelectionDAG has 5 nodes:</div><div style="">    t0: ch = EntryToken</div><div style="">  t3: ch,glue = CopyToReg t0, Register:i16 %R5, Constant:i16<127></div><div style="">  t4: ch = TMS9900ISD::Ret t3, Register:i16 %R5, t3:1</div></font><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">===== Instruction selection begins: BB#0 'entry'</span><div><div><font face="monospace">Selecting: t4: ch = TMS9900ISD::Ret t3, Register:i16 %R5, t3:1</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">ISEL: Starting pattern match on root node: t4: ch = TMS9900ISD::Ret t3, Register:i16 %R5, t3:1</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">  Morphed node: t4: ch,glue = Retr Register:i16 %R5, t3</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">ISEL: Match complete!</font></div><div><font face="monospace">Selecting: t3: ch,glue = CopyToReg t0, Register:i16 %R5, Constant:i16<127></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">Selecting: t2: i16 = Register %R5</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">Selecting: t1: i16 = Constant<127></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">ISEL: Starting pattern match on root node: t1: i16 = Constant<127></font></div><div><font face="monospace"><br></font></div><div><font face="monospace">  Initial Opcode index to 0</font></div><div><font face="monospace">  Match failed at index 0</font></div><div><font face="monospace">LLVM ERROR: Cannot select: t1: i16 = Constant<127></font></div><div><font face="monospace">In function: my_func</font></div></div><div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Nov 4, 2017 at 7:22 PM Craig Topper <<a href="mailto:craig.topper@gmail.com">craig.topper@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div dir="auto">CopyToReg is not handle by patterns. It should be passed through isel unchanged. It’s part of a special list of ISD opcodes that don’t change in SelectioDAGISel::SelectCodeCommon</div><div dir="auto"><br></div><div dir="auto">It will then be turned into a TargetOpcode::COPY in InstrEmitter::EmitSpecialNode when the DAG is turned into MachineInstrs.</div><div dir="auto"><br></div><div class="gmail_quote"></div></div><div><div class="gmail_quote"><div>On Sat, Nov 4, 2017 at 7:02 PM Robert Baruch via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div></div></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>So there's a DAG that looks like this in the debug output:<div><br></div><div><div><font face="monospace">  Selecting: t3: ch,glue = CopyToReg t0, Register:i16 %R5, Constant:i16<127></font></div></div><div><br></div><div>In the instruction selection phase, what pattern would that match? I've constructed this so far:</div><div><br></div><div><font face="monospace">  (??? REG16:$dst, i16imm:$src)</font></div><div><br></div><div>but the problem is, I can't determine what to use as <font face="monospace">???</font>. There is an <font face="monospace">ISD::CopyToReg</font> enum value, but I don't know how that translates to the string to use in the pattern.</div><div><br></div><div>And more generally, how do I find out from a DAG diagram like the ones output by <font face="monospace">-view-isel-dags</font> which node type corresponds to which pattern string?</div><div><br></div><div>Thanks,</div><div><br></div><div>--Rob</div><div><br></div></div></blockquote></div></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
_______________________________________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div><div dir="ltr">-- <br></div><div class="m_3808137461368793721gmail_signature" data-smartmail="gmail_signature">~Craig</div>
</blockquote></div>