@@ -1,5 +1,58 @@
2014-10-24 David Malcolm <dmalcolm@redhat.com>
+ Introduce gimple_eh_dispatch
+
+ * coretypes.h (gimple_eh_dispatch): New typedef.
+ (const_gimple_eh_dispatch): New typedef.
+
+ * gimple-pretty-print.c (dump_gimple_eh_dispatch): Require a
+ gimple_eh_dispatch rather than a plain gimple.
+ (pp_gimple_stmt_1): Add a checked cast to gimple_eh_dispatch
+ within GIMPLE_EH_DISPATCH case of switch statement.
+
+ * gimple-streamer-in.c (input_gimple_stmt): Likewise.
+
+ * gimple-streamer-out.c (output_gimple_stmt): Likewise.
+
+ * gimple.c (gimple_build_eh_dispatch): Return a gimple_eh_dispatch
+ rather than a plain gimple.
+
+ * gimple.h (gimple_build_eh_dispatch): Return a gimple_eh_dispatch
+ rather than a plain gimple.
+ (gimple_eh_dispatch_region): Require a const_gimple_eh_dispatch
+ rather than a plain const_gimple.
+ (gimple_eh_dispatch_set_region): Require a gimple_eh_dispatch
+ rather than a plain gimple.
+
+ * tree-cfg.c (make_edges): Add a checked cast to gimple_eh_dispatch
+ within GIMPLE_EH_DISPATCH case of switch statement.
+ (gimple_verify_flow_info): Likewise.
+ (gimple_redirect_edge_and_branch): Likewise.
+ (move_stmt_r): Likewise, adding a local.
+
+ * tree-eh.c (emit_eh_dispatch): Convert local from gimple to
+ gimple_eh_dispatch.
+ (make_eh_dispatch_edges): Require a gimple_eh_dispatch rather than
+ a plain gimple.
+ (redirect_eh_dispatch_edge): Likewise.
+ (lower_eh_dispatch): Likewise.
+ (execute_lower_eh_dispatch): Add a checked cast to
+ gimple_eh_dispatch.
+ (mark_reachable_handlers): Likewise.
+ (verify_eh_dispatch_edge): Require a gimple_eh_dispatch rather
+ than a plain gimple.
+
+ * tree-eh.h (make_eh_dispatch_edges): Likewise.
+ (redirect_eh_dispatch_edge): Likewise.
+ (verify_eh_dispatch_edge): Likewise.
+
+ * tree-inline.c (remap_gimple_stmt): Add a checked cast to
+ gimple_eh_dispatch within GIMPLE_EH_DISPATCH case of switch
+ statement, adding a local.
+ (copy_edges_for_bb): Add a checked cast to gimple_eh_dispatch.
+
+2014-10-24 David Malcolm <dmalcolm@redhat.com>
+
Introduce gimple_resx
* coretypes.h (gimple_resx): New typedef.
@@ -154,6 +154,10 @@ struct gimple_statement_resx;
typedef struct gimple_statement_resx *gimple_resx;
typedef const struct gimple_statement_resx *const_gimple_resx;
+struct gimple_statement_eh_dispatch;
+typedef struct gimple_statement_eh_dispatch *gimple_eh_dispatch;
+typedef const struct gimple_statement_eh_dispatch *const_gimple_eh_dispatch;
+
struct gimple_statement_phi;
typedef struct gimple_statement_phi *gimple_phi;
typedef const struct gimple_statement_phi *const_gimple_phi;
@@ -1069,7 +1069,7 @@ dump_gimple_resx (pretty_printer *buffer, gimple_resx gs, int spc, int flags)
/* Dump a GIMPLE_EH_DISPATCH tuple on the pretty_printer BUFFER. */
static void
-dump_gimple_eh_dispatch (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_eh_dispatch (pretty_printer *buffer, gimple_eh_dispatch gs, int spc, int flags)
{
if (flags & TDF_RAW)
dump_gimple_fmt (buffer, spc, flags, "%G <%d>", gs,
@@ -2218,7 +2218,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
break;
case GIMPLE_EH_DISPATCH:
- dump_gimple_eh_dispatch (buffer, gs, spc, flags);
+ dump_gimple_eh_dispatch (buffer, as_a <gimple_eh_dispatch> (gs), spc,
+ flags);
break;
case GIMPLE_DEBUG:
@@ -134,7 +134,8 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
break;
case GIMPLE_EH_DISPATCH:
- gimple_eh_dispatch_set_region (stmt, streamer_read_hwi (ib));
+ gimple_eh_dispatch_set_region (as_a <gimple_eh_dispatch> (stmt),
+ streamer_read_hwi (ib));
break;
case GIMPLE_ASM:
@@ -108,7 +108,9 @@ output_gimple_stmt (struct output_block *ob, gimple stmt)
break;
case GIMPLE_EH_DISPATCH:
- streamer_write_hwi (ob, gimple_eh_dispatch_region (stmt));
+ streamer_write_hwi (ob,
+ gimple_eh_dispatch_region (
+ as_a <gimple_eh_dispatch> (stmt)));
break;
case GIMPLE_ASM:
@@ -760,11 +760,11 @@ gimple_build_switch (tree index, tree default_label, vec<tree> args)
/* Build a GIMPLE_EH_DISPATCH statement. */
-gimple
+gimple_eh_dispatch
gimple_build_eh_dispatch (int region)
{
- gimple_statement_eh_dispatch *p =
- as_a <gimple_statement_eh_dispatch *> (
+ gimple_eh_dispatch p =
+ as_a <gimple_eh_dispatch> (
gimple_build_with_ops (GIMPLE_EH_DISPATCH, ERROR_MARK, 0));
p->region = region;
return p;
@@ -1335,7 +1335,7 @@ gimple gimple_build_wce (gimple_seq);
gimple_resx gimple_build_resx (int);
gimple_switch gimple_build_switch_nlabels (unsigned, tree, tree);
gimple_switch gimple_build_switch (tree, tree, vec<tree> );
-gimple gimple_build_eh_dispatch (int);
+gimple_eh_dispatch gimple_build_eh_dispatch (int);
gimple_debug gimple_build_debug_bind_stat (tree, tree, gimple MEM_STAT_DECL);
#define gimple_build_debug_bind(var,val,stmt) \
gimple_build_debug_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
@@ -4035,23 +4035,20 @@ gimple_resx_set_region (gimple_resx resx_stmt, int region)
resx_stmt->region = region;
}
-/* Return the region number for GIMPLE_EH_DISPATCH GS. */
+/* Return the region number for GIMPLE_EH_DISPATCH EH_DISPATCH_STMT. */
static inline int
-gimple_eh_dispatch_region (const_gimple gs)
+gimple_eh_dispatch_region (const_gimple_eh_dispatch eh_dispatch_stmt)
{
- const gimple_statement_eh_dispatch *eh_dispatch_stmt =
- as_a <const gimple_statement_eh_dispatch *> (gs);
return eh_dispatch_stmt->region;
}
-/* Set REGION to be the region number for GIMPLE_EH_DISPATCH GS. */
+/* Set REGION to be the region number for GIMPLE_EH_DISPATCH
+ EH_DISPATCH_STMT. */
static inline void
-gimple_eh_dispatch_set_region (gimple gs, int region)
+gimple_eh_dispatch_set_region (gimple_eh_dispatch eh_dispatch_stmt, int region)
{
- gimple_statement_eh_dispatch *eh_dispatch_stmt =
- as_a <gimple_statement_eh_dispatch *> (gs);
eh_dispatch_stmt->region = region;
}
@@ -812,7 +812,8 @@ make_edges (void)
fallthru = false;
break;
case GIMPLE_EH_DISPATCH:
- fallthru = make_eh_dispatch_edges (last);
+ fallthru =
+ make_eh_dispatch_edges (as_a <gimple_eh_dispatch> (last));
break;
case GIMPLE_CALL:
@@ -5324,7 +5325,7 @@ gimple_verify_flow_info (void)
break;
case GIMPLE_EH_DISPATCH:
- err |= verify_eh_dispatch_edge (stmt);
+ err |= verify_eh_dispatch_edge (as_a <gimple_eh_dispatch> (stmt));
break;
default:
@@ -5578,7 +5579,7 @@ gimple_redirect_edge_and_branch (edge e, basic_block dest)
case GIMPLE_EH_DISPATCH:
if (!(e->flags & EDGE_FALLTHRU))
- redirect_eh_dispatch_edge (stmt, e, dest);
+ redirect_eh_dispatch_edge (as_a <gimple_eh_dispatch> (stmt), e, dest);
break;
case GIMPLE_TRANSACTION:
@@ -6533,9 +6534,10 @@ move_stmt_r (gimple_stmt_iterator *gsi_p, bool *handled_ops_p,
case GIMPLE_EH_DISPATCH:
{
- int r = gimple_eh_dispatch_region (stmt);
+ gimple_eh_dispatch eh_dispatch_stmt = as_a <gimple_eh_dispatch> (stmt);
+ int r = gimple_eh_dispatch_region (eh_dispatch_stmt);
r = move_stmt_eh_region_nr (r, p);
- gimple_eh_dispatch_set_region (stmt, r);
+ gimple_eh_dispatch_set_region (eh_dispatch_stmt, r);
}
break;
@@ -816,7 +816,7 @@ emit_resx (gimple_seq *seq, eh_region region)
static void
emit_eh_dispatch (gimple_seq *seq, eh_region region)
{
- gimple x = gimple_build_eh_dispatch (region->index);
+ gimple_eh_dispatch x = gimple_build_eh_dispatch (region->index);
gimple_seq_add_stmt (seq, x);
}
@@ -2197,7 +2197,7 @@ make_pass_lower_eh (gcc::context *ctxt)
no fallthru edge; false if there is. */
bool
-make_eh_dispatch_edges (gimple stmt)
+make_eh_dispatch_edges (gimple_eh_dispatch stmt)
{
eh_region r;
eh_catch c;
@@ -2355,7 +2355,7 @@ redirect_eh_edge (edge edge_in, basic_block new_bb)
The actual edge update will happen in the caller. */
void
-redirect_eh_dispatch_edge (gimple stmt, edge e, basic_block new_bb)
+redirect_eh_dispatch_edge (gimple_eh_dispatch stmt, edge e, basic_block new_bb)
{
tree new_lab = gimple_block_label (new_bb);
bool any_changed = false;
@@ -3544,7 +3544,7 @@ sink_clobbers (basic_block bb)
we have found some duplicate labels and removed some edges. */
static bool
-lower_eh_dispatch (basic_block src, gimple stmt)
+lower_eh_dispatch (basic_block src, gimple_eh_dispatch stmt)
{
gimple_stmt_iterator gsi;
int region_nr;
@@ -3732,7 +3732,8 @@ pass_lower_eh_dispatch::execute (function *fun)
continue;
if (gimple_code (last) == GIMPLE_EH_DISPATCH)
{
- redirected |= lower_eh_dispatch (bb, last);
+ redirected |= lower_eh_dispatch (bb,
+ as_a <gimple_eh_dispatch> (last));
flags |= TODO_update_ssa_only_virtuals;
}
else if (gimple_code (last) == GIMPLE_RESX)
@@ -3824,7 +3825,9 @@ mark_reachable_handlers (sbitmap *r_reachablep, sbitmap *lp_reachablep)
gimple_resx_region (as_a <gimple_resx> (stmt)));
break;
case GIMPLE_EH_DISPATCH:
- bitmap_set_bit (r_reachable, gimple_eh_dispatch_region (stmt));
+ bitmap_set_bit (r_reachable,
+ gimple_eh_dispatch_region (
+ as_a <gimple_eh_dispatch> (stmt)));
break;
default:
break;
@@ -4666,7 +4669,7 @@ verify_eh_edges (gimple stmt)
/* Similarly, but handle GIMPLE_EH_DISPATCH specifically. */
DEBUG_FUNCTION bool
-verify_eh_dispatch_edge (gimple stmt)
+verify_eh_dispatch_edge (gimple_eh_dispatch stmt)
{
eh_region r;
eh_catch c;
@@ -30,10 +30,10 @@ extern bool remove_stmt_from_eh_lp_fn (struct function *, gimple);
extern bool remove_stmt_from_eh_lp (gimple);
extern int lookup_stmt_eh_lp_fn (struct function *, gimple);
extern int lookup_stmt_eh_lp (gimple);
-extern bool make_eh_dispatch_edges (gimple);
+extern bool make_eh_dispatch_edges (gimple_eh_dispatch);
extern void make_eh_edges (gimple);
extern edge redirect_eh_edge (edge, basic_block);
-extern void redirect_eh_dispatch_edge (gimple, edge, basic_block);
+extern void redirect_eh_dispatch_edge (gimple_eh_dispatch, edge, basic_block);
extern bool operation_could_trap_helper_p (enum tree_code, bool, bool, bool,
bool, tree, bool *);
extern bool operation_could_trap_p (enum tree_code, bool, bool, tree);
@@ -51,6 +51,6 @@ extern bool maybe_duplicate_eh_stmt_fn (struct function *, gimple,
extern bool maybe_duplicate_eh_stmt (gimple, gimple);
extern void maybe_remove_unreachable_handlers (void);
extern bool verify_eh_edges (gimple);
-extern bool verify_eh_dispatch_edge (gimple);
+extern bool verify_eh_dispatch_edge (gimple_eh_dispatch);
#endif /* GCC_TREE_EH_H */
@@ -1593,9 +1593,10 @@ remap_gimple_stmt (gimple stmt, copy_body_data *id)
case GIMPLE_EH_DISPATCH:
{
- int r = gimple_eh_dispatch_region (copy);
+ gimple_eh_dispatch eh_dispatch = as_a <gimple_eh_dispatch> (copy);
+ int r = gimple_eh_dispatch_region (eh_dispatch);
r = remap_eh_region_nr (r, id);
- gimple_eh_dispatch_set_region (copy, r);
+ gimple_eh_dispatch_set_region (eh_dispatch, r);
}
break;
@@ -2105,7 +2106,7 @@ copy_edges_for_bb (basic_block bb, gcov_type count_scale, basic_block ret_bb,
}
if (gimple_code (copy_stmt) == GIMPLE_EH_DISPATCH)
- make_eh_dispatch_edges (copy_stmt);
+ make_eh_dispatch_edges (as_a <gimple_eh_dispatch> (copy_stmt));
else if (can_throw)
make_eh_edges (copy_stmt);