Hello David,<div><br></div><div>Thanks for your example. Is that means that DAG pattern is consist of LLVM IR instruction?? I met an example  [(set CPURegs:$dst, (OpNode CPURegs:$b, CPURegs:$c))] of MipsInstrInfo.td, but I can't find correspond LLVM IR instruction of "set" in "LLVM Language Reference Manual". Is that correspond to $dst = op $b, $c?? Would you mind to tell me whether there is a reference of all possible element of DAG??</div>
<div><br></div><div>thanks a lot</div><div><br></div><div>yi-hong</div><div><br></div><div><div class="gmail_quote">2011/1/25 David A. Greene <span dir="ltr"><<a href="mailto:greened@obbligato.org">greened@obbligato.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Lu Mitnick <<a href="mailto:king19880326@gmail.com">king19880326@gmail.com</a>> writes:<br>
<br>
> Hello all,<br>
><br>
> I am adding a new target into LLVM. However there is a assembler for<br>
> that target and I just want LLVM to generate assembly. I read the<br>
> document "Writing an LLVM Backend". I am wondering to know whether I<br>
> can ignore the Inst field in the following example:<br>
<br>
</div>I'm not an expert here so I'll defer to others.<br>
<div class="im"><br>
> Second, I have read the documentation of "TableGen Fundamentals" and<br>
> "The LLVM Target Independent Code Generator". But I don't know how to<br>
> fill the dag filed of instruction. like [(store IntRegs:$src,<br>
> ADDRrr:$addr)] of the following example:<br>
><br>
> def STrr  : F3_1< 3, 0b000100, (outs), (ins MEMrr:$addr, IntRegs:$src),<br>
><br>
>                "st $src, [$addr]", [(store IntRegs:$src, ADDRrr:$addr)]>;<br>
><br>
> Would anyone mind to tell me where to find the documentation of the<br>
> dag in Independent Code Generator??<br>
<br>
</div>Think of the DAG pattern as a LISP expression.  Each level of parens is<br>
a subtree in the DAG, so<br>
<br>
             +<br>
            / \<br>
           /   \<br>
          a     *<br>
               / \<br>
              b   c<br>
<br>
Becomes:<br>
<br>
[(add REGCLASS:$a, (mul REGCLASS:&b, REGCLASS:$c))]<br>
<br>
That's the pattern your codegen will match and turn into the asm string<br>
you provide (The "st $src, [$addr]" in your example).<br>
<br>
Does that help?<br>
<br>
                               -Dave<br>
</blockquote></div><br></div>