ComputerFreak via llvm-dev
2018-Jun-18 02:06 UTC
[llvm-dev] Store Instruction pattern match
Hi, I am trying to develop new llvm backend based on RISCV architecture for practice. using --debug option on llc tool, I got this error message. LLVM ERROR: Cannot select: t4: ch = store<ST4[%1]> t0, Constant:i32<0>, FrameIndex:i32<0>, undef:i32 So I have questions on this problem. 1. Does this mean there is no SDNode matching the store pattern like that? 2. In LLVM language reference, the 'store' command pattern looks like this store [volatile] <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>][, !invariant.group !<index>] Based on this pattern, I define the store instruction in my *InstrInfo.td like this def STORE : MemStore_RISCVS<0b0100011, 0b010, "st", st, simm12, immSExt12, VR6Regs>; because In RISCV, store instruction has 2 registers and 12 bit immediate value. 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) Should I change my InstrInfo.td file then...? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180618/1d88c749/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: llc.log Type: text/x-log Size: 6988 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180618/1d88c749/attachment.bin>
Matt Arsenault via llvm-dev
2018-Jun-19 11:59 UTC
[llvm-dev] Store Instruction pattern match
> On Jun 18, 2018, at 05:06, ComputerFreak via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Hi, I am trying to develop new llvm backend based on RISCV architecture for practice. > using --debug option on llc tool, I got this error message. > > LLVM ERROR: Cannot select: t4: ch = store<ST4[%1]> t0, Constant:i32<0>, FrameIndex:i32<0>, undef:i32 > > So I have questions on this problem. > 1. Does this mean there is no SDNode matching the store pattern like that? > > 2. In LLVM language reference, the 'store' command pattern looks like this > store [volatile] <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>][, !invariant.group !<index>] > > Based on this pattern, I define the store instruction in my *InstrInfo.td like this > def STORE : MemStore_RISCVS<0b0100011, 0b010, "st", st, simm12, immSExt12, VR6Regs>; > because In RISCV, store instruction has 2 registers and 12 bit immediate value. > 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) > Should I change my InstrInfo.td file then...? > <llc.log>______________________________________________You aren’t directly matching against the IR store instruction, you are matching against the store ISD node, which is slightly different. The undef is probably OK since that’s the addressing mode offset for the load, which only some targets use. 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) -Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180619/6a809e36/attachment.html>