[LLVMdev] Help on DAG pattern matching string

Bill Wendling isanbard at gmail.com
Sat Jul 4 15:08:52 PDT 2009


Are there any other patterns in your TD file? If so, then one of the  
ones before this pattern will match everything, and this pattern will  
never be matched.

-bw

On Jul 3, 2009, at 8:27 PM, Javier Martinez wrote:

> Hello,
>
> I'm new to LLVM and I'm using it to translate from LLVM to another
> language rather than emitting actual machine code. The target language
> has instructions that operate on pointers which aren't naturally  
> exposed
> in LLVM. Here's what I've done to add pointer support for an  
> instruction
> called PADD that takes a pointers and an offset and returns the new
> pointer value:
>
> def DefReg : Register<"r">;
> def PtrReg : Register<"ptr">;
> def I32RC : RegisterClass<"BE", [i32], 32, [DefReg]>;
> def P32RC : RegisterClass<"BE", [i32], 32, [PtrReg]>;
> def BEInst<bits<8> op, dag outs, dag ins, string asmstr, list<dag>
> pattern> : Instruction { /* assign arguments to class members */ }
> def BE_PADD : BEInst<0F, (outs P32RC:$dst), (ins P32RC:$src1,
> I32RC:$src2), "PADD",
>                                       [(set P32RC:$dst, (add
> P32RC:$src1, I32RC:$src2))]>;
>
> When I compile the project I get the error: Pattern '(add:i32
> P32RC:i32:$src1, I32RC:i32:$src2)' is impossible to select! Does  
> anyone
> have an idea of why I'm getting this error?
>
> I've read the docs on table generator, code generator, back end, etc.
> but I'm still unclear on how to write pattern selection strings. Area
> there resources other than the LLVM docs that explain this more in  
> detail?
>
> Thanks,
> Javier
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list