aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.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/tree-cfg.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/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 9b2ae50bc6f..44715271822 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1334,26 +1334,11 @@ group_case_labels_stmt (gimple stmt)
int old_size = gimple_switch_num_labels (stmt);
int i, j, new_size = old_size;
basic_block default_bb = NULL;
- bool has_default;
- /* The default label is always the first case in a switch
- statement after gimplification if it was not optimized
- away */
- if (!CASE_LOW (gimple_switch_default_label (stmt))
- && !CASE_HIGH (gimple_switch_default_label (stmt)))
- {
- tree default_case = gimple_switch_default_label (stmt);
- default_bb = label_to_block (CASE_LABEL (default_case));
- has_default = true;
- }
- else
- has_default = false;
+ default_bb = label_to_block (CASE_LABEL (gimple_switch_default_label (stmt)));
/* Look for possible opportunities to merge cases. */
- if (has_default)
- i = 1;
- else
- i = 0;
+ i = 1;
while (i < old_size)
{
tree base_case, base_high;
@@ -4148,7 +4133,7 @@ verify_gimple_switch (gimple stmt)
return true;
}
- elt = gimple_switch_default_label (stmt);
+ elt = gimple_switch_label (stmt, 0);
if (CASE_LOW (elt) != NULL_TREE || CASE_HIGH (elt) != NULL_TREE)
{
error ("invalid default case label in switch statement");