public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][dataflow] Clean up the treatment of def
@ 2007-07-30 18:31 Seongbae Park (박성배, 朴成培)
  2007-07-30 19:15 ` Kenneth Zadeck
  0 siblings, 1 reply; 2+ messages in thread
From: Seongbae Park (박성배, 朴成培) @ 2007-07-30 18:31 UTC (permalink / raw)
  To: gcc-patches, Kenneth Zadeck, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

Hi,

This patch simplifies the treatment of def.
I noticed this code while reviewing recent patches from Ken Zadeck,
that this code is unnecessary because we already take care of
the same condition during the scanning.

Another minor change is to remove the bail-out code
if the number of blocks of a function exceeds 250 - this was necessary
during the development of dataflow branch, due to some slow path
that are all addressed already.

The patch has been bootstrapped and regtested clean on x86-64, SPARC and IA64.
Ok for mainline ?

ChangeLog:

2007-07-30  Seongbae Park <seongbae.park@gmail.com>

        * df-scan.c (df_scan_verify): Remove artificial limit on
        the number of blocks for verification.
        * df-problems.c (df_lr_bb_local_compute, df_simulate_find_defs,
        df_simulate_defs): Avoid unnecessary insn checking for defs.

-- 
#pragma ident "Seongbae Park, compiler, http://seongbae.blogspot.com"

[-- Attachment #2: df-def-simplification-1.patch --]
[-- Type: text/x-patch, Size: 6268 bytes --]

Index: gcc/df-scan.c
===================================================================
--- gcc/df-scan.c	(revision 127065)
+++ gcc/df-scan.c	(working copy)
@@ -4265,12 +4265,6 @@ df_scan_verify (void)
   if (!df)
     return;
 
-  /* This is a hack, but a necessary one.  If you do not do this,
-     insn_attrtab can never be compiled in a bootstrap.  This
-     verification is just too expensive.  */
-  if (n_basic_blocks > 250)
-    return;
-
   /* Verification is a 4 step process. */
 
   /* (1) All of the refs are marked by going thru the reg chains.  */
Index: gcc/df-problems.c
===================================================================
--- gcc/df-problems.c	(revision 127065)
+++ gcc/df-problems.c	(working copy)
@@ -1389,53 +1389,16 @@ df_lr_bb_local_compute (unsigned int bb_
       if (!INSN_P (insn))
 	continue;	
 
-      if (CALL_P (insn))
+      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
 	{
-	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
+	  struct df_ref *def = *def_rec;
+	  /* If the def is to only part of the reg, it does
+	     not kill the other defs that reach here.  */
+	  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
 	    {
-	      struct df_ref *def = *def_rec;
 	      unsigned int dregno = DF_REF_REGNO (def);
-	      
-	      if (DF_REF_FLAGS (def) & DF_REF_MUST_CLOBBER)
-		{
-		  if (dregno >= FIRST_PSEUDO_REGISTER
-		      || !(SIBLING_CALL_P (insn)
-			   && bitmap_bit_p (df->exit_block_uses, dregno)
-			   && !refers_to_regno_p (dregno, dregno+1,
-						  current_function_return_rtx,
-						  (rtx *)0)))
-		    {
-		      /* If the def is to only part of the reg, it does
-			 not kill the other defs that reach here.  */
-		      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-			{
-			  bitmap_set_bit (bb_info->def, dregno);
-			  bitmap_clear_bit (bb_info->use, dregno);
-			}
-		    }
-		}
-	      else
-		/* This is the return value.  */
-		if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-		  {
-		    bitmap_set_bit (bb_info->def, dregno);
-		    bitmap_clear_bit (bb_info->use, dregno);
-		  }
-	    }
-	}
-      else
-	{
-	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
-	    {
-	      struct df_ref *def = *def_rec;
-	      /* If the def is to only part of the reg, it does
-		     not kill the other defs that reach here.  */
-	      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-		{
-		  unsigned int dregno = DF_REF_REGNO (def);
-		  bitmap_set_bit (bb_info->def, dregno);
-		  bitmap_clear_bit (bb_info->use, dregno);
-		}
+	      bitmap_set_bit (bb_info->def, dregno);
+	      bitmap_clear_bit (bb_info->use, dregno);
 	    }
 	}
 
@@ -4218,44 +4181,13 @@ df_simulate_find_defs (rtx insn, bitmap 
   struct df_ref **def_rec;
   unsigned int uid = INSN_UID (insn);
 
-  if (CALL_P (insn))
+  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
     {
-      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
-	{
-	  struct df_ref *def = *def_rec;
-	  unsigned int dregno = DF_REF_REGNO (def);
-	  
-	  if (DF_REF_FLAGS (def) & DF_REF_MUST_CLOBBER)
-	    {
-	      if (dregno >= FIRST_PSEUDO_REGISTER
-		  || !(SIBLING_CALL_P (insn)
-		       && bitmap_bit_p (df->exit_block_uses, dregno)
-		       && !refers_to_regno_p (dregno, dregno+1,
-					      current_function_return_rtx,
-					      (rtx *)0)))
-		{
-		  /* If the def is to only part of the reg, it does
-		     not kill the other defs that reach here.  */
-		  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-		    bitmap_set_bit (defs, dregno);
-		}
-	    }
-	  else
-	    /* This is the return value.  */
-	    if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-	      bitmap_set_bit (defs, dregno);
-	}
-    }
-  else
-    {
-      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
-	{
-	  struct df_ref *def = *def_rec;
-	  /* If the def is to only part of the reg, it does
-	     not kill the other defs that reach here.  */
-	  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-	    bitmap_set_bit (defs, DF_REF_REGNO (def));
-	}
+      struct df_ref *def = *def_rec;
+      /* If the def is to only part of the reg, it does
+	 not kill the other defs that reach here.  */
+      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
+	bitmap_set_bit (defs, DF_REF_REGNO (def));
     }
 }
 
@@ -4268,46 +4200,15 @@ df_simulate_defs (rtx insn, bitmap live)
   struct df_ref **def_rec;
   unsigned int uid = INSN_UID (insn);
 
-  if (CALL_P (insn))
+  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
     {
-      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
-	{
-	  struct df_ref *def = *def_rec;
-	  unsigned int dregno = DF_REF_REGNO (def);
-	  
-	  if (DF_REF_FLAGS (def) & DF_REF_MUST_CLOBBER)
-	    {
-	      if (dregno >= FIRST_PSEUDO_REGISTER
-		  || !(SIBLING_CALL_P (insn)
-		       && bitmap_bit_p (df->exit_block_uses, dregno)
-		       && !refers_to_regno_p (dregno, dregno+1,
-					      current_function_return_rtx,
-					      (rtx *)0)))
-		{
-		  /* If the def is to only part of the reg, it does
-		     not kill the other defs that reach here.  */
-		  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-		    bitmap_clear_bit (live, dregno);
-		}
-	    }
-	  else
-	    /* This is the return value.  */
-	    if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-	      bitmap_clear_bit (live, dregno);
-	}
-    }
-  else
-    {
-      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
-	{
-	  struct df_ref *def = *def_rec;
-	  unsigned int dregno = DF_REF_REGNO (def);
-  
-	  /* If the def is to only part of the reg, it does
-	     not kill the other defs that reach here.  */
-	  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
-	    bitmap_clear_bit (live, dregno);
-	}
+      struct df_ref *def = *def_rec;
+      unsigned int dregno = DF_REF_REGNO (def);
+
+      /* If the def is to only part of the reg, it does
+	 not kill the other defs that reach here.  */
+      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
+	bitmap_clear_bit (live, dregno);
     }
 }  
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH][dataflow] Clean up the treatment of def
  2007-07-30 18:31 [PATCH][dataflow] Clean up the treatment of def Seongbae Park (박성배, 朴成培)
@ 2007-07-30 19:15 ` Kenneth Zadeck
  0 siblings, 0 replies; 2+ messages in thread
From: Kenneth Zadeck @ 2007-07-30 19:15 UTC (permalink / raw)
  To: "Seongbae Park (???, ???)"; +Cc: gcc-patches, Paolo Bonzini

Seongbae Park (???, ???) wrote:
> Hi,
>
> This patch simplifies the treatment of def.
> I noticed this code while reviewing recent patches from Ken Zadeck,
> that this code is unnecessary because we already take care of
> the same condition during the scanning.
>
> Another minor change is to remove the bail-out code
> if the number of blocks of a function exceeds 250 - this was necessary
> during the development of dataflow branch, due to some slow path
> that are all addressed already.
>
> The patch has been bootstrapped and regtested clean on x86-64, SPARC and IA64.
> Ok for mainline ?
>
>   
This is fine. This is very old code you are removing, code that was
there before danny and I started hacking on df.

Kenny

> ChangeLog:
>
> 2007-07-30  Seongbae Park <seongbae.park@gmail.com>
>
>         * df-scan.c (df_scan_verify): Remove artificial limit on
>         the number of blocks for verification.
>         * df-problems.c (df_lr_bb_local_compute, df_simulate_find_defs,
>         df_simulate_defs): Avoid unnecessary insn checking for defs.
>
>   
> ------------------------------------------------------------------------
>
> Index: gcc/df-scan.c
> ===================================================================
> --- gcc/df-scan.c	(revision 127065)
> +++ gcc/df-scan.c	(working copy)
> @@ -4265,12 +4265,6 @@ df_scan_verify (void)
>    if (!df)
>      return;
>  
> -  /* This is a hack, but a necessary one.  If you do not do this,
> -     insn_attrtab can never be compiled in a bootstrap.  This
> -     verification is just too expensive.  */
> -  if (n_basic_blocks > 250)
> -    return;
> -
>    /* Verification is a 4 step process. */
>  
>    /* (1) All of the refs are marked by going thru the reg chains.  */
> Index: gcc/df-problems.c
> ===================================================================
> --- gcc/df-problems.c	(revision 127065)
> +++ gcc/df-problems.c	(working copy)
> @@ -1389,53 +1389,16 @@ df_lr_bb_local_compute (unsigned int bb_
>        if (!INSN_P (insn))
>  	continue;	
>  
> -      if (CALL_P (insn))
> +      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
>  	{
> -	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
> +	  struct df_ref *def = *def_rec;
> +	  /* If the def is to only part of the reg, it does
> +	     not kill the other defs that reach here.  */
> +	  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
>  	    {
> -	      struct df_ref *def = *def_rec;
>  	      unsigned int dregno = DF_REF_REGNO (def);
> -	      
> -	      if (DF_REF_FLAGS (def) & DF_REF_MUST_CLOBBER)
> -		{
> -		  if (dregno >= FIRST_PSEUDO_REGISTER
> -		      || !(SIBLING_CALL_P (insn)
> -			   && bitmap_bit_p (df->exit_block_uses, dregno)
> -			   && !refers_to_regno_p (dregno, dregno+1,
> -						  current_function_return_rtx,
> -						  (rtx *)0)))
> -		    {
> -		      /* If the def is to only part of the reg, it does
> -			 not kill the other defs that reach here.  */
> -		      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -			{
> -			  bitmap_set_bit (bb_info->def, dregno);
> -			  bitmap_clear_bit (bb_info->use, dregno);
> -			}
> -		    }
> -		}
> -	      else
> -		/* This is the return value.  */
> -		if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -		  {
> -		    bitmap_set_bit (bb_info->def, dregno);
> -		    bitmap_clear_bit (bb_info->use, dregno);
> -		  }
> -	    }
> -	}
> -      else
> -	{
> -	  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
> -	    {
> -	      struct df_ref *def = *def_rec;
> -	      /* If the def is to only part of the reg, it does
> -		     not kill the other defs that reach here.  */
> -	      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -		{
> -		  unsigned int dregno = DF_REF_REGNO (def);
> -		  bitmap_set_bit (bb_info->def, dregno);
> -		  bitmap_clear_bit (bb_info->use, dregno);
> -		}
> +	      bitmap_set_bit (bb_info->def, dregno);
> +	      bitmap_clear_bit (bb_info->use, dregno);
>  	    }
>  	}
>  
> @@ -4218,44 +4181,13 @@ df_simulate_find_defs (rtx insn, bitmap 
>    struct df_ref **def_rec;
>    unsigned int uid = INSN_UID (insn);
>  
> -  if (CALL_P (insn))
> +  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
>      {
> -      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
> -	{
> -	  struct df_ref *def = *def_rec;
> -	  unsigned int dregno = DF_REF_REGNO (def);
> -	  
> -	  if (DF_REF_FLAGS (def) & DF_REF_MUST_CLOBBER)
> -	    {
> -	      if (dregno >= FIRST_PSEUDO_REGISTER
> -		  || !(SIBLING_CALL_P (insn)
> -		       && bitmap_bit_p (df->exit_block_uses, dregno)
> -		       && !refers_to_regno_p (dregno, dregno+1,
> -					      current_function_return_rtx,
> -					      (rtx *)0)))
> -		{
> -		  /* If the def is to only part of the reg, it does
> -		     not kill the other defs that reach here.  */
> -		  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -		    bitmap_set_bit (defs, dregno);
> -		}
> -	    }
> -	  else
> -	    /* This is the return value.  */
> -	    if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -	      bitmap_set_bit (defs, dregno);
> -	}
> -    }
> -  else
> -    {
> -      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
> -	{
> -	  struct df_ref *def = *def_rec;
> -	  /* If the def is to only part of the reg, it does
> -	     not kill the other defs that reach here.  */
> -	  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -	    bitmap_set_bit (defs, DF_REF_REGNO (def));
> -	}
> +      struct df_ref *def = *def_rec;
> +      /* If the def is to only part of the reg, it does
> +	 not kill the other defs that reach here.  */
> +      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> +	bitmap_set_bit (defs, DF_REF_REGNO (def));
>      }
>  }
>  
> @@ -4268,46 +4200,15 @@ df_simulate_defs (rtx insn, bitmap live)
>    struct df_ref **def_rec;
>    unsigned int uid = INSN_UID (insn);
>  
> -  if (CALL_P (insn))
> +  for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
>      {
> -      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
> -	{
> -	  struct df_ref *def = *def_rec;
> -	  unsigned int dregno = DF_REF_REGNO (def);
> -	  
> -	  if (DF_REF_FLAGS (def) & DF_REF_MUST_CLOBBER)
> -	    {
> -	      if (dregno >= FIRST_PSEUDO_REGISTER
> -		  || !(SIBLING_CALL_P (insn)
> -		       && bitmap_bit_p (df->exit_block_uses, dregno)
> -		       && !refers_to_regno_p (dregno, dregno+1,
> -					      current_function_return_rtx,
> -					      (rtx *)0)))
> -		{
> -		  /* If the def is to only part of the reg, it does
> -		     not kill the other defs that reach here.  */
> -		  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -		    bitmap_clear_bit (live, dregno);
> -		}
> -	    }
> -	  else
> -	    /* This is the return value.  */
> -	    if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -	      bitmap_clear_bit (live, dregno);
> -	}
> -    }
> -  else
> -    {
> -      for (def_rec = DF_INSN_UID_DEFS (uid); *def_rec; def_rec++)
> -	{
> -	  struct df_ref *def = *def_rec;
> -	  unsigned int dregno = DF_REF_REGNO (def);
> -  
> -	  /* If the def is to only part of the reg, it does
> -	     not kill the other defs that reach here.  */
> -	  if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> -	    bitmap_clear_bit (live, dregno);
> -	}
> +      struct df_ref *def = *def_rec;
> +      unsigned int dregno = DF_REF_REGNO (def);
> +
> +      /* If the def is to only part of the reg, it does
> +	 not kill the other defs that reach here.  */
> +      if (!(DF_REF_FLAGS (def) & (DF_REF_PARTIAL | DF_REF_CONDITIONAL)))
> +	bitmap_clear_bit (live, dregno);
>      }
>  }  
>  
>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-30 19:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-30 18:31 [PATCH][dataflow] Clean up the treatment of def Seongbae Park (박성배, 朴成培)
2007-07-30 19:15 ` Kenneth Zadeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).