diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-04 13:03:02 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-04 13:03:02 +0000 |
commit | 49a701754404dae1846ba49062fbc54a3b7c24a2 (patch) | |
tree | e122d3a36874476f12e63764b611e6ee436001d2 /gcc/gimple.c | |
parent | c1a60a68d27bb1918025c040ed41c27548e4f0aa (diff) | |
download | gcc-49a701754404dae1846ba49062fbc54a3b7c24a2.tar.gz |
* 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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190925 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r-- | gcc/gimple.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c index d78c60f22e8..88fa7627e84 100644 --- a/gcc/gimple.c +++ b/gcc/gimple.c @@ -803,39 +803,14 @@ gimple gimple_build_switch_nlabels (unsigned nlabels, tree index, tree default_label) { /* nlabels + 1 default label + 1 index. */ + gcc_checking_assert (default_label); gimple p = gimple_build_with_ops (GIMPLE_SWITCH, ERROR_MARK, - 1 + (default_label != NULL) + nlabels); + 1 + 1 + nlabels); gimple_switch_set_index (p, index); - if (default_label) - gimple_switch_set_default_label (p, default_label); + gimple_switch_set_default_label (p, default_label); return p; } - -/* Build a GIMPLE_SWITCH statement. - - INDEX is the switch's index. - NLABELS is the number of labels in the switch excluding the DEFAULT_LABEL. - ... are the labels excluding the default. */ - -gimple -gimple_build_switch (unsigned nlabels, tree index, tree default_label, ...) -{ - va_list al; - unsigned i, offset; - gimple p = gimple_build_switch_nlabels (nlabels, index, default_label); - - /* Store the rest of the labels. */ - va_start (al, default_label); - offset = (default_label != NULL); - for (i = 0; i < nlabels; i++) - gimple_switch_set_label (p, i + offset, va_arg (al, tree)); - va_end (al); - - return p; -} - - /* Build a GIMPLE_SWITCH statement. INDEX is the switch's index. @@ -843,15 +818,15 @@ gimple_build_switch (unsigned nlabels, tree index, tree default_label, ...) ARGS is a vector of labels excluding the default. */ gimple -gimple_build_switch_vec (tree index, tree default_label, VEC(tree, heap) *args) +gimple_build_switch (tree index, tree default_label, VEC(tree, heap) *args) { - unsigned i, offset, nlabels = VEC_length (tree, args); + unsigned i, nlabels = VEC_length (tree, args); + gimple p = gimple_build_switch_nlabels (nlabels, index, default_label); /* Copy the labels from the vector to the switch statement. */ - offset = (default_label != NULL); for (i = 0; i < nlabels; i++) - gimple_switch_set_label (p, i + offset, VEC_index (tree, args, i)); + gimple_switch_set_label (p, i + 1, VEC_index (tree, args, i)); return p; } |