From: Jakub Jelinek Date: Fri, 4 Jul 2008 09:57:59 +0000 (+0200) Subject: tree-switch-conversion.c (build_one_array, [...]): Use build_gimple_modify_stmt. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=04e78aa93b6a5245537700e18a6e1dedeba7827f;p=gcc.git tree-switch-conversion.c (build_one_array, [...]): Use build_gimple_modify_stmt. * tree-switch-conversion.c (build_one_array, gen_def_assigns): Use build_gimple_modify_stmt. (build_arrays, gen_inbound_check): Likewise. Force RHS to be gimple operand. Use fold_build* instead of build*. From-SVN: r137454 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9655811db9b..69053a95930 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2008-07-04 Jakub Jelinek + + * tree-switch-conversion.c (build_one_array, gen_def_assigns): Use + build_gimple_modify_stmt. + (build_arrays, gen_inbound_check): Likewise. Force RHS to be + gimple operand. Use fold_build* instead of build*. + 2008-07-04 Richard Guenther * tree-ssa-structalias.c (lookup_vi_for_tree): Declare. diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 68d6b50d1bd..0ce5fc91ead 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -482,7 +482,7 @@ build_one_array (tree swtch, int num, tree arr_index_type, tree phi, tree tidx) fetch = build4 (ARRAY_REF, value_type, decl, tidx, NULL_TREE, NULL_TREE); - load = build2 (GIMPLE_MODIFY_STMT, void_type_node, name, fetch); + load = build_gimple_modify_stmt (name, fetch); SSA_NAME_DEF_STMT (name) = load; bsi = bsi_for_stmt (swtch); @@ -507,13 +507,17 @@ build_arrays (tree swtch) tree phi = phi_nodes (info.final_bb); int i; + bsi = bsi_for_stmt (swtch); + arr_index_type = build_index_type (info.range_size); tidx = make_rename_temp (arr_index_type, "csti"); - sub = build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr, - fold_convert (TREE_TYPE (info.index_expr), info.range_min)); - sub = build2 (GIMPLE_MODIFY_STMT, void_type_node, tidx, sub); + sub = fold_build2 (MINUS_EXPR, TREE_TYPE (info.index_expr), info.index_expr, + fold_convert (TREE_TYPE (info.index_expr), + info.range_min)); + sub = force_gimple_operand_bsi (&bsi, fold_convert (arr_index_type, sub), + false, NULL, true, BSI_SAME_STMT); + sub = build_gimple_modify_stmt (tidx, sub); - bsi = bsi_for_stmt (swtch); bsi_insert_before (&bsi, sub, BSI_SAME_STMT); mark_symbols_for_renaming (sub); info.arr_ref_first = sub; @@ -539,8 +543,7 @@ gen_def_assigns (block_stmt_iterator *bsi) NULL_TREE); info.target_outbound_names[i] = name; - assign = build2 (GIMPLE_MODIFY_STMT, void_type_node, name, - info.default_values[i]); + assign = build_gimple_modify_stmt (name, info.default_values[i]); SSA_NAME_DEF_STMT (name) = assign; bsi_insert_before (bsi, assign, BSI_SAME_STMT); find_new_referenced_vars (&assign); @@ -639,15 +642,17 @@ gen_inbound_check (tree swtch) bsi = bsi_for_stmt (info.arr_ref_first); tmp_u = make_rename_temp (utype, "csui"); - cast = build1 (NOP_EXPR, utype, info.index_expr); - cast_assign = build2 (GIMPLE_MODIFY_STMT, void_type_node, tmp_u, cast); + cast = fold_convert (utype, info.index_expr); + cast_assign = build_gimple_modify_stmt (tmp_u, cast); find_new_referenced_vars (&cast_assign); bsi_insert_before (&bsi, cast_assign, BSI_SAME_STMT); mark_symbols_for_renaming (cast_assign); ulb = fold_convert (utype, info.range_min); - minus = build2 (MINUS_EXPR, utype, tmp_u, ulb); - minus_assign = build2 (GIMPLE_MODIFY_STMT, void_type_node, tmp_u, minus); + minus = fold_build2 (MINUS_EXPR, utype, tmp_u, ulb); + minus = force_gimple_operand_bsi (&bsi, minus, false, NULL, true, + BSI_SAME_STMT); + minus_assign = build_gimple_modify_stmt (tmp_u, minus); find_new_referenced_vars (&minus_assign); bsi_insert_before (&bsi, minus_assign, BSI_SAME_STMT); mark_symbols_for_renaming (minus_assign);