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]

[tuples] C++: gimplify TRY_BLOCK and HANDLER, and EH_SPEC_BLOCK


Hi Jason.  Hi folks.

This patch converts genericize_{try,catch,eh_spec}_block to GENERIC so
the gimplifier can do its thaaang.  The idea is that once you go into
tuples, you must go all the way.  So we either put things in GENERIC
(trees) or we gimplify to tuples entirely.

In the case of TRY_BLOCK and CATCH (and probably EH_SPEC_BLOCK as well),
it is just as easy to do the full gimplification from cp-gimplify.c
without bothering the gimplifier proper.

What is the recommended approach... should we gimplify entirely in the
C++ side, if possible and trivial, or should we convert to GENERIC and
let the gimplifier work?  I don't want to start a bad precedent if the
initial design was to keep things in GENERIC and pass it off, but cherry
picking these easy cases seem like a good way to go.

Committing to branch, so I don't overly annoy Diego with a plethora of
conflicts, but I'm more than happy to change the approach if you want.

Let me know.

	* cp-gimplify.c (genericize_try_block): Enable and do not call
	gimplify_stmt.
	(genericize_catch_block): Same.
	(genericize_eh_spec_block): Same.
	Rename gimple_build_eh_filter_tree to build_gimple_eh_filter_tree.
	(cp_gimplify_expr): Enable TRY_BLOCK, HANDLER, and EH_SPEC_BLOCK.

Index: cp/cp-gimplify.c
===================================================================
--- cp/cp-gimplify.c	(revision 129442)
+++ cp/cp-gimplify.c	(working copy)
@@ -108,57 +108,39 @@ build_bc_goto (enum bc_t bc)
 
 /* Genericize a TRY_BLOCK.  */
 
-/* FIXME tuples */
-#if 0
 static void
 genericize_try_block (tree *stmt_p)
 {
   tree body = TRY_STMTS (*stmt_p);
   tree cleanup = TRY_HANDLERS (*stmt_p);
 
-  gimplify_stmt (&body);
-
-  if (CLEANUP_P (*stmt_p))
-    /* A cleanup is an expression, so it doesn't need to be genericized.  */;
-  else
-    gimplify_stmt (&cleanup);
-
   *stmt_p = build2 (TRY_CATCH_EXPR, void_type_node, body, cleanup);
 }
-#endif
 
 /* Genericize a HANDLER by converting to a CATCH_EXPR.  */
 
-/* FIXME tuples */
-#if 0
 static void
 genericize_catch_block (tree *stmt_p)
 {
   tree type = HANDLER_TYPE (*stmt_p);
   tree body = HANDLER_BODY (*stmt_p);
 
-  gimplify_stmt (&body);
-
   /* FIXME should the caught type go in TREE_TYPE?  */
   *stmt_p = build2 (CATCH_EXPR, void_type_node, type, body);
 }
-#endif
 
 /* Genericize an EH_SPEC_BLOCK by converting it to a
    TRY_CATCH_EXPR/EH_FILTER_EXPR pair.  */
 
-#if 0
 static void
 genericize_eh_spec_block (tree *stmt_p)
 {
   tree body = EH_SPEC_STMTS (*stmt_p);
   tree allowed = EH_SPEC_RAISES (*stmt_p);
   tree failure = build_call_n (call_unexpected_node, 1, build_exc_ptr ());
-  gimplify_stmt (&body);
 
-  *stmt_p = gimple_build_eh_filter_tree (body, allowed, failure);
+  *stmt_p = build_gimple_eh_filter_tree (body, allowed, failure);
 }
-#endif
 
 /* Genericize an IF_STMT by turning it into a COND_EXPR.  */
 
@@ -527,23 +509,17 @@ cp_gimplify_expr (tree *expr_p, gimple_s
       break;
 
     case TRY_BLOCK:
-      /* FIXME tuples
       genericize_try_block (expr_p);
-      */
       ret = GS_OK;
       break;
 
     case HANDLER:
-      /* FIXME tuples
       genericize_catch_block (expr_p);
-      */
       ret = GS_OK;
       break;
 
     case EH_SPEC_BLOCK:
-      /* FIXME tuples
       genericize_eh_spec_block (expr_p);
-      */
       ret = GS_OK;
       break;
 


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