How to add a MVT::Glue property of intrinsic node?

Hi,

I have implemented a pair intrinsic nodes in back-end, But there is a chain dependence between two intrinsic nodes. So in the Pre-RA-sched stage, these two intrinsic nodes would be apart. I expect that there is no node between these two intrinsic nodes, therefore, I guess it would be work if there is a MVT::Glue between these nodes. But I don’t know how to add.

Thanks in advance.

Haishan

Hi Haishan,

  I have implemented a pair intrinsic nodes in back-end, But there is a
chain dependence between two intrinsic nodes. So in the Pre-RA-sched stage,
these two intrinsic nodes would be apart. I expect that there is no node
between these two intrinsic nodes, therefore, I guess it would be work if
there is a MVT::Glue between these nodes. But I don’t know how to add.

You can't Glue the two nodes together forever. All Glue really does is
keep them together long enough for LLVM to put together a data
dependency through "Uses" and "Defs" implicit operands. Once the
MachineInstrs have been created, the two instructions are at the whim
of the scheduler as much as any others.

If you really need them to remain together, you have to either create
a pseudo-instruction and expand it extremely late, or create a bundle
(depending on what's natural for your target).

That said, you usually just have to call SelectionDAG::getNode with an
SDVTList containing some Glue for it to work as intended. The only
time I've had that fail is when I forgot to add the Uses/Defs values
to the Instructions, so they couldn't be matched up. What problems are
you seeing from your attempts?

Cheers.

Tim.

Hi Haishan,

   I have implemented a pair intrinsic nodes in back-end, But there is a
chain dependence between two intrinsic nodes. So in the Pre-RA-sched stage,
these two intrinsic nodes would be apart. I expect that there is no node
between these two intrinsic nodes, therefore, I guess it would be work if
there is a MVT::Glue between these nodes. But I don’t know how to add.

You can't Glue the two nodes together forever. All Glue really does is
keep them together long enough for LLVM to put together a data
dependency through "Uses" and "Defs" implicit operands. Once the
MachineInstrs have been created, the two instructions are at the whim
of the scheduler as much as any others.

If you really need them to remain together, you have to either create
a pseudo-instruction and expand it extremely late, or create a bundle
(depending on what's natural for your target).

I just want to second Tim's point here. We tried to take the "separate but tied together" scheme in an early implementation of our safepoint work, and it was a really bad idea. It "mostly" worked, but we kept running into a long series of subtle issues. I *strongly* suggest you use the pseudo op approach. That has worked fairly well for us.