public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [tuples] walk_gimple_stmt: handle WCE
@ 2008-03-17 21:27 Aldy Hernandez
  2008-03-17 21:30 ` Diego Novillo
  0 siblings, 1 reply; 3+ messages in thread
From: Aldy Hernandez @ 2008-03-17 21:27 UTC (permalink / raw)
  To: dnovillo, gcc-patches

The following patch handles walking of GIMPLE_WITH_CLEANUP_EXPRs.  It
looks like a minor oversight when we added WCE tuples.

I also collapsed the common OMP code in walk_gimple_stmt.

Diego, we can also collapse GIMPLE_OMP_FOR, but I'm not sure whether
it is semantically safe to walk the PRE_BODY before the OMP_BODY.  Can I
walk the PRE_BODY, and fall through for the GIMPLE_OMP_FOR code?

	* gimple.c (walk_gimple_stmt): Collapse common code.
	Add case for GIMPLE_WITH_CLEANUP_EXPR.

Index: gimple.c
===================================================================
--- gimple.c	(revision 133138)
+++ gimple.c	(working copy)
@@ -1492,16 +1492,13 @@ walk_gimple_stmt (gimple_stmt_iterator *
       break;
 
     case GIMPLE_OMP_CRITICAL:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
-      if (ret)
-	return ret;
-      break;
-
     case GIMPLE_OMP_CONTINUE:
     case GIMPLE_OMP_MASTER:
     case GIMPLE_OMP_ORDERED:
     case GIMPLE_OMP_SECTION:
+    case GIMPLE_OMP_PARALLEL:
+    case GIMPLE_OMP_SECTIONS:
+    case GIMPLE_OMP_SINGLE:
       ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
 	                     wi);
       if (ret)
@@ -1519,23 +1516,9 @@ walk_gimple_stmt (gimple_stmt_iterator *
 	return ret;
       break;
 
-    case GIMPLE_OMP_PARALLEL:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
-      if (ret)
-	return ret;
-      break;
-
-    case GIMPLE_OMP_SECTIONS:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
-      if (ret)
-	return ret;
-      break;
-
-    case GIMPLE_OMP_SINGLE:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
+    case GIMPLE_WITH_CLEANUP_EXPR:
+      ret = walk_gimple_seq (gimple_wce_cleanup (stmt), callback_stmt,
+			     callback_op, wi);
       if (ret)
 	return ret;
       break;

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

* Re: [tuples] walk_gimple_stmt: handle WCE
  2008-03-17 21:27 [tuples] walk_gimple_stmt: handle WCE Aldy Hernandez
@ 2008-03-17 21:30 ` Diego Novillo
  2008-03-18 10:11   ` Aldy Hernandez
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Novillo @ 2008-03-17 21:30 UTC (permalink / raw)
  To: Aldy Hernandez; +Cc: gcc-patches

On Mon, Mar 17, 2008 at 16:55, Aldy Hernandez <aldyh@redhat.com> wrote:
> The following patch handles walking of GIMPLE_WITH_CLEANUP_EXPRs.  It
>  looks like a minor oversight when we added WCE tuples.

Thanks.

>  Diego, we can also collapse GIMPLE_OMP_FOR, but I'm not sure whether
>  it is semantically safe to walk the PRE_BODY before the OMP_BODY.  Can I
>  walk the PRE_BODY, and fall through for the GIMPLE_OMP_FOR code?

Yes, walking the PRE_BODY first makes perfect sense.


Diego.

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

* Re: [tuples] walk_gimple_stmt: handle WCE
  2008-03-17 21:30 ` Diego Novillo
@ 2008-03-18 10:11   ` Aldy Hernandez
  0 siblings, 0 replies; 3+ messages in thread
From: Aldy Hernandez @ 2008-03-18 10:11 UTC (permalink / raw)
  To: Diego Novillo; +Cc: gcc-patches

> Yes, walking the PRE_BODY first makes perfect sense.

Perfect.  Below is the patch I am committing.

	* gimple.c (walk_gimple_stmt): Collapse common code.
	Add case for GIMPLE_WITH_CLEANUP_EXPR.

Index: gimple.c
===================================================================
--- gimple.c	(revision 133138)
+++ gimple.c	(working copy)
@@ -1491,51 +1491,31 @@ walk_gimple_stmt (gimple_stmt_iterator *
 	return ret;
       break;
 
-    case GIMPLE_OMP_CRITICAL:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
+    case GIMPLE_OMP_FOR:
+      ret = walk_gimple_seq (gimple_omp_for_pre_body (stmt), callback_stmt,
+		             callback_op, wi);
       if (ret)
 	return ret;
-      break;
 
+      /* FALL THROUGH.  */
+
+    case GIMPLE_OMP_CRITICAL:
     case GIMPLE_OMP_CONTINUE:
     case GIMPLE_OMP_MASTER:
     case GIMPLE_OMP_ORDERED:
     case GIMPLE_OMP_SECTION:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
-      if (ret)
-	return ret;
-      break;
-
-    case GIMPLE_OMP_FOR:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
-      if (ret)
-	return ret;
-      ret = walk_gimple_seq (gimple_omp_for_pre_body (stmt), callback_stmt,
-		             callback_op, wi);
-      if (ret)
-	return ret;
-      break;
-
     case GIMPLE_OMP_PARALLEL:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
-      if (ret)
-	return ret;
-      break;
-
     case GIMPLE_OMP_SECTIONS:
+    case GIMPLE_OMP_SINGLE:
       ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
 	                     wi);
       if (ret)
 	return ret;
       break;
 
-    case GIMPLE_OMP_SINGLE:
-      ret = walk_gimple_seq (gimple_omp_body (stmt), callback_stmt, callback_op,
-	                     wi);
+    case GIMPLE_WITH_CLEANUP_EXPR:
+      ret = walk_gimple_seq (gimple_wce_cleanup (stmt), callback_stmt,
+			     callback_op, wi);
       if (ret)
 	return ret;
       break;

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

end of thread, other threads:[~2008-03-18 10:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-17 21:27 [tuples] walk_gimple_stmt: handle WCE Aldy Hernandez
2008-03-17 21:30 ` Diego Novillo
2008-03-18 10:11   ` Aldy Hernandez

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).