From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21240 invoked by alias); 4 Jun 2002 16:12:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 21128 invoked from network); 4 Jun 2002 16:11:56 -0000 Received: from unknown (HELO atrey.karlin.mff.cuni.cz) (195.113.31.123) by sources.redhat.com with SMTP; 4 Jun 2002 16:11:56 -0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 4018) id 14CB84FC7F; Tue, 4 Jun 2002 18:11:58 +0200 (CEST) Date: Tue, 04 Jun 2002 09:12:00 -0000 From: Jan Hubicka To: John David Anglin Cc: Jan Hubicka , law@redhat.com, gcc-patches@gcc.gnu.org, rth@redhat.com Subject: Re: [PATCH] Jump bypassing and improved cprop (take 2) Message-ID: <20020604161157.GO29372@atrey.karlin.mff.cuni.cz> References: <20020604134515.GC29372@atrey.karlin.mff.cuni.cz> <200206041555.g54FtfTZ014352@hiauly1.hia.nrc.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200206041555.g54FtfTZ014352@hiauly1.hia.nrc.ca> User-Agent: Mutt/1.3.28i X-SW-Source: 2002-06/txt/msg00309.txt.bz2 > > > > The above error occurs on the following line: > > > > > > > > total_code_bytes += INSN_ADDRESSES (INSN_UID (get_last_insn ())); > > > > > > > > INSN_UID (get_last_insn ()) is 229. Something has messed up the size of > > > > the array insn_addresses. This could be the above mentioned patch or some > > > The code like this can be fixed easilly by finding first/last nonnote > > instruction in the chain. > > I am testing the enclosed patch per your suggestion. > > > I am not sure whether we want to fix all incarnations in the port > > dependent code or find way to iniitialize INSN_ADDRESS that can be done > > eighter by moving the re-emit code before shorten_branches that has the > > dwawback that existence/nonexistence of notes may result in different > > code output on -g/non-g compilation or simply add the gaps into > > INSN_ADDRESS array, that is also not so fortunate due to resizing > > issues. > > There only appears to be a couple of other ports with similar code to > determine the size of a function. Most other uses of INSN_ADDRESSES > are probably ok. Possibly, the function "get_last_nonnote_insn" could > be put in emit-rtl.c. Then, it wouldn't be too onerous to change all > the ports. Yes, this looks like sensible approach to me. Thanks for fixing it! Honza > > Dave > -- > J. David Anglin dave.anglin@nrc.ca > National Research Council of Canada (613) 990-0752 (FAX: 952-6605) > > 2002-06-04 John David Anglin > > * pa.c (get_last_nonnote_insn): New function. > (pa_output_function_prologue): Use it. > > Index: config/pa/pa.c > =================================================================== > RCS file: /cvsroot/gcc/gcc/gcc/config/pa/pa.c,v > retrieving revision 1.167 > diff -u -3 -p -r1.167 pa.c > --- config/pa/pa.c 31 May 2002 18:01:13 -0000 1.167 > +++ config/pa/pa.c 4 Jun 2002 15:35:15 -0000 > @@ -95,6 +95,7 @@ hppa_fpstore_bypass_p (out_insn, in_insn > #endif > #endif > > +static rtx get_last_nonnote_insn PARAMS((void)); > static inline rtx force_mode PARAMS ((enum machine_mode, rtx)); > static void pa_combine_instructions PARAMS ((rtx)); > static int pa_can_combine_p PARAMS ((rtx, rtx, rtx, int, rtx, rtx, rtx)); > @@ -3116,6 +3117,24 @@ compute_frame_size (size, fregs_live) > return (fsize + STACK_BOUNDARY - 1) & ~(STACK_BOUNDARY - 1); > } > > +/* Return the last nonnote insn emitted in current sequence or current > + function. This routine looks inside SEQUENCEs. */ > + > +static rtx > +get_last_nonnote_insn () > +{ > + rtx insn = get_last_insn (); > + > + while (insn) > + { > + insn = previous_insn (insn); > + if (insn == 0 || GET_CODE (insn) != NOTE) > + break; > + } > + > + return insn; > +} > + > /* Generate the assembly code for function entry. FILE is a stdio > stream to output the code to. SIZE is an int: how many units of > temporary storage to allocate. > @@ -3182,7 +3201,7 @@ pa_output_function_prologue (file, size) > { > unsigned int old_total = total_code_bytes; > > - total_code_bytes += INSN_ADDRESSES (INSN_UID (get_last_insn ())); > + total_code_bytes += INSN_ADDRESSES (INSN_UID (get_last_nonnote_insn ())); > total_code_bytes += FUNCTION_BOUNDARY / BITS_PER_UNIT; > > /* Be prepared to handle overflows. */