Tablegen: How to define a Pattern with multiple result instructions

Hi,

I'm trying to create a Pattern that looks something like this:

def my_inst : Instruction <
  let OutOperandList = (outs REG:$dst);
  let InOperandList = (ins imm:$src);
  let Uses = [R0];

def int_my_intrinsic : Intrinsic <
  [llvm_float_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty],

;

def : Pattern <
  (int_my_intrinsic imm:$a, imm:$b, imm:$c),
  [(set R0, (MOV_IMM imm:$a)),
   (my_inst (my_inst $b), $c)]

;

When I try to run this through tablegen, I get this error:
"Cannot handle instructions producing instructions with temporaries
yet!"

What does this error message mean? Is what I'm trying to do even
possible with tablegen?

Thanks,
Tom

TableGen can do this if the second instruction uses the result of the first as an input, but not if they're completely separate like this. The output pattern must be in the form of a DAG.

You probably want to do this via a custom lowering and/or pseudo instructions that get expanded after isle.

-Jim

Hi all,

I would like to be sure that Tablegen still does not support completely
separate multiple instruction generation, and the only way is to write
costume code (may be in TargetISelDAGToDAG class) to get the needed result.

Dear Tom, do you found other solution (using Tablegen tool) for this?

Thanks,
Arsen

Hi all,

I would like to be sure that Tablegen still does not support completely
separate multiple instruction generation, and the only way is to write
costume code (may be in TargetISelDAGToDAG class) to get the needed result.

Dear Tom, do you found other solution (using Tablegen tool) for this?

I think the best way to do this is to use a pseudo instruction and then
expand it after instruction selection by using a custom inserter.

-Tom

Dear Tom,

What is the advantage to use the “pseudo instruction” approach VS “custom lowering/DAGtoDAGSelection” VS “ Library function”?

Best

Kevin

Dear Tom,

What is the advantage to use the “pseudo instruction” approach VS “custom lowering/DAGtoDAGSelection” VS “ Library function”?

It really depends on the instructions being lowered. If you are adding two
instructions where one has a chain and the other doesn't, it is much easier
to do it with pseudo instruction lowered using a custom inserter.

If you want both instruction to be glued together for the duration of
the program, then you will need to use a pseudo instruction and
expand it post-RA.

I've never tried to emit two unrelated instructions from a node with a single
result using DAGToDAGSelection, but I think it's theoretically possible
if you tied them together using glue.

-Tom

tks a lot.

kevin