From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 429 invoked by alias); 30 Mar 2004 02:10:12 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 418 invoked from network); 30 Mar 2004 02:10:10 -0000 Received: from unknown (HELO mta6.wss.scd.yahoo.com) (66.218.85.37) by sources.redhat.com with SMTP; 30 Mar 2004 02:10:10 -0000 Received: from specifixinc.com (24.7.123.142) by mta6.wss.scd.yahoo.com (7.0.016) (authenticated as jim@tuliptree.org) id 405C545E004A88DA; Mon, 29 Mar 2004 18:10:03 -0800 Message-ID: <4068D702.2000200@specifixinc.com> Date: Tue, 30 Mar 2004 09:46:00 -0000 From: Jim Wilson User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030716 MIME-Version: 1.0 To: Barry Wealand CC: "Kancler, Cliff" , reed@reedkotler.com, gcc@gcc.gnu.org Subject: Re: Operator overloading in (MIPS) assembly-language References: <405F78DC.6F04DF55@lmco.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg01699.txt.bz2 Barry Wealand wrote: > We've been working with a GNU MIPS cross-compiler / toolset, generating > code for MIPS-like hardware to which we've added some new features. You didn't mention the gcc version. I get worse results with current gcc sources. > (I've added the line numbers for convenience). Everything in this > listing looks perfectly normal except lines 25 through 30. None of > these 6 store instructions serves any purpose at all. Probably new_float is a type that can't be allocated to a floating point register, so it gets allocated to a stack slot. We then generate code that includes reads and writes from/to these stack slots. The reads are fairly easy to optimize away, but the writes are a different problem. This requires complicated alias analysis support which we don't have, so the writes remain. The writes are all to the same stack slot because all of the "new_float f" in all of the inlined method calls got assigned to the same stack slot. In this particular case, it isn't hard to see that the stores are all redundant and could be optimized away, but the general case is very complicated, and difficult to implement. In current sources, I get worse code, probably because the ABI has changed such that new_float as a argument is no longer passed in floating point registers, thus requiring a lot of loads to access the A, B, and C values. -- Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com