basic-block.h (struct edge_def): New field "count".

* basic-block.h (struct edge_def): New field "count".
	(struct basic_block_def): Likewise.
	* flow.c (entry_exit_blocks): Add count fileds.
	(split_edge): Keep count information up-to-date.
        (dump_edge_info, dump_flow_info): Dump count fields.

	* final.c (count_instrumented_edges): Rename to edge from arc.
	(end_final): Update users.
	* profile.c: Include expr.h, basic-block.h.
	(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
        (struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
        (ignore_next_note, return_label_execution_count): Kill.
	(bbg_file_name, da_file_name): Kill.
        (edge_info, bb_info): New structures.
        (EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
	(count_instrumented_edges, total_num_edges): Rename to edge from arc.
	(total_num_edges_instrumented): Likewise.
	(init_arc, expand_spanning_tree): Kill.
	(fill_spanning_tree, tablejump_entry_p): Kill.
	(instrument_edges):  Rewrite from instrument_arcs to use
	commit_edge_insertions infrastructure.
	(compute_branch_probabilities): Remove arguments; rewrite for
	CFG infrastructure; use rtl_dump_file directly.
	(branch_prob, find_spanning_tree): Likewise.
	(union_groups, find_group): New.
	(init_branch_prob): Make bbg_file_name and da_file_name local.
	(end_branch_prob): Use rtl_dump_file directly.
	(init_edge_profiler): Rename to edge from arc.
	(output_arc_profiler): Kill.
	(gen_edge_profiler): New.
	(output_func_start_profiler): Turn off profiling.  Make the
	constructor static when we can.
	* rtl.h (branch_prob, end_branch_prob): Update prototypes.

	* toplev.c (DFI_flow): Remove.
	(DFI_cfg, DFI_life): New.
	(dump_file): Update accordingly.
	(compile_file): Call end_branch_prob if profile_arc_flag too.
	(rest_of_compilation): Move flow1 cfg creation to DFI_cfg.  Do edge
	profiling after the CFG is built.  Move flow1 life analysis to
	DFI_life.  Always estimate remaining probabilities.

Co-Authored-By: Richard Henderson <rth@cygnus.com>

From-SVN: r34037
This commit is contained in:
Jan Hubicka 2000-05-19 22:51:49 +02:00 committed by Richard Henderson
parent b6cfd26443
commit 51891abe62
7 changed files with 692 additions and 1203 deletions

View File

@ -1,3 +1,48 @@
2000-05-19 Jan Hubicka <jh@suse.cz>
Richard Henderson <rth@cygnus.com>
* basic-block.h (struct edge_def): New field "count".
(struct basic_block_def): Likewise.
* flow.c (entry_exit_blocks): Add count fileds.
(split_edge): Keep count information up-to-date.
(dump_edge_info, dump_flow_info): Dump count fields.
* final.c (count_instrumented_edges): Rename to edge from arc.
(end_final): Update users.
* profile.c: Include expr.h, basic-block.h.
(struct adj_list, ARC_TARGET, ARC_SOURCE, ARC_COUNT): Kill.
(struct bb_info, label_to_bb, label_to_bb_size, bb_graph): Kill.
(ignore_next_note, return_label_execution_count): Kill.
(bbg_file_name, da_file_name): Kill.
(edge_info, bb_info): New structures.
(EDGE_INFO, BB_INFO, GCOV_INDEX_TO_BB, BB_TO_GCOV_INDEX): New macros.
(count_instrumented_edges, total_num_edges): Rename to edge from arc.
(total_num_edges_instrumented): Likewise.
(init_arc, expand_spanning_tree): Kill.
(fill_spanning_tree, tablejump_entry_p): Kill.
(instrument_edges): Rewrite from instrument_arcs to use
commit_edge_insertions infrastructure.
(compute_branch_probabilities): Remove arguments; rewrite for
CFG infrastructure; use rtl_dump_file directly.
(branch_prob, find_spanning_tree): Likewise.
(union_groups, find_group): New.
(init_branch_prob): Make bbg_file_name and da_file_name local.
(end_branch_prob): Use rtl_dump_file directly.
(init_edge_profiler): Rename to edge from arc.
(output_arc_profiler): Kill.
(gen_edge_profiler): New.
(output_func_start_profiler): Turn off profiling. Make the
constructor static when we can.
* rtl.h (branch_prob, end_branch_prob): Update prototypes.
* toplev.c (DFI_flow): Remove.
(DFI_cfg, DFI_life): New.
(dump_file): Update accordingly.
(compile_file): Call end_branch_prob if profile_arc_flag too.
(rest_of_compilation): Move flow1 cfg creation to DFI_cfg. Do edge
profiling after the CFG is built. Move flow1 life analysis to
DFI_life. Always estimate remaining probabilities.
2000-05-19 Richard Henderson <rth@cygnus.com>
* ifcvt.c (find_if_case_2): Don't allow THEN to be EXIT.

View File

@ -129,6 +129,8 @@ typedef struct edge_def {
int flags; /* see EDGE_* below */
int probability; /* biased by REG_BR_PROB_BASE */
int count; /* Expected number of executions calculated
in profile.c */
} *edge;
#define EDGE_FALLTHRU 1
@ -164,6 +166,8 @@ typedef struct basic_block_def {
/* The active eh region before head and after end. */
int eh_beg, eh_end;
int count; /* Expected number of executions calculated in profile.c */
} *basic_block;
/* Number of basic blocks in the current function. */

View File

@ -159,7 +159,7 @@ static const char *last_filename;
static int count_basic_blocks;
/* Number of instrumented arcs when profile_arc_flag is set. */
extern int count_instrumented_arcs;
extern int count_instrumented_edges;
extern int length_unit_log; /* This is defined in insn-attrtab.c. */
@ -333,7 +333,7 @@ end_final (filename)
if (profile_block_flag)
size = long_bytes * count_basic_blocks;
else
size = long_bytes * count_instrumented_arcs;
size = long_bytes * count_instrumented_edges;
rounded = size;
rounded += (BIGGEST_ALIGNMENT / BITS_PER_UNIT) - 1;
@ -376,8 +376,7 @@ end_final (filename)
if (profile_block_flag)
assemble_integer (GEN_INT (count_basic_blocks), long_bytes, 1);
else
assemble_integer (GEN_INT (count_instrumented_arcs), long_bytes,
1);
assemble_integer (GEN_INT (count_instrumented_edges), long_bytes, 1);
/* zero word (link field) */
assemble_integer (const0_rtx, pointer_bytes, 1);

View File

@ -194,7 +194,8 @@ struct basic_block_def entry_exit_blocks[2]
NULL, /* aux */
ENTRY_BLOCK, /* index */
0, /* loop_depth */
-1, -1 /* eh_beg, eh_end */
-1, -1, /* eh_beg, eh_end */
0 /* count */
},
{
NULL, /* head */
@ -207,7 +208,8 @@ struct basic_block_def entry_exit_blocks[2]
NULL, /* aux */
EXIT_BLOCK, /* index */
0, /* loop_depth */
-1, -1 /* eh_beg, eh_end */
-1, -1, /* eh_beg, eh_end */
0 /* count */
}
};
@ -1382,6 +1384,7 @@ split_edge (edge_in)
/* Wire them up. */
bb->pred = edge_in;
bb->succ = edge_out;
bb->count = edge_in->count;
edge_in->dest = bb;
edge_in->flags &= ~EDGE_CRITICAL;
@ -1392,6 +1395,7 @@ split_edge (edge_in)
edge_out->dest = old_succ;
edge_out->flags = EDGE_FALLTHRU;
edge_out->probability = REG_BR_PROB_BASE;
edge_out->count = edge_in->count;
old_succ->pred = edge_out;
@ -3809,7 +3813,7 @@ insn_dead_p (pbi, x, call_ok, notes)
/* Walk the set of memory locations we are currently tracking
and see if one is an identical match to this memory location.
If so, this memory write is dead (remember, we're walking
backwards from the end of the block to the start. */
backwards from the end of the block to the start). */
temp = pbi->mem_set_list;
while (temp)
{
@ -5608,8 +5612,8 @@ dump_flow_info (file)
register basic_block bb = BASIC_BLOCK (i);
register edge e;
fprintf (file, "\nBasic block %d: first insn %d, last %d, loop_depth %d.\n",
i, INSN_UID (bb->head), INSN_UID (bb->end), bb->loop_depth);
fprintf (file, "\nBasic block %d: first insn %d, last %d, loop_depth %d, count %d.\n",
i, INSN_UID (bb->head), INSN_UID (bb->end), bb->loop_depth, bb->count);
fprintf (file, "Predecessors: ");
for (e = bb->pred; e ; e = e->pred_next)
@ -5652,6 +5656,9 @@ dump_edge_info (file, e, do_succ)
else
fprintf (file, " %d", side->index);
if (e->count)
fprintf (file, " count:%d", e->count);
if (e->flags)
{
static const char * const bitnames[] = {
@ -5690,8 +5697,8 @@ dump_bb (bb, outf)
rtx last;
edge e;
fprintf (outf, ";; Basic block %d, loop depth %d",
bb->index, bb->loop_depth);
fprintf (outf, ";; Basic block %d, loop depth %d, count %d",
bb->index, bb->loop_depth, bb->count);
if (bb->eh_beg != -1 || bb->eh_end != -1)
fprintf (outf, ", eh regions %d/%d", bb->eh_beg, bb->eh_end);
putc ('\n', outf);

File diff suppressed because it is too large Load Diff

View File

@ -1730,10 +1730,8 @@ extern void init_caller_save PARAMS ((void));
/* In profile.c */
extern void init_branch_prob PARAMS ((const char *));
#ifdef BUFSIZ
extern void branch_prob PARAMS ((rtx, FILE *));
extern void end_branch_prob PARAMS ((FILE *));
#endif
extern void branch_prob PARAMS ((void));
extern void end_branch_prob PARAMS ((void));
extern void output_func_start_profiler PARAMS ((void));
/* In reg-stack.c */

View File

@ -261,8 +261,9 @@ enum dump_file_index
DFI_gcse,
DFI_loop,
DFI_cse2,
DFI_cfg,
DFI_bp,
DFI_flow,
DFI_life,
DFI_combine,
DFI_ce,
DFI_regmove,
@ -303,8 +304,9 @@ struct dump_file_info dump_file[DFI_MAX] =
{ "gcse", 'G', 1, 0, 0 },
{ "loop", 'L', 1, 0, 0 },
{ "cse2", 't', 1, 0, 0 },
{ "cfg", 'f', 1, 0, 0 },
{ "bp", 'b', 1, 0, 0 },
{ "flow", 'f', 1, 0, 0 },
{ "life", 'f', 1, 0, 0 }, /* Yes, duplicate enable switch. */
{ "combine", 'c', 1, 0, 0 },
{ "ce", 'C', 1, 0, 0 },
{ "regmove", 'N', 1, 0, 0 },
@ -2372,11 +2374,13 @@ compile_file (name)
end_final (dump_base_name);
if (flag_test_coverage || flag_branch_probabilities)
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
timevar_push (TV_DUMP);
open_dump_file (DFI_bp, NULL);
end_branch_prob (rtl_dump_file);
end_branch_prob ();
close_dump_file (DFI_bp, NULL, NULL_RTX);
timevar_pop (TV_DUMP);
}
@ -3101,33 +3105,32 @@ rest_of_compilation (decl)
cse_not_expected = 1;
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
timevar_push (TV_BRANCH_PROB);
open_dump_file (DFI_bp, decl);
branch_prob (insns, rtl_dump_file);
close_dump_file (DFI_bp, print_rtl, insns);
timevar_pop (TV_BRANCH_PROB);
if (ggc_p)
ggc_collect ();
}
regclass_init ();
/* Print function header into flow dump now
because doing the flow analysis makes some of the dump. */
open_dump_file (DFI_flow, decl);
/* Do control and data flow analysis; wrote some of the results to
the dump file. */
timevar_push (TV_FLOW);
open_dump_file (DFI_cfg, decl);
find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
cleanup_cfg (insns);
close_dump_file (DFI_cfg, print_rtl_with_bb, insns);
if (profile_arc_flag || flag_test_coverage || flag_branch_probabilities)
{
timevar_push (TV_BRANCH_PROB);
open_dump_file (DFI_bp, decl);
branch_prob ();
close_dump_file (DFI_bp, print_rtl_with_bb, insns);
timevar_pop (TV_BRANCH_PROB);
}
open_dump_file (DFI_life, decl);
if (optimize)
{
struct loops loops;
@ -3137,8 +3140,7 @@ rest_of_compilation (decl)
flow_loops_find (&loops);
/* Estimate using heuristics if no profiling info is available. */
if (! flag_branch_probabilities)
estimate_probability (&loops);
estimate_probability (&loops);
if (rtl_dump_file)
flow_loops_dump (&loops, rtl_dump_file, 0);
@ -3156,7 +3158,7 @@ rest_of_compilation (decl)
setjmp_args_warning ();
}
close_dump_file (DFI_flow, print_rtl_with_bb, insns);
close_dump_file (DFI_life, print_rtl_with_bb, insns);
if (ggc_p)
ggc_collect ();