<div dir="ltr"><div>Here's an example of how we are doing this, in table gen, of a mem, mem, mem operation:</div><div><br></div><div>def directStore : PatFrag<(ops node:$ptr, node:$val), (store node:$ptr, node:$val), [{.... we have some conditions here, etc... }]>;</div><div><br></div><div>class SetABDIn<string asmstr, DAGOperand srcA, DAGOperand srcB, DAGOperand dstD, list<dag pattern></div><div>                   : A_B_D<(outs), (ins srcA:$srcA, srcB:$srcB, dstD:$dstD),</div><div>                   !strconcat(asmstr, "\t$srcA, $srcB, $dstD"), pattern, IIAlu></div><div>{</div><div>        let mayStore = 1;</div><div>        let mayLoad = 1;</div><div>      // whatever else here</div><div>}</div><div><br></div><div>multiclass ABD<string asmstr, SDPatternOperator OpNode, RegisterClass srcAReg, RegisterClass srcBReg,</div><div>                          RegisterClass dstReg, ValueType srcAType, ValueType srcBType, ValueType dstType,</div><div>                          Operand ImmOd, ImmLeaf imm_type></div><div>{</div><div>       def MEM_MEM_MEM: SetABDIn<asmstr, memXX, memXX, memXX,</div><div>                          [{directStore (OpNode (srcAType (load addr:$srcA)), (srcBType (load addr:$srcB)), addr:$dstD)]>;</div><div>      // there are other combinations here, etc...</div><div>}</div><div><br></div><div>You obviously won't be able to use this directly but I hope this gives you an idea, I hope I understood your question correctly, apologies if I did not.</div><div><br></div><div>Thanks,</div><div><br></div><div>-Ryan</div><div><br></div><div>ps. If your architecture can do mem-mem operations, you will run into problems because common sub will always want to load the value into a register if it's being used more than once, we're having to generate a backend pass to reverse this, just fyi.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 5, 2016 at 1:07 AM, Ed Hepler via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm currently doing some research on instruction set architectures and have been looking for a a C compiler as a tool to assist in the work.    I'm new to LLVM, have read through the documentation, and compiled the release to run some tests.<br>
<br>
I looked over the documentation, and read through the .td files for some of the included architectures.    All are register-based architectures.  However, my work is looking at a memory-to-memory architecture, and I'm looking for some examples (or more documentation on writing .td files) to use as the basis for the .td files I need to write.<br>
<br>
Any help (or pointers to examples) is appreciated!<br>
<br>
Thanks!<br>
<br>
<br>
<br>
______________________________<wbr>_________________<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="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" rel="noreferrer">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>