I am writing a target for an odd cisc-like architecture which has no support for keeping most values in registers.  As such, memory-memory operations are needed, but for isel to generate a memory-memory the pattern must be of the form (store (op (load) (load))).<div>

<br></div><div>Let's use a simple example to show how this can be problematic:</div><div><div>  %0 = load i32* %a.addr, align 4</div><div>  store i32 %0, i32* %other, align 4<br></div><div>  %1 = load i32* %b.addr, align 4</div>

<div>  %add = add i32 %0, %1</div><div>----</div><div>In this example, the (store (load)) pair -- the first two lines -- will be matched by isel as a MOVmm.  This will be problematic for the add though, since the load SDNode will be gone, making that part of the DAG no longer of the form (add (load) (load)).  To counteract this, I would create 2 load SDNodes so that both of these patterns can be satisfied.  Does this make sense?<br>

</div><div>-Joe</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Dec 1, 2012 at 11:44 PM, Triple Yang <span dir="ltr"><<a href="mailto:triple.yang@gmail.com" target="_blank">triple.yang@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi, Joe.<br>
<br>
I am sorry I did not catch your point. Can you provide more details?<br>
<br>
Since SDValue/SDNode can be used multiple times, why would you want to<br>
create two identical objects<br>
instead of reference to the same one?<br>
<br>
2012/12/2 Joseph Pusdesris <<a href="mailto:joe@pusdesris.com">joe@pusdesris.com</a>>:<br>
<div class="HOEnZb"><div class="h5">> Yes, changing parameters will create a new Node, but is there some way I can<br>
> force a new node with the same parameters?<br>
> -Joe<br>
><br>
><br>
> On Sat, Dec 1, 2012 at 10:57 PM, Triple Yang <<a href="mailto:triple.yang@gmail.com">triple.yang@gmail.com</a>> wrote:<br>
>><br>
>> Hi, Joseph, I guess getLoad() will either search an existed SDValue<br>
>> *OR* create a new one for a non-existed one depending on real<br>
>> parameters.<br>
>><br>
>> Since you use exactly the same attributes dupVal/dupNode have, no<br>
>> doubt getLoad() return the old one.<br>
>><br>
>> I am not sure it's *volatile* that let you get a new result, you might<br>
>> want to try change some other parameters and check what it turns out.<br>
>><br>
>> Regards.<br>
>><br>
>> 2012/12/2 Joseph Pusdesris <<a href="mailto:joe@pusdesris.com">joe@pusdesris.com</a>><br>
>> ><br>
>> > So I think I have made some progress.<br>
>> > SDValue dupVal  = consumer->getOperand(OpNo);<br>
>> > LoadSDNode *dupNode = (LoadSDNode*) dupVal.getNode();<br>
>> ><br>
>> > SDValue newLoad = CurDAG->getLoad(dupVal.getValueType(),<br>
>> > dupVal.getDebugLoc(),<br>
>> >                                dupVal.getOperand(0),<br>
>> > dupVal.getOperand(1),<br>
>> >                                dupNode->getPointerInfo(),<br>
>> >                                dupNode->isVolatile(),<br>
>> > dupNode->isNonTemporal(),<br>
>> >                                dupNode->isInvariant(),<br>
>> > dupNode->getAlignment(),<br>
>> >                                dupNode->getTBAAInfo(),<br>
>> > dupNode->getRanges());<br>
>> > However, my problem now is that it will re-use the same load still.  If<br>
>> > I change something, like setting volatile to true for example, it will<br>
>> > create a new node, but otherwise it will not.  Any ideas?<br>
>> > -Joe<br>
>> ><br>
>> ><br>
>> > On Fri, Nov 30, 2012 at 9:55 PM, Joseph Pusdesris <<a href="mailto:joe@pusdesris.com">joe@pusdesris.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >> Hi, I am writing an llvm target and I need both loads for isel reasons,<br>
>> >> but I am struggling to find the right way.  I have been trying to use<br>
>> >> DAG.getLoad() to make a copy, then just change the operand in the consumers,<br>
>> >> but I cannot seem to get all of the arguments needed for that function in<br>
>> >> order to make the copy.  Any help would be great, thanks!<br>
>> >> -Joe<br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > LLVM Developers mailing list<br>
>> > <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
>> ><br>
>><br>
>><br>
>><br>
>> --<br>
>> ÑîÓÂÓ (Yang Yongyong)<br>
><br>
><br>
<br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
ÑîÓÂÓ (Yang Yongyong)<br>
</font></span></blockquote></div><br></div>