This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: profile.c revamp for new flow.c


On Sun, May 14, 2000 at 10:18:55PM +0200, Jan Hubicka wrote:
> This patch rewrites profile.c to use new flow infrastructure.  This is
> required to make it at least vaguely functional with new ia-32 backend...

Oh cool.  I've been meaning to do this for ages and never 
quite got around to it.

> We don't have basic block boundary after each call, so if single basic
> block contains multiple function calls and one of them don't return,
> gcov output is incorrect for rest of the block.
> 
> I plan to address this later by adding subblocks...

Better to address this by merely splitting the blocks.  We then add
stuff on the edges as normal, and call try_merge_blocks afterward to
repair the damage.

Block splitting is useful elsewhere as well, and it's another thing
I've been meaning to get to sometime...

In any case, in the meantime I agree that this is not critical.

> I can live with -fprofile-arcs for the branch prediction heruistics now,
> since I've modified split_edge to propagate count information, so the
> information is kept up to date after instrumenting the edges for profiling.

I'd like to find some way to accomplish this same thing without having
to add the count field to blocks and edges.  I can't see them being used
outside the profiling code, which means that they could equally well 
live in the "info" structs hanging off the aux field.

This because we can create a _lot_ of edges in Brad's worst-case scenarios,
and there's no sense bloating memory usage when we can avoid it.

However, I didn't see an easy way to do it, and hooking into split_edge
certainly is convenient.  Something to address later...

> The flow dump is getting quite large now :(
> Would be OK to sent separate patch to split it into multiple dumps?
> (.cfg, .pred, .life) probably

I did just this, and cleaned up a number of other things besides.

I was able to instrument and feed back data during a bootstrap on
alphaev67-linux, and a random sampling of dump files looked sane. 
I was not able to actually turn on reorder-blocks; I think there are
bugs lurking there that need tracking down.

Here's the patch I committed.


r~



	* 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.

d-profile-arcs.gz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]