This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

Re: [PATCH] Jump bypassing and improved cprop (take 2)


> > >  > 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  <dave@hiauly1.hia.nrc.ca>
> 
> 	* 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.  */


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