X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=gcc%2Ftree-complex.c;h=4a4ba62a05bc0f9d485524e7bd69bc19fbd5cd17;hb=54daa60094d5125e41489c6f6fe28a6ec3302473;hp=a960f92c42427b76bfa17426a978bffa9a6a103b;hpb=83e2a11b2613ddd8dfc024700b1c86729b058300;p=pf3gnuchains%2Fgcc-fork.git diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index a960f92c424..4a4ba62a05b 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -35,6 +35,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-iterator.h" #include "tree-pass.h" #include "flags.h" +#include "ggc.h" /* Extract the real or imaginary part of a complex variable or constant. @@ -64,7 +65,7 @@ extract_component (block_stmt_iterator *bsi, tree t, bool imagpart_p) break; default: - abort (); + gcc_unreachable (); } return gimplify_val (bsi, inner_type, ret); @@ -78,12 +79,12 @@ update_complex_assignment (block_stmt_iterator *bsi, tree r, tree i) tree stmt = bsi_stmt (*bsi); tree type; - modify_stmt (stmt); if (TREE_CODE (stmt) == RETURN_EXPR) stmt = TREE_OPERAND (stmt, 0); type = TREE_TYPE (TREE_OPERAND (stmt, 1)); TREE_OPERAND (stmt, 1) = build (COMPLEX_EXPR, type, r, i); + modify_stmt (stmt); } /* Expand complex addition to scalars: @@ -216,7 +217,7 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type, /* Update dominance info. Note that bb_join's data was updated by split_block. */ - if (dom_computed[CDI_DOMINATORS] >= DOM_CONS_OK) + if (dom_info_available_p (CDI_DOMINATORS)) { set_immediate_dominator (CDI_DOMINATORS, bb_true, bb_cond); set_immediate_dominator (CDI_DOMINATORS, bb_false, bb_cond); @@ -254,7 +255,7 @@ expand_complex_div_wide (block_stmt_iterator *bsi, tree inner_type, t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, min, ratio); div = gimplify_build2 (bsi, PLUS_EXPR, inner_type, t1, max); - /* Result is now ((ar + ai*ratio)/div) + i((ai - ar*ratio)/div). */ + /* Result is now ((ar + ai*ratio)/div) + i((ai - ar*ratio)/div). */ t1 = gimplify_build2 (bsi, MULT_EXPR, inner_type, ai, ratio); t2 = gimplify_build2 (bsi, PLUS_EXPR, inner_type, ar, t1); rr = gimplify_build2 (bsi, code, inner_type, t2, div); @@ -285,7 +286,7 @@ expand_complex_division (block_stmt_iterator *bsi, tree inner_type, break; default: /* C99-like requirements for complex divide (not yet implemented). */ - abort (); + gcc_unreachable (); } } @@ -326,7 +327,7 @@ static void expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai, tree br, tree bi, enum tree_code code) { - tree cr, ci, cc, stmt, type; + tree cr, ci, cc, stmt, expr, type; cr = gimplify_build2 (bsi, code, boolean_type_node, ar, br); ci = gimplify_build2 (bsi, code, boolean_type_node, ai, bi); @@ -334,24 +335,25 @@ expand_complex_comparison (block_stmt_iterator *bsi, tree ar, tree ai, (code == EQ_EXPR ? TRUTH_AND_EXPR : TRUTH_OR_EXPR), boolean_type_node, cr, ci); - stmt = bsi_stmt (*bsi); - modify_stmt (stmt); + stmt = expr = bsi_stmt (*bsi); switch (TREE_CODE (stmt)) { case RETURN_EXPR: - stmt = TREE_OPERAND (stmt, 0); + expr = TREE_OPERAND (stmt, 0); /* FALLTHRU */ case MODIFY_EXPR: - type = TREE_TYPE (TREE_OPERAND (stmt, 1)); - TREE_OPERAND (stmt, 1) = fold_convert (type, cc); + type = TREE_TYPE (TREE_OPERAND (expr, 1)); + TREE_OPERAND (expr, 1) = fold_convert (type, cc); break; case COND_EXPR: TREE_OPERAND (stmt, 0) = cc; break; default: - abort (); + gcc_unreachable (); } + + modify_stmt (stmt); } /* Process one statement. If we identify a complex operation, expand it. */ @@ -424,7 +426,7 @@ expand_complex_operations_1 (block_stmt_iterator *bsi) ar = extract_component (bsi, ac, 0); ai = extract_component (bsi, ac, 1); - if (TREE_CODE_CLASS (code) == '1') + if (TREE_CODE_CLASS (code) == tcc_unary) bc = br = bi = NULL; else { @@ -471,7 +473,7 @@ expand_complex_operations_1 (block_stmt_iterator *bsi) break; default: - abort (); + gcc_unreachable (); } } @@ -485,8 +487,7 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value) unsigned HOST_WIDE_INT low, high, mask; tree ret; - if (n == 0) - abort (); + gcc_assert (n); if (width == HOST_BITS_PER_WIDE_INT) low = value; @@ -503,32 +504,36 @@ build_replicated_const (tree type, tree inner_type, HOST_WIDE_INT value) else if (TYPE_PRECISION (type) == 2 * HOST_BITS_PER_WIDE_INT) high = low; else - abort (); + gcc_unreachable (); - ret = build_int_2 (low, high); - TREE_TYPE (ret) = type; + ret = build_int_cst_wide (type, low, high); return ret; } +static GTY(()) tree vector_inner_type; +static GTY(()) tree vector_last_type; +static GTY(()) int vector_last_nunits; + /* Return a suitable vector types made of SUBPARTS units each of mode "word_mode" (the global variable). */ static tree build_word_mode_vector_type (int nunits) { - static tree innertype; - static tree last; - static int last_nunits; - - if (!innertype) - innertype = lang_hooks.types.type_for_mode (word_mode, 1); - else if (last_nunits == nunits) - return last; + if (!vector_inner_type) + vector_inner_type = lang_hooks.types.type_for_mode (word_mode, 1); + else if (vector_last_nunits == nunits) + { + gcc_assert (TREE_CODE (vector_last_type) == VECTOR_TYPE); + return vector_last_type; + } /* We build a new type, but we canonicalize it nevertheless, because it still saves some memory. */ - last_nunits = nunits; - last = type_hash_canon (nunits, build_vector_type (innertype, nunits)); - return last; + vector_last_nunits = nunits; + vector_last_type = type_hash_canon (nunits, + build_vector_type (vector_inner_type, + nunits)); + return vector_last_type; } typedef tree (*elem_op_func) (block_stmt_iterator *, @@ -777,16 +782,14 @@ expand_vector_operations_1 (block_stmt_iterator *bsi) return; code = TREE_CODE (rhs); - if (TREE_CODE_CLASS (code) != '1' - && TREE_CODE_CLASS (code) != '2') + if (TREE_CODE_CLASS (code) != tcc_unary + && TREE_CODE_CLASS (code) != tcc_binary) return; if (code == NOP_EXPR || code == VIEW_CONVERT_EXPR) return; - - if (code == CONVERT_EXPR) - abort (); - + + gcc_assert (code != CONVERT_EXPR); op = optab_for_tree_code (code, type); /* Optabs will try converting a negation into a subtraction, so @@ -875,7 +878,7 @@ expand_vector_operations_1 (block_stmt_iterator *bsi) break; } - if (TREE_CODE_CLASS (code) == '1') + if (TREE_CODE_CLASS (code) == tcc_unary) *p_rhs = expand_vector_piecewise (bsi, do_unop, type, compute_type, TREE_OPERAND (rhs, 0), NULL_TREE, code); @@ -935,7 +938,8 @@ struct tree_opt_pass pass_lower_vector_ssa = 0, /* todo_flags_start */ TODO_dump_func | TODO_rename_vars /* todo_flags_finish */ | TODO_ggc_collect | TODO_verify_ssa - | TODO_verify_stmts | TODO_verify_flow + | TODO_verify_stmts | TODO_verify_flow, + 0 /* letter */ }; struct tree_opt_pass pass_pre_expand = @@ -952,5 +956,8 @@ struct tree_opt_pass pass_pre_expand = 0, /* properties_destroyed */ 0, /* todo_flags_start */ TODO_dump_func | TODO_ggc_collect - | TODO_verify_stmts /* todo_flags_finish */ + | TODO_verify_stmts, /* todo_flags_finish */ + 0 /* letter */ }; + +#include "gt-tree-complex.h"