[llvm-dev] Selecting different instructions depending on addrspace() value

Gleb Popov via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 21 05:35:49 PDT 2019


Hello.

In my backend I have pointers in different address spaces. I want to emit
different instructions based on addrspace value, but I can't find a way to
do that.

It seems not possible to do that with usual "store" pattern fragment in .td
file, so I added custom ISD opcode for my instruction and created it
manually in MyBackendISelLowering. However, it doesn't get selected now, no
matter what I try.

The code I currently have in InstrInfo.td:

def my_store         : SDNode<"MYISD::STORE"      , SDTStore,
                        [SDNPHasChain, SDNPMayStore, SDNPMemOperand]>;

let mayStore = 1 in {
def MyStore : InstMyRI<2, (outs), (ins i32imm:$i, IntRegs:$reg),
                     "", [(my_store i32:$reg, imm:$i)]>;
}

The error I get:

ISEL: Starting selection on root node: t15: ch = <<Unknown Target Node
#278>> t13:1, Constant:i32<5>, FrameIndex:i32<-3>
ISEL: Starting pattern match
  Initial Opcode index to 4
  Match failed at index 10
LLVM ERROR: Cannot select: t15: ch = <<Unknown Target Node #278>> t13:1,
Constant:i32<5>, FrameIndex:i32<-3>
  t2: i32 = Constant<5>
  t14: i32 = FrameIndex<-3>


Thanks in advance for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190321/3578a863/attachment.html>


More information about the llvm-dev mailing list