[llvm-dev] Glue to connect two nodes in LLVM backend

Reshabh Sharma via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 16 07:50:35 PDT 2019


On Fri, Jul 12, 2019 at 1:28 AM Joan Lluch <joan.lluch at icloud.com> wrote:

> Hi Reshabh
>
> I was able to implement a custom backend for a particular architecture but
> I'm unsure if I understand your question. What you mean by “LUI”?. Also I
> think there’s no "ISD:ADDI” (?).


Sorry, my bad. LUI and ADDI are present in RISCV ISA.


>
>
The third parameter of the DAG.getNode is the result type. If the node has
> a single result you can specify a simple MVT, otherwise you must create a
> SDVTList by calling DAG.getVTList.  In your example you set the result of
> the DAG.getNode to be a MVT:Glue, but there’s no other result that you can
> use. I assume this is not what you want. The input types are given by the
> nodes that you pass as operands. Nodes with a glue only result are useful
> to implement things such as compare instructions that do not produce
> regular values. However, even in this case it is generally better to just
> add the flags as the instruction output and forget about the glue.
>
> You can connect nodes in any way you want. Nodes can have input glues and
> output glues. Gluing nodes means that they will be executed in a defined
> order, but you should not need to do so if you already have regular values
> that you can connect in the way that will do what you want.
>

Many thanks Joan, I was not aware about the SDVTList. After knowing more
about MVT::Glue, I guess we might not need it and either a wrapper or as
you said connecting them will just work.

John
>
>
> > On 11 Jul 2019, at 19:53, Reshabh Sharma via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> >
> > Hello everyone,
> >
> > I wanted to attach a node without affecting the present nodes in any
> way. I tried to use MVT::Glue for that but I think I'm missing something as
> I could not achieve the below state.
> >
> > LUI                         LUI
> >   |                             |
> > ADDI ----GLUE---- ADDI
> >   |
> > store
> >
> > I've few question about this and Glue node in general, I'll be happy to
> get some help on this :)
> > 1. Is Gluing the right approach or there is something better for such
> use case?
> > 2. If I do something like DAG.getNode(ISD::ADDI, DL, MVT::Glue, LUINode,
> OtherADDINode). How will it know that the other ADDI node should be glued
> and not LUI. I seriously feel I'm missing something.
> >
> > Many thanks,
> > Reshabh
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190716/64d0d3ba/attachment.html>


More information about the llvm-dev mailing list