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]
Other format: [Raw text]

[sel-sched] Various cleanups


Hello,

These patches do various cleanups to the selective scheduling code. The cleanups include splitting too large functions onto smaller ones, using the expr_t type and the term expression consistently thorough the scheduler, and cleaning up the data structures and the initialization process. The changes are quite mechanical.

There are two important changes that were hard to separate from the cleanups. The first change introduces the heuristics that try to restrict pipelining on small loops when it is "obvious" that the pipelined and speculated/renamed insn will cause a stall on the speculative check or reg-reg copy. This was implemented by Alexander Monakov. The second change places the correct live set on each insn in a region (their number is below 150) to speed up liveness updates.

Tested on ia64, committed to sel-sched branch.
Andrey

Attachment: cleanups-ii.diff.gz
Description: application/gzip

2008-04-14  Andrey Belevantsev  <abel@ispras.ru>
	    Alexander Monakov  <amonakov@ispras.ru>

	* config/ia64/ia64.c (ia64_h_i_d_extended): Reallocate stops_p
	by larger chunks.
	* cse.c (hash_rtx_cb): New.  
	(hash_rtx): Use it.
	* haifa-sched.c (haifa_sched_finish): Tidy. 
	(sched_finish): Call haifa_finish_h_i_d.
	(extend_h_i_d): Reallocate h_i_d by larget chunks.
	* rtl.c (rtx_equal_p_cb): New.
	(rtx_equal_p): Use it.
	* rtl.h (rtx_equal_p_cb, hash_rtx_cb): New.
	* sched-deps.c (init_deps_data_vector): New.  Allocate h_d_i_d
	by larger chunks.
	(sched_deps_init): Use it.
	(deps_extend_d_i_d, deps_finish_d_i_d, sched_deps_local_finish): Kill.
	* sched-int.h: Kill glat externs.
	(struct _haifa_deps_insn_data): New field cant_move, moved from d_i_d.
	(struct _deps_insn_data): Kill with all uses.
	* sel-sched-ir.h (struct _expr): New field cant_move.
	(_list_alloc): New, split from ... 
	(_list_add): ... here.
	* sel-sched-ir.c (sel_rtx_equal_p, sel_hash_rtx): Kill.
	(skip_unspecs_callback, hash_with_unspec_callback): New.
	(vinsn_init): Use hash_rtx_cb.
	(vinsn_equal_p): Use rtx_equal_p_cb.
	(init_expr, merge_expr_data, copy_expr, 
	init_global_and_expr_for_insn): Update for EXPR_CANT_MOVE.
	(update_target_availability, update_speculative_bits): New, split from ...
	(merge_expr_data): ... here.
	(expr_greater_p, av_set_add_element): New. 
	(av_set_add, av_set_add_nocopy): Use it.
	(join_distinct_sets, av_set_truncate): New.
	(av_set_union_and_clear, av_set_union_and_live): Use them.
	(extend_insn): Reallocate s_i_d by larger chunks.
	(finish_insns): Clear cant_move bit.
	(block_valid_for_bookkeeping_p, find_block_for_bookkeeping, 
	create_block_for_bookkeeping, find_place_for_bookkeeping,
	emit_bookkeeping_insn): New, split from ... 
	(generate_bookkeeping_insn): ... here.
	(stall_for_cycles): New.
	(update_fence_and_insn): New parameter need_stall.
	(fill_insns): Use stall_for_cycles. Pass need_stall
	to update_fence_and_insn.
	(move_op_at_first_insn): Do not remove jumps that are already scheduled.
	(sel_region_init): Tidy.
	(find_ebb_boundaries, reset_sched_cycles_in_current_ebb, put_TImodes,
	sel_region_target_finish): New, split from ... 
	(sel_region_finish): ... here.
	(sel_global_init): Initialize can_issue_more.

Attachment: cleanups-iii.diff.gz
Description: application/gzip

2008-04-14  Andrey Belevantsev  <abel@ispras.ru>

	* common.opt (flag_sel_sched_emulate_haifa, 
	flag_sel_sched_pipelining_verbose, flag_sel_sched_verbose, 
	flag_sel_sched_substitute_inside_insn_group): Kill.  Kill all uses.
	(flag_sel_sched_single_block_regions, flag_sel_sched_ebb_regions, 
	flag_sel_sched_reset_tc_on_join): Likewise.
	* config/ia64/ia64.opt (mflag_sched_spec_verbose, 
	mflag_sel_sched_renaming, mflag_sel_sched_substitution): Likewise.
	* params.def (max-pipeline-region-blocks): Set to 15.
	(max-pipeline-region-insns): Set to 200.
	(selsched-verbose): Kill.
	(selsched-max-lookahead): Set to 50.
	* sel-sched-dump.h (print): Rename to sel_print.  
	* sel-sched-dump.c (push_indent, pop_indent, push_new_line, pop_new_line,
	block_start, block_finish, get_print_blocks_num, line_start, 
	line_finish, free_sel_dump_data): Kill.  Update all uses.
	(debug_find_insn_loop, debug_find_unreachable_blocks,
	av_set_contains_insn_with_uid): Kill.
	* sel-sched-ir.h (rhs_t): Kill.  Change all uses to expr_t.
	Likewise with accessor macros.
	(struct vinsn_def): Inline struct idata_def into it.
	(VINSN_ID): Update.
	(struct _sel_insn_data): New field live.
	(INSN_LIVE): New accessor macro.
	* sel-sched-ir.c (compute_live): Update for INSN_LIVE.
	(update_data_sets, update_liveness_on_insn, 
	compute_live_below_insn, update_data_sets,
	first_time_insn_init, init_first_time_insn_data, 
	free_first_time_insn_data, init_insn): Likewise.

Attachment: cleanups-live.diff.gz
Description: application/gzip

2008-04-14  Alexander Monakov  <amonakov@ispras.ru>

	* common.opt (flag_sel_sched_pipelining_outer_loops): Init to 0.
	(flag_sel_sched_restrict_pipelining): New.
	* sched-rgn.c (find_rgns): Use flag_sel_sched_pipelining.
	* sel-sched-ir.c (deps_init_id_data): New field force_use_p.
	(deps_init_id_start_insn, deps_init_id_finish_lhs,
	deps_init_id_note_reg_set, deps_init_id_note_reg_clobber,
	deps_init_id): Upgrade to use it.
	(tick_check_p): Change return type to int.
	(clear_outdated_rtx_info): Zero INSN_SCHED_TIMES and INSN_AFTER_STALL_P.
	(delete_and_free_basic_block, sel_add_or_remove_bb,
	sel_split_block): Use blocks_to_reschedule.
	(pipeline_outer_loops_init): Rename to sel_init_pipelining.
	(pipeline_outer_loops_finish): Rename to sel_finish_pipelining.
	(sel_find_rgns): Use FOR_EACH_LOOP.

	* sel-sched.c: Update all uses of flag_sel_sched_pipelining_outer_loops
	to check only for current_loop_nest.
	(blocks_to_reschedule): New.
	(end_of_loop_p, check_stalling_p): Remove.
	(fill_vec_av_set): Limit pipelining aggressiveness.
	(move_op_orig_expr_found): Update blocks_to_reschedule.
	(init_seqno, init_seqno_1): Use it.
	(add_region_head): Kill.
	(sel_region_init): Allocate blocks_to_reschedule.
	(sel_region_finish): Free it.
	(sel_sched_region_1): Use blocks_to_reschedule to guide 
	lazy rescheduling.
		

Attachment: cleanups-pipeline-heuristics.diff.gz
Description: application/gzip

2008-04-14  Andrey Belevantsev  <abel@ispras.ru>

	* sel-sched.c (extract_new_fences_from): Move fence to the new ones
	only if the succ insn has not yet been scheduled.  
	(find_best_expr): Tidy.
	(remove_insns_for_debug, compute_av_set_on_boundaries, 
	find_sequential_best_exprs, move_nop_to_previous_block,
	prepare_place_to_insert, move_exprs_to_boundary, 
	advance_state_on_fence, update_fence_and_insn, 
	update_boundaries, schedule_expr_on_boundary): Split from ... 
	(fill_insns): ... here.
	(move_op_ascend): Do not propagate through NOPs.
	(move_op_process_successors): Rename to code_motion_process_successors.
	Fix assert.
	(code_motion_path_driver): Change return type to int.
	Return -1 when we have found the previously created bookkeeping.
	(schedule_on_fences, find_min_max_seqno, calculate_new_fences,
	update_seqnos_and_stage): Split from ... 
	(sel_sched_region_2): ... here.
	* sched-deps.h: Inline into sched-int.h.  Kill.      
	* sel-sched-dump.c (debug_vinsn, debug_vinsn_1, debug_av_set,
	debug_lv_set, debug_ilist, debug_insn_vector, 
	debug_hard_reg_set): Fix '\n' printing.
        

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