[LLVMdev] Question about porting LLVM - code selection without assembler feature

Bill Wendling wendling at apple.com
Mon Jan 24 11:34:47 PST 2011


On Jan 21, 2011, at 11:09 PM, Lu Mitnick wrote:

> I am adding a new target into LLVM. However there is a assembler for that target and I just want LLVM to generate assembly. I read the document "Writing an LLVM Backend". I am wondering to know whether I can ignore the Inst field in the following example:
> 
> class InstSP<dag outs, dag ins, string asmstr, list<dag> pattern> : Instruction {
>   field bits<32> Inst;
>   let Namespace = "SP";
>   bits<2> op;
>   let Inst{31-30} = op;       
>   dag OutOperandList = outs;
>   dag InOperandList = ins;
>   let AsmString   = asmstr;
>   let Pattern = pattern;
> }
> And define the instruction class of ported target as:
> class Instxxx<dag outs, dag ins, string asmstr, list<dag> pattern> : Instruction {
>   let Namespace = "xxx";      
>   dag OutOperandList = outs;
>   dag InOperandList = ins;
>   let AsmString   = asmstr;
>   let Pattern = pattern;
> }
Hi Yi-Hong,

Yes, you may go ahead and omit the Inst field. That's used to represent the instruction encoding.

-bw

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110124/c8d8967b/attachment.html>


More information about the llvm-dev mailing list