This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gimple-classes, committed 09/10] Make remaining gimple_eh_filter_ accessors typesafe
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: David Malcolm <dmalcolm at redhat dot com>
- Date: Wed, 29 Oct 2014 14:47:59 -0400
- Subject: [gimple-classes, committed 09/10] Make remaining gimple_eh_filter_ accessors typesafe
- Authentication-results: sourceware.org; auth=none
- References: <1414608480-32461-1-git-send-email-dmalcolm at redhat dot com>
gcc/ChangeLog.gimple-classes:
* gimple.h (gimple_eh_filter_types): Strengthen param from
const_gimple to const geh_filter *.
(gimple_eh_filter_types_ptr): Strengthen param from gimple to
geh_filter *.
(gimple_eh_filter_failure_ptr): Likewise.
(gimple_eh_filter_failure): Likewise.
* gimple-low.c (lower_try_catch): Add a checked cast.
(gimple_try_catch_may_fallthru): Likewise.
* gimple-walk.c (walk_gimple_op): Likewise.
(walk_gimple_stmt): Likewise.
* omp-low.c (lower_omp_1): Likewise.
* tree-cfg.c (verify_gimple_in_seq_2): Likewise.
(do_warn_unused_result): Likewise.
* tree-eh.c (collect_finally_tree): Likewise.
(replace_goto_queue_1): Likewise.
(lower_eh_filter): Strengthen local "inner" from gimple to
geh_filter * via a checked cast.
(refactor_eh_r): Add a checked cast.
* tree-inline.c (remap_gimple_stmt): Within case
GIMPLE_EH_FILTER, introduce local "filter_stmt" via a checked cast
and use in place of "stmt".
(estimate_num_insns): Add checked cast.
---
gcc/ChangeLog.gimple-classes | 26 ++++++++++++++++++++++++++
gcc/gimple-low.c | 7 +++++--
gcc/gimple-walk.c | 9 +++++----
gcc/gimple.h | 18 ++++++------------
gcc/omp-low.c | 3 ++-
gcc/tree-cfg.c | 6 ++++--
gcc/tree-eh.c | 15 ++++++++++-----
gcc/tree-inline.c | 12 +++++++++---
8 files changed, 67 insertions(+), 29 deletions(-)
diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e8001f4..07c12cd 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,31 @@
2014-10-29 David Malcolm <dmalcolm@redhat.com>
+ * gimple.h (gimple_eh_filter_types): Strengthen param from
+ const_gimple to const geh_filter *.
+ (gimple_eh_filter_types_ptr): Strengthen param from gimple to
+ geh_filter *.
+ (gimple_eh_filter_failure_ptr): Likewise.
+ (gimple_eh_filter_failure): Likewise.
+
+ * gimple-low.c (lower_try_catch): Add a checked cast.
+ (gimple_try_catch_may_fallthru): Likewise.
+ * gimple-walk.c (walk_gimple_op): Likewise.
+ (walk_gimple_stmt): Likewise.
+ * omp-low.c (lower_omp_1): Likewise.
+ * tree-cfg.c (verify_gimple_in_seq_2): Likewise.
+ (do_warn_unused_result): Likewise.
+ * tree-eh.c (collect_finally_tree): Likewise.
+ (replace_goto_queue_1): Likewise.
+ (lower_eh_filter): Strengthen local "inner" from gimple to
+ geh_filter * via a checked cast.
+ (refactor_eh_r): Add a checked cast.
+ * tree-inline.c (remap_gimple_stmt): Within case
+ GIMPLE_EH_FILTER, introduce local "filter_stmt" via a checked cast
+ and use in place of "stmt".
+ (estimate_num_insns): Add checked cast.
+
+2014-10-29 David Malcolm <dmalcolm@redhat.com>
+
* gimple.h (gimple_omp_parallel_combined_p): Strengthen param from
const_gimple to const gomp_parallel *.
(gimple_omp_parallel_clauses): Likewise.
diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c
index 0aec000..a30fae5 100644
--- a/gcc/gimple-low.c
+++ b/gcc/gimple-low.c
@@ -485,7 +485,9 @@ lower_try_catch (gimple_stmt_iterator *gsi, struct lower_data *data)
so we just ignore EH_FILTER_TYPES and assume that we might
throw an exception which doesn't match. */
data->cannot_fallthru = false;
- lower_sequence (gimple_eh_filter_failure_ptr (gsi_stmt (i)), data);
+ lower_sequence (gimple_eh_filter_failure_ptr (
+ as_a <geh_filter *> (gsi_stmt (i))),
+ data);
if (!data->cannot_fallthru)
cannot_fallthru = false;
break;
@@ -546,7 +548,8 @@ gimple_try_catch_may_fallthru (gtry *stmt)
will throw an exception which matches EH_FILTER_TYPES or not,
so we just ignore EH_FILTER_TYPES and assume that we might
throw an exception which doesn't match. */
- return gimple_seq_may_fallthru (gimple_eh_filter_failure (gsi_stmt (i)));
+ return gimple_seq_may_fallthru (gimple_eh_filter_failure (
+ as_a <geh_filter *> (gsi_stmt (i))));
default:
/* This case represents statements to be executed when an
diff --git a/gcc/gimple-walk.c b/gcc/gimple-walk.c
index 1ba48c1..767e584 100644
--- a/gcc/gimple-walk.c
+++ b/gcc/gimple-walk.c
@@ -293,8 +293,8 @@ walk_gimple_op (gimple stmt, walk_tree_fn callback_op,
break;
case GIMPLE_EH_FILTER:
- ret = walk_tree (gimple_eh_filter_types_ptr (stmt), callback_op, wi,
- pset);
+ ret = walk_tree (gimple_eh_filter_types_ptr (as_a <geh_filter *> (stmt)),
+ callback_op, wi, pset);
if (ret)
return ret;
break;
@@ -589,8 +589,9 @@ walk_gimple_stmt (gimple_stmt_iterator *gsi, walk_stmt_fn callback_stmt,
break;
case GIMPLE_EH_FILTER:
- ret = walk_gimple_seq_mod (gimple_eh_filter_failure_ptr (stmt), callback_stmt,
- callback_op, wi);
+ ret = walk_gimple_seq_mod (gimple_eh_filter_failure_ptr (
+ as_a <geh_filter *> (stmt)),
+ callback_stmt, callback_op, wi);
if (ret)
return wi->callback_result;
break;
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 4e86476..0b09165 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -3535,25 +3535,21 @@ gimple_catch_set_handler (gcatch *catch_stmt, gimple_seq handler)
}
-/* Return the types handled by GIMPLE_EH_FILTER statement GS. */
+/* Return the types handled by GIMPLE_EH_FILTER statement EH_FILTER_STMT. */
static inline tree
-gimple_eh_filter_types (const_gimple gs)
+gimple_eh_filter_types (const geh_filter *eh_filter_stmt)
{
- const geh_filter *eh_filter_stmt =
- as_a <const geh_filter *> (gs);
return eh_filter_stmt->types;
}
/* Return a pointer to the types handled by GIMPLE_EH_FILTER statement
- GS. */
+ EH_FILTER_STMT. */
static inline tree *
-gimple_eh_filter_types_ptr (gimple gs)
+gimple_eh_filter_types_ptr (geh_filter *eh_filter_stmt)
{
- geh_filter *eh_filter_stmt =
- as_a <geh_filter *> (gs);
return &eh_filter_stmt->types;
}
@@ -3562,10 +3558,8 @@ gimple_eh_filter_types_ptr (gimple gs)
GIMPLE_EH_FILTER statement fails. */
static inline gimple_seq *
-gimple_eh_filter_failure_ptr (gimple gs)
+gimple_eh_filter_failure_ptr (geh_filter *eh_filter_stmt)
{
- geh_filter *eh_filter_stmt =
- as_a <geh_filter *> (gs);
return &eh_filter_stmt->failure;
}
@@ -3574,7 +3568,7 @@ gimple_eh_filter_failure_ptr (gimple gs)
statement fails. */
static inline gimple_seq
-gimple_eh_filter_failure (gimple gs)
+gimple_eh_filter_failure (geh_filter *gs)
{
return *gimple_eh_filter_failure_ptr (gs);
}
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 6e0db88..b411e64 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -10548,7 +10548,8 @@ lower_omp_1 (gimple_stmt_iterator *gsi_p, omp_context *ctx)
lower_omp (gimple_catch_handler_ptr (as_a <gcatch *> (stmt)), ctx);
break;
case GIMPLE_EH_FILTER:
- lower_omp (gimple_eh_filter_failure_ptr (stmt), ctx);
+ lower_omp (gimple_eh_filter_failure_ptr (as_a <geh_filter *> (stmt)),
+ ctx);
break;
case GIMPLE_TRY:
{
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index ee3432d..b0df8b6 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -4688,7 +4688,8 @@ verify_gimple_in_seq_2 (gimple_seq stmts)
break;
case GIMPLE_EH_FILTER:
- err |= verify_gimple_in_seq_2 (gimple_eh_filter_failure (stmt));
+ err |= verify_gimple_in_seq_2 (gimple_eh_filter_failure (
+ as_a <geh_filter *> (stmt)));
break;
case GIMPLE_EH_ELSE:
@@ -8438,7 +8439,8 @@ do_warn_unused_result (gimple_seq seq)
as_a <gcatch *> (g)));
break;
case GIMPLE_EH_FILTER:
- do_warn_unused_result (gimple_eh_filter_failure (g));
+ do_warn_unused_result (gimple_eh_filter_failure (
+ as_a <geh_filter *> (g)));
break;
case GIMPLE_CALL:
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 77fb9a2..4974051 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -283,7 +283,9 @@ collect_finally_tree (gimple stmt, gtry *region)
break;
case GIMPLE_EH_FILTER:
- collect_finally_tree_1 (gimple_eh_filter_failure (stmt), region);
+ collect_finally_tree_1 (gimple_eh_filter_failure (
+ as_a <geh_filter *> (stmt)),
+ region);
break;
case GIMPLE_EH_ELSE:
@@ -546,7 +548,9 @@ replace_goto_queue_1 (gimple stmt, struct leh_tf_state *tf,
tf);
break;
case GIMPLE_EH_FILTER:
- replace_goto_queue_stmt_list (gimple_eh_filter_failure_ptr (stmt), tf);
+ replace_goto_queue_stmt_list (gimple_eh_filter_failure_ptr (
+ as_a <geh_filter *> (stmt)),
+ tf);
break;
case GIMPLE_EH_ELSE:
{
@@ -1849,10 +1853,11 @@ lower_eh_filter (struct leh_state *state, gtry *tp)
{
struct leh_state this_state = *state;
eh_region this_region = NULL;
- gimple inner, x;
+ geh_filter *inner;
+ gimple x;
gimple_seq new_seq;
- inner = gimple_seq_first_stmt (gimple_try_cleanup (tp));
+ inner = as_a <geh_filter *> (gimple_seq_first_stmt (gimple_try_cleanup (tp)));
if (flag_exceptions)
{
@@ -3109,7 +3114,7 @@ refactor_eh_r (gimple_seq seq)
refactor_eh_r (gimple_catch_handler (as_a <gcatch *> (one)));
break;
case GIMPLE_EH_FILTER:
- refactor_eh_r (gimple_eh_filter_failure (one));
+ refactor_eh_r (gimple_eh_filter_failure (as_a <geh_filter *> (one)));
break;
case GIMPLE_EH_ELSE:
{
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index eceed15..9cd25c6 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1354,8 +1354,12 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
break;
case GIMPLE_EH_FILTER:
- s1 = remap_gimple_seq (gimple_eh_filter_failure (stmt), id);
- copy = gimple_build_eh_filter (gimple_eh_filter_types (stmt), s1);
+ {
+ geh_filter *filter_stmt = as_a <geh_filter *> (stmt);
+ s1 = remap_gimple_seq (gimple_eh_filter_failure (filter_stmt), id);
+ copy = gimple_build_eh_filter (gimple_eh_filter_types (filter_stmt),
+ s1);
+ }
break;
case GIMPLE_TRY:
@@ -4030,7 +4034,9 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
weights);
case GIMPLE_EH_FILTER:
- return estimate_num_insns_seq (gimple_eh_filter_failure (stmt), weights);
+ return estimate_num_insns_seq (gimple_eh_filter_failure (
+ as_a <geh_filter *> (stmt)),
+ weights);
case GIMPLE_CATCH:
return estimate_num_insns_seq (gimple_catch_handler (
--
1.7.11.7