[LLVMdev] initialize 'dag' variable and interpret asmstring in tablegen .td file

Tzu-Chien Chiu tzuchien.chiu at gmail.com
Thu May 5 23:00:45 PDT 2005


The macro $src, $dest used in Instruction::AsmString must be
"declared" in Instruction::OperandList, right?

$$ has special meaning?


On 5/6/05, Chris Lattner <sabre at nondot.org> wrote:
> On Fri, 6 May 2005, Tzu-Chien Chiu wrote:
> > llvm/lib/Target/X86/X86InstrInfo.td:
> > class X86Inst<bits<8> opcod, Format f, ImmType i, dag ops, string
> > AsmStr>  : Instruction {
> >    ....
> >    dag OperandList = ops;
> >    string AsmString = AsmStr;
> > }
> >
> > def MOV32mi : Ii32<0xC7, MRM0m, (ops i32mem:$dst, i32imm:$src),
> >                   "mov{l} {$src, $dst|$dst, $src}">;
> >
> > I cannot find any document on initializing the 'dag' type variable,
> > and I cannot understand the syntax of "asmstring" either.
> 
> The DAG operator is just a nested set of parens, e.g. (X (Y Z), Q), where
> X,Y,Z,Q are tblgen defs.  This is described here:
> http://llvm.cs.uiuc.edu/docs/TableGenFundamentals.html#values
> 
> > how does the x86 asmwrite interpret the "AsmString" ?
> 
> The X86 has two asm formats: Intel and AT&T.  Things in {}'s get split up
> and treated as one or the other.  The 0 part is AT&T, the 1th part is
> Intel.  It might make it more clear to just say that this string:
> 
>       "mov{l} {$src, $dst|$dst, $src}"
> 
> is fully equivalent to this one:
> 
>       "{movl $src, $dst|mov $dst, $src}"
> 
> No other targets support multiple output formats, so they don't have to
> worry about this.
> 
> -Chris
> 
> --
> http://nondot.org/sabre/
> http://llvm.cs.uiuc.edu/
>




More information about the llvm-dev mailing list