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

Tim Northover t.p.northover at gmail.com
Mon Jun 23 08:20:01 PDT 2014

Hi Haishan,

On 23 June 2014 16:07, Haishan <hndxvon at 163.com> wrote:
>   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?



More information about the llvm-dev mailing list