Ambuj Agrawal
2015-Mar-19 15:44 UTC
[LLVMdev] Clang flag to either print/omit nop instruction in llvm backend
I have created custom Clang flag -no_nop_optimise which can be passes with clang on command line. I am planning to implement someting like: when -no_nop_optimise flag is passed on the command line do not emit a nop instruction. i.e. inside SelLowering class if ( !OPT_no_nop_optimise) { BuildMI(*BB, MI, DL, TII->get(Mips::NOP)); } Any clues on how can I pass the flag to the LLVM backend from clang? Thanks, Ambuj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150319/ad9ed9b8/attachment.html>
Daniel Sanders
2015-Mar-19 16:56 UTC
[LLVMdev] Clang flag to either print/omit nop instruction in llvm backend
One possibility is adding the option to the backend instead and using '-mllvm –no_nop_optimise' on the clang command. This approach is good for options you don't intend end-users to use. Just to check: The NOP's you're trying to eliminate aren't related to branch delay slots are they? The reason I ask is because removing those without putting another instruction in their place will change the behaviour of your code. From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Ambuj Agrawal Sent: 19 March 2015 15:45 To: llvmdev at cs.uiuc.edu; cfe-dev at cs.uiuc.edu Subject: [LLVMdev] Clang flag to either print/omit nop instruction in llvm backend I have created custom Clang flag -no_nop_optimise which can be passes with clang on command line. I am planning to implement someting like: when -no_nop_optimise flag is passed on the command line do not emit a nop instruction. i.e. inside SelLowering class if ( !OPT_no_nop_optimise) { BuildMI(*BB, MI, DL, TII->get(Mips::NOP)); } Any clues on how can I pass the flag to the LLVM backend from clang? Thanks, Ambuj -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150319/fee3cc61/attachment.html>
Ambuj Agrawal
2015-Mar-20 15:51 UTC
[LLVMdev] Clang flag to either print/omit nop instruction in llvm backend
Thanks Daniel for your help. It works as required. Also, I am working with the custom defined instructions for MIPS and are not related to branch delay slots. Thanks, Ambuj On Thu, Mar 19, 2015 at 4:56 PM, Daniel Sanders <Daniel.Sanders at imgtec.com> wrote:> One possibility is adding the option to the backend instead and using > '-mllvm –no_nop_optimise' on the clang command. This approach is good for > options you don't intend end-users to use. > > > > Just to check: The NOP's you're trying to eliminate aren't related to > branch delay slots are they? The reason I ask is because removing those > without putting another instruction in their place will change the > behaviour of your code. > > > > *From:* llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] *On > Behalf Of *Ambuj Agrawal > *Sent:* 19 March 2015 15:45 > *To:* llvmdev at cs.uiuc.edu; cfe-dev at cs.uiuc.edu > *Subject:* [LLVMdev] Clang flag to either print/omit nop instruction in > llvm backend > > > > I have created custom Clang flag -no_nop_optimise which can be passes with > clang on command line. > > I am planning to implement someting like: > > when -no_nop_optimise flag is passed on the command line do not emit a nop > instruction. > > i.e. inside SelLowering class > > if ( !OPT_no_nop_optimise) > > { > BuildMI(*BB, MI, DL, TII->get(Mips::NOP)); > } > > > > Any clues on how can I pass the flag to the LLVM backend from clang? > > > > Thanks, > > Ambuj >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150320/99f3cab4/attachment.html>