This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] cleanup after slim RTL patch, and add blocks and details options for -fdump-rtl-*
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Bernd Schmidt <bernds_cb1 at t-online dot de>
- Date: Thu, 02 Feb 2006 10:04:33 +0100
- Subject: [PATCH] cleanup after slim RTL patch, and add blocks and details options for -fdump-rtl-*
This patch enables the blocks and details options for RTL dumps. These
are now enabled by default for old-style -dX options, so that they have
no behavioral change.
It also removes a small kludge in dump_flow_info that I introduced in
the patch for slim RTL dumps, in order to avoid touching a dozen files
there. We can pass the dump flags to dump_flow_info now that we use
them more extensively. This is actually the biggest part of the patch.
Bootstrapped/regtested i686-pc-linux-gnu, ok for mainline?
Paolo
2006-02-02 Paolo Bonzini <bonzini@gnu.org>
* cfg.c (dump_flow_info): Get dump flags as an additional parameter.
(debug_flow_info): Pass it.
* alias.c (rest_of_handle_cfg): Adjust calls to dump_flow_info.
* bb-reorder.c (reorder_basic_blocks): Likewise.
* cfgcleanup.c (rest_of_handle_jump2): Likewise.
* cse.c (rest_of_handle_cse, rest_of_handle_cse2): Likewise.
* flow.c (life_analysis, recompute_reg_usage): Likewise.
* gcse.c (gcse_main, bypass_jumps): Likewise.
* ifcvt.c (rest_of_handle_if_conversion): Likewise.
* local-alloc.c (rest_of_handle_local_alloc): Likewise.
* loop-init.c (rtl_loop_init, rtl_loop_done): Likewise.
* profile.c (compute_branch_probabilities, branch_prob): Likewise.
* rtl.h (dump_flow_info): Adjust prototype.
* tracer.c (rest_of_handle_tracer, tracer): Likewise.
* var-tracking.c (variable_tracking_main): Likewise.
* passes.c (execute_todo): Obey TDF_BLOCKS for RTL.
* tree-dump.c (enable_rtl_dump_file): Enable the details and blocks
options.
Index: tracer.c
===================================================================
--- tracer.c (revision 110216)
+++ tracer.c (working copy)
@@ -369,11 +369,11 @@ tracer (unsigned int flags)
cfg_layout_initialize (flags);
mark_dfs_back_edges ();
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
tail_duplicate ();
layout_superblocks ();
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
cfg_layout_finalize ();
/* Merge basic blocks in duplicated traces. */
@@ -391,7 +391,7 @@ static void
rest_of_handle_tracer (void)
{
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
tracer (0);
cleanup_cfg (CLEANUP_EXPENSIVE);
reg_scan (get_insns (), max_reg_num ());
Index: cfg.c
===================================================================
--- cfg.c (revision 110217)
+++ cfg.c (working copy)
@@ -528,17 +528,13 @@ dump_bb_info (basic_block bb, bool heade
}
void
-dump_flow_info (FILE *file)
+dump_flow_info (FILE *file, int flags)
{
basic_block bb;
- if (file == dump_file
- && (dump_flags & TDF_SLIM)
- && !(dump_flags & TDF_DETAILS))
- return;
-
/* There are no pseudo registers after reload. Don't dump them. */
- if (reg_n_info && !reload_completed)
+ if (reg_n_info && !reload_completed
+ && (flags & TDF_DETAILS) != 0)
{
unsigned int i, max = max_reg_num ();
fprintf (file, "%d registers.\n", max);
@@ -589,7 +585,7 @@ dump_flow_info (FILE *file)
fprintf (file, "\n%d basic blocks, %d edges.\n", n_basic_blocks, n_edges);
FOR_EACH_BB (bb)
{
- dump_bb_info (bb, true, true, TDF_DETAILS, "", file);
+ dump_bb_info (bb, true, true, flags, "", file);
check_bb_profile (bb, file);
}
@@ -599,7 +595,7 @@ dump_flow_info (FILE *file)
void
debug_flow_info (void)
{
- dump_flow_info (stderr);
+ dump_flow_info (stderr, TDF_DETAILS);
}
void
Index: flow.c
===================================================================
--- flow.c (revision 110216)
+++ flow.c (working copy)
@@ -437,7 +437,7 @@ life_analysis (FILE *file, int flags)
end_alias_analysis ();
if (file)
- dump_flow_info (file);
+ dump_flow_info (dump_file, dump_flags);
/* Removing dead insns should have made jumptables really dead. */
delete_dead_jumptables ();
@@ -4416,7 +4416,7 @@ recompute_reg_usage (void)
update_life_info (NULL, UPDATE_LIFE_LOCAL, PROP_REG_INFO | PROP_DEATH_NOTES);
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
}
struct tree_opt_pass pass_recompute_reg_usage =
Index: cse.c
===================================================================
--- cse.c (revision 110216)
+++ cse.c (working copy)
@@ -7796,7 +7796,7 @@ rest_of_handle_cse (void)
int tem;
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
reg_scan (get_insns (), max_reg_num ());
@@ -7851,7 +7851,7 @@ rest_of_handle_cse2 (void)
int tem;
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
tem = cse_main (get_insns (), max_reg_num (), dump_file);
Index: loop-init.c
===================================================================
--- loop-init.c (revision 110216)
+++ loop-init.c (working copy)
@@ -161,7 +161,7 @@ static void
rtl_loop_init (void)
{
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
/* Initialize structures for layout changes. */
cfg_layout_initialize (0);
@@ -208,7 +208,7 @@ rtl_loop_done (void)
delete_trivially_dead_insns (get_insns (), max_reg_num ());
reg_scan (get_insns (), max_reg_num ());
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
current_loops = NULL;
}
Index: ifcvt.c
===================================================================
--- ifcvt.c (revision 110216)
+++ ifcvt.c (working copy)
@@ -3902,7 +3902,7 @@ rest_of_handle_if_conversion (void)
if (flag_if_conversion)
{
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
cleanup_cfg (CLEANUP_EXPENSIVE);
reg_scan (get_insns (), max_reg_num ());
if_convert (0);
Index: local-alloc.c
===================================================================
--- local-alloc.c (revision 110216)
+++ local-alloc.c (working copy)
@@ -2559,10 +2559,10 @@ rest_of_handle_local_alloc (void)
timevar_pop (TV_JUMP);
}
- if (dump_enabled_p (pass_local_alloc.static_pass_number))
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
timevar_push (TV_DUMP);
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
dump_local_alloc (dump_file);
timevar_pop (TV_DUMP);
}
Index: gcse.c
===================================================================
--- gcse.c (revision 110216)
+++ gcse.c (working copy)
@@ -688,7 +688,7 @@ gcse_main (rtx f ATTRIBUTE_UNUSED, FILE
max_gcse_regno = max_reg_num ();
if (file)
- dump_flow_info (file);
+ dump_flow_info (file, dump_flags);
/* Return if there's nothing to do, or it is too expensive. */
if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
@@ -6537,7 +6537,7 @@ bypass_jumps (FILE *file)
max_gcse_regno = max_reg_num ();
if (file)
- dump_flow_info (file);
+ dump_flow_info (file, dump_flags);
/* Return if there's nothing to do, or it is too expensive. */
if (n_basic_blocks <= NUM_FIXED_BLOCKS + 1
Index: alias.c
===================================================================
--- alias.c (revision 110216)
+++ alias.c (working copy)
@@ -2710,7 +2710,7 @@ static void
rest_of_handle_cfg (void)
{
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
if (optimize)
cleanup_cfg (CLEANUP_EXPENSIVE
| (flag_thread_jumps ? CLEANUP_THREADING : 0));
Index: profile.c
===================================================================
--- profile.c (revision 110216)
+++ profile.c (working copy)
@@ -471,7 +471,7 @@ compute_branch_probabilities (void)
}
}
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
total_num_passes += passes;
if (dump_file)
@@ -1156,8 +1156,8 @@ branch_prob (void)
/* Re-merge split basic blocks and the mess introduced by
insert_insn_on_edge. */
cleanup_cfg (profile_arc_flag ? CLEANUP_EXPENSIVE : 0);
- if (profile_dump_file())
- dump_flow_info (profile_dump_file());
+ if (profile_dump_file ())
+ dump_flow_info (profile_dump_file (), dump_flags);
}
free_edge_list (el);
Index: cfgcleanup.c
===================================================================
--- cfgcleanup.c (revision 110216)
+++ cfgcleanup.c (working copy)
@@ -2341,7 +2341,7 @@ rest_of_handle_jump2 (void)
delete_trivially_dead_insns (get_insns (), max_reg_num ());
reg_scan (get_insns (), max_reg_num ());
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
cleanup_cfg ((optimize ? CLEANUP_EXPENSIVE : 0) | CLEANUP_PRE_LOOP
| (flag_thread_jumps ? CLEANUP_THREADING : 0));
Index: rtl.h
===================================================================
--- rtl.h (revision 110217)
+++ rtl.h (working copy)
@@ -2041,7 +2041,7 @@ extern rtx move_by_pieces (rtx, rtx, uns
extern void recompute_reg_usage (void);
extern void delete_dead_jumptables (void);
extern void print_rtl_with_bb (FILE *, rtx);
-extern void dump_flow_info (FILE *);
+extern void dump_flow_info (FILE *, int);
/* In expmed.c */
extern void init_expmed (void);
Index: bb-reorder.c
===================================================================
--- bb-reorder.c (revision 110216)
+++ bb-reorder.c (working copy)
@@ -1930,7 +1930,7 @@ reorder_basic_blocks (unsigned int flags
FREE (bbd);
if (dump_file)
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
cfg_layout_finalize ();
if (flag_reorder_blocks_and_partition)
Index: var-tracking.c
===================================================================
--- var-tracking.c (revision 110216)
+++ var-tracking.c (working copy)
@@ -2697,10 +2697,10 @@ variable_tracking_main (void)
vt_find_locations ();
vt_emit_notes ();
- if (dump_file)
+ if (dump_file && (dump_flags & TDF_DETAILS))
{
dump_dataflow_sets ();
- dump_flow_info (dump_file);
+ dump_flow_info (dump_file, dump_flags);
}
vt_finalize ();
Index: passes.c
===================================================================
--- passes.c (revision 110217)
+++ passes.c (working copy)
@@ -752,7 +752,7 @@ execute_todo (struct tree_opt_pass *pass
{
if (dump_flags & TDF_SLIM)
print_rtl_slim_with_bb (dump_file, get_insns (), dump_flags);
- else if (properties & PROP_cfg)
+ else if ((properties & PROP_cfg) && (dump_flags & TDF_BLOCKS))
print_rtl_with_bb (dump_file, get_insns ());
else
print_rtl (dump_file, get_insns ());
Index: tree-dump.c
===================================================================
--- tree-dump.c (revision 110217)
+++ tree-dump.c (working copy)
@@ -1055,7 +1055,7 @@ enable_rtl_dump_file (int letter)
if (letter == 'a')
letter = 0;
- return dump_enable_all (TDF_RTL, letter) > 0;
+ return dump_enable_all (TDF_RTL | TDF_DETAILS | TDF_BLOCKS, letter) > 0;
}