This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [RFD] MIPS/gas: Optimisation cannot be set to 0
On Fri, 9 Nov 2007, Ian Lance Taylor wrote:
> My vague recollection of the problem is that at least at that time gcc
> would always pass a -O option to the assembler. When not optimizing,
> it would pass -O0. However, inserting NOPs for MIPS variants which do
> not need them does not help debugging.
Presumably it does not impair it either. It's no more the case as
noticed by Thiemo though.
> I'm not sure I see the relevance of "assembled intact." The source is
> assembled just as the user specified with -O1. -O1 simply inhibits
> adding additional unnecessary nop instructions--nop instructions that
> were required for MIPS ISA I but not for later ISAs.
The "assembled intact" phrase comes from me just interpreting the comment
as is -- I have had a look at the code and mips_optimize == 0 means not to
remove NOPs inserted by gas itself, rather than optimising away
unnecessary padding supplied by the source code (".set reorder" always
assumed). Sorry about the confusion.
> At -O1 branches are not swapped, so debugging is not impaired.
>
> I agree there should be a way to set mips_optimize to 0, but we should
> ensure that gcc -O0 does not set mips_optimize to 0 when assembling.
These days GCC is meant to handle delay slot scheduling itself, so
perhaps the best bet is not to pass -O options from the driver to gas at
all. OTOH, apparently -mips16 still does not schedule slots and uses
".set reorder" at least for some configurations and this branch swapping
messes with debugging terribly -- it's no fun to have a breakpoint set on
the second half of an exteded branch/jump instruction. :-( Which is why I
have had a look at gas in this area in the first place.
Maciej