This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tuples] EH_FILTER and CLEANUP_EXPR bits
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: dnovillo at google dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 18 Oct 2007 11:56:18 -0400
- Subject: [tuples] EH_FILTER and CLEANUP_EXPR bits
Misc C++ fixes. Some needed after Diego's CFG patch, others fix random
stuff.
First, we handle GIMPLE_WITH_CLEANUP_EXPR and GIMPLE_EH_FILTER
throughout.
Second, GIMPLE_CATCH and GIMPLE_EH_FILTER had sequences that were
pointers, when they should have been structures. Fixed.
Lastly, I have documented the EH_FILTER_MUST_NOT_THROW flag needed in
the GIMPLE_EH_FILTER tuple.
Committed to branch.
* gimple.c (gimple_size): Handle GIMPLE_WITH_CLEANUP_EXPR.
* gimple.h (struct gimple_statement_catch): Make handler a structure,
not a pointer.
(struct gimple_statement_eh_filter): Make failure a structure, not a
pointer.
document EH_FILTER_MUST_NOT_THROW subcode flag.
(gimple_catch_handler): Handler is now a struct.
(gimple_catch_set_handler): Same.
(gimple_eh_filter_failure): Failure is now a struct.
(gimple_eh_filter_set_failure): Same.
(gimple_eh_filter_must_not_throw): New.
(gimple_eh_filter_set_must_not_throw): New.
(gsi_next): Update comment.
(gsi_prev): Same.
* tree-cfg.c (verify_types_in_gimple_seq_2): Handle GIMPLE_EH_FILTER.
Index: gimple.c
===================================================================
--- gimple.c (revision 129419)
+++ gimple.c (working copy)
@@ -143,6 +143,8 @@ gimple_size (enum gimple_code code)
return sizeof (struct gimple_statement_omp_sections);
case GIMPLE_OMP_SINGLE:
return sizeof (struct gimple_statement_omp_single);
+ case GIMPLE_WITH_CLEANUP_EXPR:
+ return sizeof (struct gimple_statement_wce);
default:
break;
}
Index: gimple.h
===================================================================
--- gimple.h (revision 129419)
+++ gimple.h (working copy)
@@ -217,7 +217,7 @@ struct gimple_statement_catch GTY(())
{
struct gimple_statement_base gsbase;
tree types;
- gimple_seq handler;
+ struct gimple_sequence handler;
};
@@ -226,10 +226,14 @@ struct gimple_statement_catch GTY(())
struct gimple_statement_eh_filter GTY(())
{
struct gimple_statement_base gsbase;
+
+ /* Subcode: EH_FILTER_MUST_NOT_THROW. A boolean flag analogous to
+ the tree counterpart. */
+
/* Filter types. */
tree types;
/* Failure actions. */
- gimple_seq failure;
+ struct gimple_sequence failure;
};
@@ -1542,7 +1546,7 @@ static inline gimple_seq
gimple_catch_handler (gimple gs)
{
GIMPLE_CHECK (gs, GIMPLE_CATCH);
- return gs->gimple_catch.handler;
+ return &gs->gimple_catch.handler;
}
@@ -1562,7 +1566,7 @@ static inline void
gimple_catch_set_handler (gimple gs, gimple_seq handler)
{
GIMPLE_CHECK (gs, GIMPLE_CATCH);
- gs->gimple_catch.handler = handler;
+ gimple_seq_copy (gimple_catch_handler (gs), handler);
}
@@ -1594,7 +1598,7 @@ static inline gimple_seq
gimple_eh_filter_failure (gimple gs)
{
GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
- return gs->gimple_eh_filter.failure;
+ return &gs->gimple_eh_filter.failure;
}
@@ -1615,9 +1619,27 @@ static inline void
gimple_eh_filter_set_failure (gimple gs, gimple_seq failure)
{
GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
- gs->gimple_eh_filter.failure = failure;
+ gimple_seq_copy (gimple_eh_filter_failure (gs), failure);
+}
+
+/* Return the EH_FILTER_MUST_NOT_THROW flag. */
+static inline bool
+gimple_eh_filter_must_not_throw (gimple gs)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ return (bool) gimple_subcode (gs);
}
+/* Set the EH_FILTER_MUST_NOT_THROW flag. */
+static inline void
+gimple_eh_filter_set_must_not_throw (gimple gs, bool mntp)
+{
+ GIMPLE_CHECK (gs, GIMPLE_EH_FILTER);
+ set_gimple_subcode (gs, (unsigned int) mntp);
+}
+
+
+/* GIMPLE_TRY accessors. */
/* Return the kind of try block represented by GIMPLE_TRY GS. */
@@ -2330,7 +2352,7 @@ gsi_one_before_end_p (gimple_stmt_iterat
return i->stmt == gimple_seq_last (i->seq);
}
-/* Return the next gimple statement in I. */
+/* Advance the iterator to the next gimple statement. */
static inline void
gsi_next (gimple_stmt_iterator *i)
@@ -2345,7 +2367,7 @@ gsi_next (gimple_stmt_iterator *i)
i->stmt = gimple_next (i->stmt);
}
-/* Return the previous gimple statement in I. */
+/* Advance the iterator to the previous gimple statement. */
static inline void
gsi_prev (gimple_stmt_iterator *i)
Index: tree-cfg.c
===================================================================
--- tree-cfg.c (revision 129419)
+++ tree-cfg.c (working copy)
@@ -3854,7 +3854,7 @@ verify_types_in_gimple_seq_2 (gimple_seq
err |= verify_types_in_gimple_seq_2 (gimple_try_cleanup (stmt));
break;
- case EH_FILTER_EXPR:
+ case GIMPLE_EH_FILTER:
err |= verify_types_in_gimple_seq_2
(gimple_eh_filter_failure (stmt));
break;