m m via llvm-dev
2018-Dec-06 03:22 UTC
[llvm-dev] New to LLVM. Need help generating assembly
Hi, I'm new to LLVM and need some help. I defined an instruction to increment the stack pointer by 'amount' (i.e. sp = sp + amount). During assembly generation, the string that gets emitted is "ADS $SP" rather than "ADS 10", for example, if I want to increment it by 10. Can somebody show me what I'm doing wrong? Thanks. def ADS: F_J<0b100001,(outs),(ins i32imm:$amount),"ADS $amount",[(set SP, (add SP, i32imm:$amount))] > { bits<10> amount; let Inst{9-0} = amount; let isReMaterializable = 1; let mayLoad = 0; let mayStore = 0; let Defs = [SP]; let Uses = [SP]; } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181206/6ff8d7e0/attachment.html>
Tom Stellard via llvm-dev
2018-Dec-06 06:15 UTC
[llvm-dev] New to LLVM. Need help generating assembly
On 12/05/2018 07:22 PM, m m via llvm-dev wrote:> Hi, > I'm new to LLVM and need some help. I defined an instruction to increment the stack pointer by 'amount' (i.e. sp = sp + amount). During assembly generation, the string that gets emitted is "ADS $SP" rather than "ADS 10", for example, if I want to increment it by 10. > > Can somebody show me what I'm doing wrong? > Thanks. > > def ADS: F_J<0b100001,(outs),(ins i32imm:$amount),"ADS $amount",[(set SP, (add SP, i32imm:$amount))] > { > > bits<10> amount; > > let Inst{9-0} = amount; > let isReMaterializable = 1; > let mayLoad = 0; > let mayStore = 0; > let Defs = [SP]; > let Uses = [SP]; > }What does the MCInst dump of this instruction look like? Have you looked at YourTargetGenAsmWriter.inc to see which print methods are being called for this instruction? -Tom> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
Daniel Sanders via llvm-dev
2018-Dec-06 17:31 UTC
[llvm-dev] New to LLVM. Need help generating assembly
> On Dec 5, 2018, at 22:15, Tom Stellard via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > On 12/05/2018 07:22 PM, m m via llvm-dev wrote: >> Hi, >> I'm new to LLVM and need some help. I defined an instruction to increment the stack pointer by 'amount' (i.e. sp = sp + amount). During assembly generation, the string that gets emitted is "ADS $SP" rather than "ADS 10", for example, if I want to increment it by 10. >> >> Can somebody show me what I'm doing wrong? >> Thanks. >> >> def ADS: F_J<0b100001,(outs),(ins i32imm:$amount),"ADS $amount",[(set SP, (add SP, i32imm:$amount))] > { >> >> bits<10> amount; >> >> let Inst{9-0} = amount; >> let isReMaterializable = 1; >> let mayLoad = 0; >> let mayStore = 0; >> let Defs = [SP]; >> let Uses = [SP]; >> } > > What does the MCInst dump of this instruction look like? Have you looked > at YourTargetGenAsmWriter.inc to see which print methods are being called > for this instruction? > > -TomIt's also worth checking the output of the compiler with the -print-after-all option to see if your instruction is present in the last IR dump. It's possible that another instruction is being selected instead of this one.>> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev> >> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181206/a96b5e2e/attachment.html>