[df] RFA: artifical defs of global registers for EH, etc.

Kenneth Zadeck zadeck@naturalbridge.com
Sat Jan 26 18:52:00 GMT 2008


Richard Sandiford wrote:
> Kenneth Zadeck <zadeck@naturalbridge.com> writes:
>   
>> your patch is ok on ppc-32 and ia-64.
>>     
>
> Thanks.  As discussed off-list, I decided not to commit it in its
> original form because I no longer needed it for the MIPS lazy-binding
> thing, and because (as Seongbae pointed out) there was still the problem
> with global registers not being defined on entry.
>
> Here's the patch with entry definitions added.  Bootstrapped
> & regression-tested on x86_64-linux-gnu.  Regression-tested on
> mips64-linux-gnu and mipsisa64-elf.  Is this version OK?  If so,
> should it go in now or wait for 4.4?
>
> Richard
>
>
>   

i will retest it today on ppc and ia-64.  Assuming it passes I will give
it the ok for 4.4 but i would like you to get permission from someone
like richi, iant, or mark as to whether it should go into 4.3 now.  We
are now down to 89 regressions and so unless it fixes some particular
regression, they may want you to wait.  But i leave the 4.3/4.4 decision
totally to someone with more experience with release management. 
> gcc/
> 	* df-scan.c (df_bb_refs_collect): Only compute bb_has_eh_pred once.
> 	Create artificial definitions of global registers at the beginning
> 	of non-local goto receivers and exception handlers.
> 	(df_get_entry_block_def_set): Add global registers.
>
> Index: gcc/df-scan.c
> ===================================================================
> --- gcc/df-scan.c	2008-01-24 10:31:16.000000000 +0000
> +++ gcc/df-scan.c	2008-01-24 19:32:50.000000000 +0000
> @@ -3248,6 +3248,8 @@ df_need_static_chain_reg (struct functio
>  static void
>  df_bb_refs_collect (struct df_collection_rec *collection_rec, basic_block bb)
>  {
> +  bool has_eh_pred_p;
> +
>    collection_rec->next_def = 0;
>    collection_rec->next_use = 0;
>    collection_rec->next_eq_use = 0;
> @@ -3264,8 +3266,10 @@ df_bb_refs_collect (struct df_collection
>        return;
>      }
>  
> +  has_eh_pred_p = bb_has_eh_pred (bb);
> +
>  #ifdef EH_RETURN_DATA_REGNO
> -  if (bb_has_eh_pred (bb))
> +  if (has_eh_pred_p)
>      {
>        unsigned int i;
>        /* Mark the registers that will contain data for the handler.  */
> @@ -3280,9 +3284,8 @@ df_bb_refs_collect (struct df_collection
>      }
>  #endif
>  
> -
>  #ifdef EH_USES
> -  if (bb_has_eh_pred (bb))
> +  if (has_eh_pred_p)
>      {
>        unsigned int i;
>        /* This code is putting in an artificial ref for the use at the
> @@ -3303,6 +3306,25 @@ df_bb_refs_collect (struct df_collection
>      }
>  #endif
>  
> +  /* EH unwinding code can in principle assign to global registers,
> +     so the act of throwing an exception may change their values.
> +     Also, paths involving non-local gotos may assign to global
> +     registers that normal paths don't.
> +
> +     Note that global registers are df_invalidated_by_call, so this
> +     code has a second effect: to create a real LR definition of global
> +     registers for EH and ABNORMAL_CALL edges.  The check used here is
> +     intended to be equivalent to, but more efficient than, checking
> +     every edge for (EDGE_ABNORMAL_CALL | EDGE_EH).  */
> +  if (has_eh_pred_p || (bb->flags & BB_NON_LOCAL_GOTO_TARGET))
> +    {
> +      unsigned int i;
> +      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
> +	if (global_regs[i])
> +	  df_ref_record (collection_rec, regno_reg_rtx[i], NULL,
> +			 bb, NULL, DF_REF_REG_DEF, DF_REF_AT_TOP);
> +    }
> +
>    /* Add the hard_frame_pointer if this block is the target of a
>       non-local goto.  */
>    if (bb->flags & BB_NON_LOCAL_GOTO_TARGET)
> @@ -3314,9 +3336,9 @@ df_bb_refs_collect (struct df_collection
>      {
>        bitmap_iterator bi;
>        unsigned int regno;
> -      bitmap au = bb_has_eh_pred (bb) 
> -	? df->eh_block_artificial_uses 
> -	: df->regular_block_artificial_uses;
> +      bitmap au = (has_eh_pred_p
> +		   ? df->eh_block_artificial_uses
> +		   : df->regular_block_artificial_uses);
>  
>        EXECUTE_IF_SET_IN_BITMAP (au, 0, regno, bi)
>  	{
> @@ -3503,6 +3525,8 @@ df_get_entry_block_def_set (bitmap entry
>  #else
>  	bitmap_set_bit (entry_block_defs, i);
>  #endif
> +      if (global_regs[i])
> +	bitmap_set_bit (entry_block_defs, i);
>      }
>        
>    /* Once the prologue has been generated, all of these registers
>   



More information about the Gcc-patches mailing list