aboutsummaryrefslogtreecommitdiff
path: root/gcc/except.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-09-04 13:03:02 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-09-04 13:03:02 +0000
commit7a8ecf31a756b303606bf5925c101651fb128cd0 (patch)
treee122d3a36874476f12e63764b611e6ee436001d2 /gcc/except.c
parentf89a442b8017308173b40224ea36b44d9503c736 (diff)
* gimple.h (gimple_build_switch): Remove.
(gimple_build_switch_vec): Promote to the new gimple_build_switch. (gimple_switch_default_label): Assert the default case label is really a default case label. (gimple_switch_set_default_label): Likewise. * gimple.c (gimple_build_switch_nlabels): Make sure a default label is passed in, and simplify accordingly. (gimple_build_switch): Removed. (gimple_build_switch_vec): Rename to gimple_build_switch. * gimplify.c (gimplify_switch_expr): Update gimple_build_switch use. * gimple-pretty-print.c (dump_gimple_switch): Do not accept a NULL case label. * stmt.c (expand_case): Simplify using the fact that every GIMPLE switch must have a default case. * tree-cfg.c (group_case_labels_stmt): Likewise. (verify_gimple_switch): Use gimple_switch_label in verifier to get the label at index 0, and verify that it is a valid default case. * except.c (sjlj_emit_dispatch_table): Rewrite construction of the switch for dispatching. * tree-eh.c (lower_try_finally_switch): Update gimple_build_switch use. (lower_eh_dispatch): Likewise. * tree-vrp.c (execute_vrp): Use gimple_switch_label to get the case label at index 0 before turning it into a default case label. * omp-low.c (expand_omp_sections): Update gimple_build_switch use. * tree-switch-conversion.c (emit_case_bit_tests): Get the default case label using gimple_switch_default_label. (collect_switch_conv_info): Likewise. (process_switch): Likewise. * doc/gimple.texi: Update documentation of gimple_build_switch. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@190925 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/except.c')
-rw-r--r--gcc/except.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gcc/except.c b/gcc/except.c
index 01745125a8e..ae5a11fdaa0 100644
--- a/gcc/except.c
+++ b/gcc/except.c
@@ -1243,7 +1243,7 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch)
eh_region r;
edge e;
int i, disp_index;
- gimple switch_stmt;
+ VEC(tree, heap) *dispatch_labels = NULL;
fc = crtl->eh.sjlj_fc;
@@ -1289,17 +1289,8 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch)
/* If there's exactly one call site in the function, don't bother
generating a switch statement. */
- switch_stmt = NULL;
if (num_dispatch > 1)
- {
- tree disp;
-
- mem = adjust_address (fc, TYPE_MODE (integer_type_node),
- sjlj_fc_call_site_ofs);
- disp = make_tree (integer_type_node, mem);
-
- switch_stmt = gimple_build_switch_nlabels (num_dispatch, disp, NULL);
- }
+ dispatch_labels = VEC_alloc (tree, heap, num_dispatch);
for (i = 1; VEC_iterate (eh_landing_pad, cfun->eh->lp_array, i, lp); ++i)
if (lp && lp->post_landing_pad)
@@ -1317,8 +1308,7 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch)
t_label = create_artificial_label (UNKNOWN_LOCATION);
t = build_int_cst (integer_type_node, disp_index);
case_elt = build_case_label (t, NULL, t_label);
- gimple_switch_set_label (switch_stmt, disp_index, case_elt);
-
+ VEC_quick_push (tree, dispatch_labels, case_elt);
label = label_rtx (t_label);
}
else
@@ -1371,7 +1361,16 @@ sjlj_emit_dispatch_table (rtx dispatch_label, int num_dispatch)
if (num_dispatch > 1)
{
+ gimple switch_stmt;
+ tree default_label = create_artificial_label (UNKNOWN_LOCATION);
+ rtx disp = adjust_address (fc, TYPE_MODE (integer_type_node),
+ sjlj_fc_call_site_ofs);
+ switch_stmt = gimple_build_switch (make_tree (integer_type_node, disp),
+ build_case_label (NULL, NULL,
+ default_label),
+ dispatch_labels);
expand_case (switch_stmt);
+ emit_label (label_rtx (default_label));
expand_builtin_trap ();
}