From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12712 invoked by alias); 9 Nov 2007 13:52:28 -0000 Received: (qmail 12704 invoked by uid 22791); 9 Nov 2007 13:52:27 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 09 Nov 2007 13:52:21 +0000 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1IqUHS-0006FE-00; Fri, 09 Nov 2007 13:52:18 +0000 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1IqUHH-0000ep-00; Fri, 09 Nov 2007 13:52:07 +0000 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1IqUHH-0006Py-6t; Fri, 09 Nov 2007 13:52:07 +0000 Date: Fri, 09 Nov 2007 13:52:00 -0000 From: "Maciej W. Rozycki" To: binutils@sources.redhat.com cc: "Maciej W. Rozycki" Subject: [RFD] MIPS/gas: Optimisation cannot be set to 0 Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.com 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/msg00090.txt.bz2 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. Maciej