<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 12, 2019 at 1:28 AM Joan Lluch <<a href="mailto:joan.lluch@icloud.com">joan.lluch@icloud.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Reshabh<br>
<br>
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” (?).</blockquote><div><br></div><div>Sorry, my bad. LUI and ADDI are present in RISCV ISA. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
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.<br>
<br>
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.<br></blockquote><div><br></div><div>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.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
John<br>
<br>
<br>
> On 11 Jul 2019, at 19:53, Reshabh Sharma via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Hello everyone,<br>
> <br>
> 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.<br>
> <br>
> LUI                         LUI<br>
>   |                             |<br>
> ADDI ----GLUE---- ADDI <br>
>   |<br>
> store<br>
> <br>
> I've few question about this and Glue node in general, I'll be happy to get some help on this :)<br>
> 1. Is Gluing the right approach or there is something better for such use case?<br>
> 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.<br>
> <br>
> Many thanks,<br>
> Reshabh<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
</blockquote></div></div></div>