From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16528 invoked by alias); 9 Nov 2007 15:56:12 -0000 Received: (qmail 16518 invoked by uid 22791); 9 Nov 2007 15:56:11 -0000 X-Spam-Check-By: sourceware.org Received: from relay01.mx.bawue.net (HELO relay01.mx.bawue.net) (193.7.176.67) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Nov 2007 15:56:03 +0000 Received: from lagash (intrt.mips-uk.com [194.74.144.130]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by relay01.mx.bawue.net (Postfix) with ESMTP id 6155948FB4; Fri, 9 Nov 2007 15:42:15 +0100 (CET) Received: from ths by lagash with local (Exim 4.68) (envelope-from ) id 1IqWD7-0007E8-Of; Fri, 09 Nov 2007 15:55:57 +0000 Date: Fri, 09 Nov 2007 15:56:00 -0000 From: Thiemo Seufer To: "Maciej W. Rozycki" Cc: binutils@sources.redhat.com, "Maciej W. Rozycki" Subject: Re: [RFD] MIPS/gas: Optimisation cannot be set to 0 Message-ID: <20071109155557.GB13909@networkno.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.16 (2007-06-11) X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-11/txt/msg00092.txt.bz2 Maciej W. Rozycki wrote: > 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 > > * 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. I also prefer the first option, given that gcc carefully avoids to pass -O0 in most cases: #ifndef SUBTARGET_ASM_OPTIMIZING_SPEC #define SUBTARGET_ASM_OPTIMIZING_SPEC "\ %{noasmopt:-O0} \ %{!noasmopt:%{O:-O2} %{O1:-O2} %{O2:-O2} %{O3:-O3}}" #endif The noasmopt option is undocumented. Thiemo