This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFD] MIPS/gas: Optimisation cannot be set to 0


 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;
	mips_optimize = 2;

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 

Wed Feb 12 14:36:29 1997  Ian Lance Taylor  <>

	* 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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]