diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cc90ef7dc84..078ee828332 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2004-10-09 Steven Bosscher + + * cfgexpand.c (maybe_dump_rtl_for_tree_stmt): New function. + (expand_gimple_cond_expr, expand_gimple_tailcall, + expand_gimple_basic_block): Use it to dump RTL for each stmt. + (tree_expand_cfg): Announce full RTL function dump. + * tree-optimize.c (execute_one_pass): Use normal RTL printing, + not the graph version. + * tree-pretty-print.c (dump_generic_node): Allow empty statements + in the arms of a COND_EXPR for lowered nodes. + 2004-10-08 Joseph S. Myers * config/rs6000/spe.h (atosfix16, atosfix32, atosfix64, atoufix16, @@ -192,21 +203,21 @@ 2004-10-07 Devang Patel - * rs6000/altivec.md (UNSPEC_VCMPBFP, UNSPEC_VCMPEQUB, UNSPEC_VCMPEQUH, - UNSPEC_VCMPEQUW, UNSPEC_VCMPGEFP, UNSPEC_VCMPGTUB, UNSPEC_VCMPGTSB, - UNSPEC_VCMPGTUH, UNSPEC_VCMPGTSH, UNSPEC_VCMPGTUW, UNSPEC_VCMPGTSW, - UNSPEC_VCMPGTFP, UNSPEC_VSEL4SI, UNSPEC_VSEL4SF, UNSPEC_VSEL8HI, - UNSPEC_VSEL16QI, UNSPEC_VCOND_V4SI, UNSPEC_VCOND_V4SF, UNSPEC_VCOND_V8HI, - UNSPEC_VCOND_V16QI, UNSPEC_VCONDU_V4SI, UNSPEC_VCONDU_V8HI, + * rs6000/altivec.md (UNSPEC_VCMPBFP, UNSPEC_VCMPEQUB, UNSPEC_VCMPEQUH, + UNSPEC_VCMPEQUW, UNSPEC_VCMPGEFP, UNSPEC_VCMPGTUB, UNSPEC_VCMPGTSB, + UNSPEC_VCMPGTUH, UNSPEC_VCMPGTSH, UNSPEC_VCMPGTUW, UNSPEC_VCMPGTSW, + UNSPEC_VCMPGTFP, UNSPEC_VSEL4SI, UNSPEC_VSEL4SF, UNSPEC_VSEL8HI, + UNSPEC_VSEL16QI, UNSPEC_VCOND_V4SI, UNSPEC_VCOND_V4SF, UNSPEC_VCOND_V8HI, + UNSPEC_VCOND_V16QI, UNSPEC_VCONDU_V4SI, UNSPEC_VCONDU_V8HI, UNSPEC_VCONDU_V16QI): New constant defines. - (vcondv4si, vcondv4sf, vcondv8hi, vcondv16qi, vconduv4si, vconduv8hi, + (vcondv4si, vcondv4sf, vcondv8hi, vcondv16qi, vconduv4si, vconduv8hi, vconduv16qi): New patterns. - * rs6000/rs6000-protos.h (rs6000_emit_vector_cond_expr): New function. - * rs6000/rs6000.c (rs6000_emit_vector_cond_expr): New function. - (get_vec_cmp_insn): Same. - (get_vsel_insn): Same. - (rs6000_emit_vector_compare): Same. - (rs6000_emit_vector_select): Same. + * rs6000/rs6000-protos.h (rs6000_emit_vector_cond_expr): New function. + * rs6000/rs6000.c (rs6000_emit_vector_cond_expr): New function. + (get_vec_cmp_insn): Same. + (get_vsel_insn): Same. + (rs6000_emit_vector_compare): Same. + (rs6000_emit_vector_select): Same. (INSN_NOT_AVAILABLE): New. 2004-10-07 Zdenek Dvorak diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index ee0d534ac55..a04f3ae4231 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -833,6 +833,23 @@ expand_used_vars (void) } +/* If we need to produce a detailed dump, print the tree representation + for STMT to the dump file. SINCE is the last RTX after which the RTL + generated for STMT should have been appended. */ + +static void +maybe_dump_rtl_for_tree_stmt (tree stmt, rtx since) +{ + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "\n;; "); + print_generic_expr (dump_file, stmt, TDF_SLIM); + fprintf (dump_file, "\n"); + + print_rtl (dump_file, since ? NEXT_INSN (since) : since); + } +} + /* A subroutine of expand_gimple_basic_block. Expand one COND_EXPR. Returns a new basic block if we've terminated the current basic block and created a new one. */ @@ -847,7 +864,9 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) tree pred = COND_EXPR_COND (stmt); tree then_exp = COND_EXPR_THEN (stmt); tree else_exp = COND_EXPR_ELSE (stmt); - rtx last = get_last_insn (); + rtx last2, last; + + last2 = last = get_last_insn (); extract_true_false_edges_from_block (bb, &true_edge, &false_edge); if (EXPR_LOCUS (stmt)) @@ -866,12 +885,14 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) { jumpif (pred, label_rtx (GOTO_DESTINATION (then_exp))); add_reg_br_prob_note (dump_file, last, true_edge->probability); + maybe_dump_rtl_for_tree_stmt (stmt, last); return NULL; } if (TREE_CODE (else_exp) == GOTO_EXPR && IS_EMPTY_STMT (then_exp)) { jumpifnot (pred, label_rtx (GOTO_DESTINATION (else_exp))); add_reg_br_prob_note (dump_file, last, false_edge->probability); + maybe_dump_rtl_for_tree_stmt (stmt, last); return NULL; } gcc_assert (TREE_CODE (then_exp) == GOTO_EXPR @@ -900,11 +921,7 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) BB_END (new_bb) = PREV_INSN (BB_END (new_bb)); update_bb_for_insn (new_bb); - if (dump_file) - { - dump_bb (bb, dump_file, 0); - dump_bb (new_bb, dump_file, 0); - } + maybe_dump_rtl_for_tree_stmt (stmt, last2); return new_bb; } @@ -922,18 +939,22 @@ expand_gimple_cond_expr (basic_block bb, tree stmt) static basic_block expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru) { - rtx last = get_last_insn (); + rtx last2, last; edge e; edge_iterator ei; int probability; gcov_type count; + last2 = last = get_last_insn (); + expand_expr_stmt (stmt); for (last = NEXT_INSN (last); last; last = NEXT_INSN (last)) if (CALL_P (last) && SIBLING_CALL_P (last)) goto found; + maybe_dump_rtl_for_tree_stmt (stmt, last); + *can_fallthru = true; return NULL; @@ -1007,6 +1028,8 @@ expand_gimple_tailcall (basic_block bb, tree stmt, bool *can_fallthru) BB_END (bb) = PREV_INSN (last); } + maybe_dump_rtl_for_tree_stmt (stmt, last2); + return bb; } @@ -1023,9 +1046,9 @@ expand_gimple_basic_block (basic_block bb, FILE * dump_file) if (dump_file) { - tree_register_cfg_hooks (); - dump_bb (bb, dump_file, 0); - rtl_register_cfg_hooks (); + fprintf (dump_file, + "\n;; Generating RTL for tree basic block %d\n", + bb->index); } if (!bsi_end_p (bsi)) @@ -1044,6 +1067,8 @@ expand_gimple_basic_block (basic_block bb, FILE * dump_file) BB_HEAD (bb) = NEXT_INSN (BB_HEAD (bb)); bsi_next (&bsi); note = emit_note_after (NOTE_INSN_BASIC_BLOCK, BB_HEAD (bb)); + + maybe_dump_rtl_for_tree_stmt (stmt, last); } else note = BB_HEAD (bb) = emit_note (NOTE_INSN_BASIC_BLOCK); @@ -1096,7 +1121,11 @@ expand_gimple_basic_block (basic_block bb, FILE * dump_file) } } else - expand_expr_stmt (stmt); + { + last = get_last_insn (); + expand_expr_stmt (stmt); + maybe_dump_rtl_for_tree_stmt (stmt, last); + } } } @@ -1111,8 +1140,6 @@ expand_gimple_basic_block (basic_block bb, FILE * dump_file) last = PREV_INSN (PREV_INSN (last)); BB_END (bb) = last; - if (dump_file) - dump_bb (bb, dump_file, 0); update_bb_for_insn (bb); return bb; @@ -1303,6 +1330,13 @@ tree_expand_cfg (void) generating_concat_p = 0; finalize_block_changes (); + + if (dump_file) + { + fprintf (dump_file, + "\n\n;;\n;; Full RTL generated for this function:\n;;\n"); + /* And the pass manager will dump RTL for us. */ + } } struct tree_opt_pass pass_expand = diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 1d145dcf73b..4fd6240fb94 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -505,7 +505,7 @@ execute_one_pass (struct tree_opt_pass *pass) if (dump_file && (pass->properties_provided & (PROP_cfg | PROP_rtl)) == (PROP_cfg | PROP_rtl)) - print_rtl_graph_with_bb (dump_file_name, get_insns ()); + print_rtl_with_bb (dump_file, get_insns ()); /* Run post-pass cleanup and verification. */ todo = pass->todo_flags_finish; diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c index 12ba54a525e..a4731392f89 100644 --- a/gcc/tree-pretty-print.c +++ b/gcc/tree-pretty-print.c @@ -845,9 +845,11 @@ dump_generic_node (pretty_printer *buffer, tree node, int spc, int flags, pp_character (buffer, ')'); /* The lowered cond_exprs should always be printed in full. */ if (COND_EXPR_THEN (node) - && TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR + && (IS_EMPTY_STMT (COND_EXPR_THEN (node)) + || TREE_CODE (COND_EXPR_THEN (node)) == GOTO_EXPR) && COND_EXPR_ELSE (node) - && TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR) + && (IS_EMPTY_STMT (COND_EXPR_ELSE (node)) + || TREE_CODE (COND_EXPR_ELSE (node)) == GOTO_EXPR)) { pp_space (buffer); dump_generic_node (buffer, COND_EXPR_THEN (node), 0, flags, true);