Hello,
Browsing through gas code I have noticed this snippet:
/* Whether we are optimizing. The default value of 2 means to remove
unneeded NOPs and swap branch instructions when possible. A value
of 1 means to not swap branches. A value of 0 means to always
insert NOPs. */
static int mips_optimize = 2;
and all the three values are checked against throughout. However, it is
not possible to set the variable to 0 -- the only piece of code doing
initialisation is this:
case 'O':
if (arg && arg[0] == '0')
mips_optimize = 1;
else
mips_optimize = 2;
break;
in md_parse_option(). It looks like it has been like this since our CVS
tree was born. There is this ChangeLog entry which may be of relevance
though:
Wed Feb 12 14:36:29 1997 Ian Lance Taylor <ian@cygnus.com>
* config/tc-mips.c (md_parse_option): When debugging, set
mips_optimize to 1, not 0.
Anyway, the outcome is we have dead code and unclear semantics. The most
obvious solution is mapping the argument of -O directly to the value of
mips_optimize. The drawback is changed semantics. Another possibility is
getting rid of what currently mips_optimize == 1 means entirely. And
there may be more reasonable options available.
I have no strong preference, but I think gas should have a mode where its
input is assembled intact. And swapping branches may produce surprising
interactions with debugging information. I am therefore in favour to the
first proposal above, but I would like to hear from the others.
Maciej