[LLVMdev] Clang flag to either print/omit nop instruction in llvm backend

38 views
Skip to first unread message

Ambuj Agrawal

unread,
Mar 19, 2015, 11:47:41 AM3/19/15
to llv...@cs.uiuc.edu, cfe...@cs.uiuc.edu
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

Daniel Sanders

unread,
Mar 19, 2015, 12:58:32 PM3/19/15
to Ambuj Agrawal, llv...@cs.uiuc.edu, cfe...@cs.uiuc.edu

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.

Ambuj Agrawal

unread,
Mar 20, 2015, 11:55:53 AM3/20/15
to Daniel Sanders, cfe...@cs.uiuc.edu, llv...@cs.uiuc.edu
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
Reply all
Reply to author
Forward
0 new messages