This is the mail archive of the gcc@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: df_insn_refs_record's handling of global_regs[]


From: "Seongbae Park (박성배, 朴成培)" <seongbae.park@gmail.com>
Date: Tue, 16 Oct 2007 22:56:49 -0700

> We need to add DEF as well as USE:
> 
> diff -r fd0f94fbe89d gcc/df-scan.c
> --- a/gcc/df-scan.c     Wed Oct 10 03:32:43 2007 +0000
> +++ b/gcc/df-scan.c     Tue Oct 16 22:52:44 2007 -0700
> @@ -3109,8 +3109,13 @@ df_get_call_refs (struct df_collection_r
>       so they are recorded as used.  */
>    for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
>      if (global_regs[i])
> -      df_ref_record (collection_rec, regno_reg_rtx[i],
> -                    NULL, bb, insn, DF_REF_REG_USE, flags);
> +      {
> +        df_ref_record (collection_rec, regno_reg_rtx[i],
> +                      NULL, bb, insn, DF_REF_REG_USE, flags);
> +        df_ref_record (collection_rec, regno_reg_rtx[i],
> +                      NULL, bb, insn, DF_REF_REG_DEF, flags);
> +      }
> +
> 
>    is_sibling_call = SIBLING_CALL_P (insn);
>    EXECUTE_IF_SET_IN_BITMAP (df_invalidated_by_call, 0, ui, bi)
> 
> 
> Then, we'll need to change the df_invalidated_by_call loop
> not to add global_regs[] again (with MAY_CLOBBER bits).

Indeed.

I will do some regression testing of the following patch against
gcc-4.2.x:

--- ./gcc/df-scan.c.ORIG	2007-10-16 02:07:46.000000000 -0700
+++ ./gcc/df-scan.c	2007-10-16 23:00:32.000000000 -0700
@@ -1584,12 +1584,19 @@ df_insn_refs_record (struct dataflow *df
 		 so they are recorded as used.  */
 	      for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
 		if (global_regs[i])
-		  df_uses_record (dflow, &regno_reg_rtx[i],
-				  DF_REF_REG_USE, bb, insn, 
-				  0);
+		  {
+		    df_uses_record (dflow, &regno_reg_rtx[i],
+				    DF_REF_REG_USE, bb, insn, 0);
+		    df_ref_record (dflow, regno_reg_rtx[i], &regno_reg_rtx[i],
+				   bb, insn, DF_REF_REG_DEF, 0, true);
+		  }
+
 	      EXECUTE_IF_SET_IN_BITMAP (df_invalidated_by_call, 0, ui, bi)
-	        df_ref_record (dflow, regno_reg_rtx[ui], &regno_reg_rtx[ui], bb, 
-			       insn, DF_REF_REG_DEF, DF_REF_MAY_CLOBBER, false);
+		{
+		  if (!global_regs[ui])
+		    df_ref_record (dflow, regno_reg_rtx[ui], &regno_reg_rtx[ui], bb, 
+				   insn, DF_REF_REG_DEF, DF_REF_MAY_CLOBBER, false);
+		}
 	    }
 	}
 


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