<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jun 18, 2018, at 05:06, ComputerFreak via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="caret-color: rgb(0, 0, 0); font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-size: 10pt; font-family: Gulim, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hi, I am trying to develop new llvm backend based on RISCV architecture for practice.</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">using --debug option on llc tool, I got this error message. </div><p style="margin-top: 0px; margin-bottom: 0px;" class=""> </p><div style="margin-top: 0px; margin-bottom: 0px;" class="">LLVM ERROR: Cannot select: t4: ch = store<ST4[%1]> t0, Constant:i32<0>, FrameIndex:i32<0>, undef:i32</div><p style="margin-top: 0px; margin-bottom: 0px;" class=""> </p><div style="margin-top: 0px; margin-bottom: 0px;" class="">So I have questions on this problem.</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">1. Does this mean there is no SDNode matching the store pattern like that? </div><p style="margin-top: 0px; margin-bottom: 0px;" class=""> </p><div style="margin-top: 0px; margin-bottom: 0px;" class="">2. In LLVM language reference, the 'store' command pattern looks like this</div><pre class="">store [volatile] <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>][, !invariant.group !<index>] <br class=""><br class="">Based on this pattern, I define the store instruction in my *InstrInfo.td like this<br class=""></pre><div style="margin-top: 0px; margin-bottom: 0px;" class="">def STORE : MemStore_RISCVS<0b0100011, 0b010, "st", st, simm12, immSExt12, VR6Regs>; </div><div style="margin-top: 0px; margin-bottom: 0px;" class="">because In RISCV, store instruction has 2 registers and 12 bit immediate value. </div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Bit in the log upside there, it seems the word 'undef' makes the problem. ( This is just my assumption, so it could be wrong. If i am wrong, please correct me)</div><div style="margin-top: 0px; margin-bottom: 0px;" class="">Should I change my InstrInfo.td file then...? </div></div><span id="cid:1ECE3710-1253-4E1C-A8FA-4022105DD1FA@expressvpn"><llc.log></span><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><br class=""></div><div><br class=""></div><div>You aren’t directly matching against the IR store instruction, you are matching against the store ISD node, which is slightly different.</div><div>The undef is probably OK since that’s the addressing mode offset for the load, which only some targets use.</div><div><br class=""></div><div>I believe it isn’t generally recommend to try to match “st” directly, and match the more constrained store PatFrags (e.g. store and all the various type truncstores)</div><div><br class=""></div><div>-Matt</div><br class=""></body></html>