[LLVMdev] Load/Store Instruction Error
Daniil Troshkov
troshkovdanil at gmail.com
Sat Jun 7 08:28:33 PDT 2014
Hi!
There is doc
http://llvm.org/docs/WritingAnLLVMBackend.html
look for ComplexPattern:
> def STrr : F3_1< 3, 0b000100, (outs), (ins MEMrr:$addr, IntRegs:$src),
> "st $src, [$addr]", [(store i32:$src, ADDRrr:$addr)]>;
>ADDRrr is a memory mode that is also defined in SparcInstrInfo.td:
>def ADDRrr : ComplexPattern<i32, 2, "SelectADDRrr", [], []>;
Maybe ComplexPattern is what you want...
On Sat, Jun 7, 2014 at 12:04 PM, Ramin Guner <webvlkn at gmail.com> wrote:
> Hi all,
>
> I started to write an LLVM backend for custom CPU. I created XXXInstrInfo
> but there are some problems. I searched for it but I couldn't find
> anything. Can anyone help me?
>
> include "XXXInstrFormats.td"
> def simm16 : Operand<i32> {
> let DecoderMethod = "DecodeSimm16";
> }
> def mem : Operand<i32> {
> let PrintMethod = "printMemOperand";
> let MIOperandInfo = (ops GPRegs, GPRegs);
> let EncoderMethod = "getMemEncoding";
> }
> def addr : ComplexPattern<i32, 2, "SelectAddr", [frameindex],
> [SDNPWantParent]>;
>
> def LDRAM : FG1<0b000001, (outs GPRegs:$dst), (ins mem:$src), "ldram
> $dst,$src", [(set GPRegs:$dst, (load addr:$src))]>;
> def STRAM : FG1<0b000010, (outs), (ins GPRegs:$src, mem:$dst), "stram
> $dst,$src", [(store GPRegs:$src, addr:$dst)]>;
> def ADD : FG2<0b000000, (outs GPRegs:$dst), (ins GPRegs:$src1,
> GPRegs:$src2), "add $dst,$src1,$src2", [(set GPRegs:$dst, (add
> GPRegs:$src1, GPRegs:$src2))]>;
>
> Error Message:
> LDRAM: (set GPRegs:{i32:f32}:$dst, (ld:{i32:f32}
> addr:iPTR:$src)<<P:Predicate_unindexedload>><<P:Predicate_load>>)
> Included from
> /home/jwon/Desktop/llvmTest/llvm-3.4/lib/Target/XXX/XXXOther.td:10:
> Included from /home/jwon/Desktop/llvmTest/llvm-3.4/lib/Target/XXX/XXX.td:1:
> /home/jwon/Desktop/llvmTest/llvm-3.4/lib/Target/XXX/XXXInstrInfo.td:34:1:
> error: In LDRAM: Could not infer all types in pattern!
> def LDRAM : FG1<0b000001, (outs GPRegs:$dst), (ins mem:$src), "ldram
> $dst,$src", [(set GPRegs:$dst, (load addr:$src))]>;
> ^
> STRAM: (st GPRegs:{i32:f32}:$src,
> addr:iPTR:$dst)<<P:Predicate_unindexedstore>><<P:Predicate_store>>
> Included from
> /home/jwon/Desktop/llvmTest/llvm-3.4/lib/Target/XXX/XXXOther.td:10:
> Included from /home/jwon/Desktop/llvmTest/llvm-3.4/lib/Target/XXX/XXX.td:1:
> /home/jwon/Desktop/llvmTest/llvm-3.4/lib/Target/XXX/XXXInstrInfo.td:36:1:
> error: In STRAM: Could not infer all types in pattern!
> def STRAM : FG1<0b000010, (outs), (ins GPRegs:$src, mem:$dst), "stram
> $dst,$src", [(store GPRegs:$src, addr:$dst)]>;
> ^
>
> Thanks in advance.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140607/80db3439/attachment.html>
More information about the llvm-dev
mailing list