gcc/cygwin-gcc.git
13 years agosel-sched.c (advance_one_cycle): Set FENCE_ISSUE_MORE to can_issue_more.heads/sel-sched-branch
Andrey Belevantsev [Tue, 21 Apr 2009 12:29:41 +0000 (21 16:29 +0400)]
sel-sched.c (advance_one_cycle): Set FENCE_ISSUE_MORE to can_issue_more.

        * sel-sched.c (advance_one_cycle): Set FENCE_ISSUE_MORE
        to can_issue_more.
        (advance_state_on_fence): Likewise.
        (sel_target_adjust_priority): Print debug output only when
        sched_verbose >= 4, not 2.
        (get_expr_cost): Do not issue all unique insns on the next cycle.
        (fill_insns): Initialize can_issue_more from the value saved
        with the fence.
        * sel-sched-ir.c (flist_add): New parameter issue_more.
        Init FENCE_ISSUE_MORE with it.
        (merge_fences): Likewise.
        (init_fences): Update call to flist_add.
        (add_to_fences, add_clean_fence_to_fences,
        add_dirty_fence_to_fences): Likewise.
        (move_fence_to_fences): Update call to merge_fences.
        * sel-sched-ir.h (struct _fence): New field issue_more.
        (FENCE_ISSUE_MORE): New accessor macro.

From-SVN: r146520

13 years ago2009-04-21 Andrey Belevantsev <abel@ispras.ru
Andrey Belevantsev [Tue, 21 Apr 2009 12:09:44 +0000 (21 16:09 +0400)]
2009-04-21 Andrey Belevantsev <abel@ispras.ru

2009-04-21  Andrey Belevantsev  <abel@ispras.ru
        * sel-sched.c (try_replace_dest_reg): When chosen register
        and original register is the same, do not bail out early, but
        still check all original insns for validity of replacing destination
        register.  Set EXPR_TARGET_AVAILABLE to 1 before leaving function
        in this case.

2009-04-21  Andrey Belevantsev  <abel@ispras.ru
        Merge witrh trunk rev. 146468.

        * sel-sched-ir.c (sel_redirect_edge_and_branch): When topological order
        has changed, recompute it.

From-SVN: r146519

13 years agoMerge with trunk rev. 143865.
Andrey Belevantsev [Mon, 2 Feb 2009 13:51:54 +0000 (2 16:51 +0300)]
Merge with trunk rev. 143865.

From-SVN: r143868

13 years agoMerge with trunk rev. 141104.
Andrey Belevantsev [Tue, 14 Oct 2008 12:03:21 +0000 (14 16:03 +0400)]
Merge with trunk rev. 141104.

From-SVN: r141107

13 years agoMerge with trunk rev. 141085.
Andrey Belevantsev [Tue, 14 Oct 2008 06:41:30 +0000 (14 10:41 +0400)]
Merge with trunk rev. 141085.

        * config/ia64/ia64.c (ia64_clear_sched_context): Set sc->prev_cycle_state
        to NULL.

From-SVN: r141104

13 years agoia64.opt (mflag_sched_control_spec): Initialize to 2.
Andrey Belevantsev [Mon, 13 Oct 2008 09:13:42 +0000 (13 13:13 +0400)]
ia64.opt (mflag_sched_control_spec): Initialize to 2.

        * config/ia64/ia64.opt (mflag_sched_control_spec): Initialize to 2.
        * config/ia64/ia64.c (ia64_set_sched_flags): Fix thinko.
        (ia64_reorg): Do not set mflag_sched_control_spec to 1 here...
        (ia64_override_options): ... but process it here instead.

From-SVN: r141086

13 years agoMerge with trunk rev. 140935.
Andrey Belevantsev [Thu, 9 Oct 2008 06:53:46 +0000 (9 10:53 +0400)]
Merge with trunk rev. 140935.

        * config/ia64/ia64.opt (msel-sched-data-spec, msel-sched-control-spec,
        mstop-bit-before-check): Remove.
        (ia64_set_sched_flags): When determining supported speculation types,
        use only msched-* flags.
        (ia64_reorg): Enable control speculation for selective scheduling.

From-SVN: r140999

13 years agoia64.c (get_mode_no_for_insn): Fix thinko.
Alexander Monakov [Fri, 26 Sep 2008 13:00:48 +0000 (26 17:00 +0400)]
ia64.c (get_mode_no_for_insn): Fix thinko.

2008-09-26  Alexander Monakov  <amonakov@ispras.ru>
        * config/ia64/ia64.c (get_mode_no_for_insn): Fix thinko.

From-SVN: r140692

13 years agoBring back ia64 changes to the branch by undoing 2008-08-31 revertion commit.
Alexander Monakov [Fri, 26 Sep 2008 11:21:07 +0000 (26 15:21 +0400)]
Bring back ia64 changes to the branch by undoing 2008-08-31 revertion commit.

2008-09-26  Alexander Monakov  <amonakov@ispras.ru>
        Bring back ia64 changes to the branch by undoing 2008-08-31 revertion
        commit.

        * config/ia64/ia64.c: Cleanup whitespace.
        * sel-sched-ir.h (maybe_tidy_empty_bb): Do not attempt to delete a
        block if there are complex incoming edges.
        (sel_merge_blocks): Remove useless assert.
        (sel_redirect_edge_and_branch): Check that edge was redirected.
        * sel-sched-ir.h (_eligible_successor_edge_p): Remove assert.
        (sel_find_rgns): Delete declaration.
        * sel-sched.c (purge_empty_blocks): Attempt to remove first block of
        the region when it is not a preheader.

From-SVN: r140690

13 years agoMerge with trunk rev. 140687.
Andrey Belevantsev [Fri, 26 Sep 2008 10:27:23 +0000 (26 14:27 +0400)]
Merge with trunk rev. 140687.

From-SVN: r140688

13 years agoMerge with trunk rev. 139848.
Andrey Belevantsev [Mon, 1 Sep 2008 07:45:35 +0000 (1 11:45 +0400)]
Merge with trunk rev. 139848.

From-SVN: r139853

13 years agors6000.c (rs6000_sched_finish): Check sel_sched_p () in separate condition.
Andrey Belevantsev [Mon, 1 Sep 2008 07:31:59 +0000 (1 11:31 +0400)]
rs6000.c (rs6000_sched_finish): Check sel_sched_p () in separate condition.

        * config/rs6000/rs6000.c (rs6000_sched_finish): Check sel_sched_p ()
        in separate condition.
        * haifa-sched.c (increase_insn_priority): New.
        * sched-int.h (get_rgn_sched_max_insns_priority): Declare.
        (sel_add_to_insn_priority): Likewise.
        (increase_insn_priority): Likewise.
        * sel-sched.c (sel_target_adjust_priority): New.
        (fill_vec_av_set): Call it.  Account for adjusted priority.
        (sel_add_to_insn_priority): New.
        (sel_rank_for_schedule): When comparing, also account for adjusted
        priority.
        * sel-sched-ir.c (init_expr): Clear EXPR_PRIORITY_ADJ.
        (clear_outdated_rtx_info): Likewise.
        (sel_setup_sched_infos): Also setup sched_max_insns_priority.
        * sel-sched-ir.h (struct _expr): New field priority_adj.
        (EXPR_PRIORITY_ADJ): New accessor macro.
        * sched-rgn.c (get_rgn_sched_max_insns_priority): New.

From-SVN: r139852

13 years ago*: Make it as on trunk.
Andrey Belevantsev [Mon, 1 Sep 2008 07:05:09 +0000 (1 11:05 +0400)]
*: Make it as on trunk.

        * config/ia64/*: Make it as on trunk.
        * config/ia64/ia64.c (TARGET_SCHED_GEN_SPEC_CHECK): Define to ia64_gen_check.
        * target.h (struct gcc_target): Change the argument of needs_block_p to
        const_rtx.  Change the third argument of gen_spec_check to bool.  Update comment.
        * haifa-sched.c (create_check_block_twin): Pass correct parameters to
        gen_spec_check and needs_block_p.
        * sel-sched.c (create_speculation_check): Likewise.

From-SVN: r139850

13 years agoMerge with trunk rev. 139840.
Andrey Belevantsev [Sun, 31 Aug 2008 19:17:50 +0000 (31 23:17 +0400)]
Merge with trunk rev. 139840.

From-SVN: r139842

13 years agosel-sched.c (struct moveop_static_params): Add new field failed_insn for runtime...
Alexander Monakov [Sun, 31 Aug 2008 18:42:39 +0000 (31 22:42 +0400)]
sel-sched.c (struct moveop_static_params): Add new field failed_insn for runtime assertion purpose.

2008-08-31  Alexander Monakov  <amonakov@ispras.ru>
            Andrey Belevantsev  <abel@ispras.ru>

        * sel-sched.c (struct moveop_static_params): Add new field
        failed_insn for runtime assertion purpose.
        (move_op): Initialize it.
        (move_op_orig_expr_not_found): Update it.
        (try_replace_dest_reg): Mark target register as available if chosen
        register is the same as original.
        (av_set_could_be_blocked_by_bookkeeping_p): Define only if
        ENABLE_CHECKING.  Add new parameter (static_params).  Extend to
        operate correctly for bookkeeping insns created during current code
        motion.
        (find_sequential_best_exprs): If availability of target register was
        unknown and no renaming happened, assert that target register is
        available and update expression attribute.
        (code_motion_process_successors): Update call to
        av_set_could_be_blocked_by_bookkeeping_p.  Surround costly runtime
        assertion in #ifdef ENABLE_CHECKING.

Co-Authored-By: Andrey Belevantsev <abel@ispras.ru>
From-SVN: r139841

13 years agoia64.c (ia64_optimization_options): Run selective scheduling when optimize >= 3,...
Andrey Belevantsev [Fri, 22 Aug 2008 14:33:26 +0000 (22 18:33 +0400)]
ia64.c (ia64_optimization_options): Run selective scheduling when optimize >= 3, not 2.

* config/ia64/ia64.c (ia64_optimization_options): Run selective
scheduling when optimize >= 3, not 2.

From-SVN: r139475

13 years agotarget.h (struct gcc_target): Fix typo in comment.
Alexander Monakov [Fri, 22 Aug 2008 13:44:54 +0000 (22 17:44 +0400)]
target.h (struct gcc_target): Fix typo in comment.

2008-08-22  Alexander Monakov  <amonakov@ispras.ru>
            Andrey Belevantsev  <abel@ispras.ru>

        * target.h (struct gcc_target): Fix typo in comment.
        Add comments for alloc_sched_context, clear_sched_context
        and free_sched_context hooks.
        * sched-int.h (dump_insn_slim_1): Remove declaration.
        Remove commented dep_weak declaration.
        * Makefile.in (sched-vis.o): Add $(INSN_ATTR_H).
        * sched-rgn.c (rgn_common_sched_info): Add comment.
        (rgn_sched_deps_info, rgn_const_sched_deps_info,
        rgn_const_sel_sched_deps_info): Likewise.
        (rgn_sched_info): Likewise.
        (ref_counts): Likewise.
        (rgn_setup_sched_infos): Likewise.
        * sched-vis.c (dump_insn_slim_1): Inline in dump_insn_slim
        and remove.

Co-Authored-By: Andrey Belevantsev <abel@ispras.ru>
From-SVN: r139470

13 years agoinvoke.texi (fsel-sched-bookkeeping, [...]): Remove documentation.
Andrey Belevantsev [Fri, 22 Aug 2008 13:19:03 +0000 (22 17:19 +0400)]
invoke.texi (fsel-sched-bookkeeping, [...]): Remove documentation.

        * doc/invoke.texi (fsel-sched-bookkeeping, fsel-sched-renaming,
        fsel-sched-substitution): Remove documentation.
        (fsel-sched-dump-cfg): Likewise.
        (fsel-sched-pipelining-outer-loops): Add documentation.
        (max-pipeline-region-blocks, max-pipeline-region-insns,
        sched-mem-true-dep-cost): Document parameters.
        (selsched-max-insns-to-rename): Likewise.
        * params.def: Move comment about PARAM_SCHED_MEM_TRUE_DEP_COST
        to doc/invoke.texi.

From-SVN: r139455

13 years agodbgcnt.def (sel_sched_cnt, [...]): New counters.
Andrey Belevantsev [Fri, 22 Aug 2008 13:15:29 +0000 (22 17:15 +0400)]
dbgcnt.def (sel_sched_cnt, [...]): New counters.

        * dbgcnt.def (sel_sched_cnt, sel_sched_region_cnt,
        sel_sched_insn_cnt): New counters.
        * sel-sched.c: Include dbgcnt.h.
        (remove_insns_for_debug): Remove insns basing on debug counter.
        Compile always.
        (fill_insns): Remove ENABLE_ASSERT_CHECKING around
        remove_insns_for_debug call.
        (sel_sched_region): Schedule region also based on debug counter.
        (maybe_skip_selective_scheduling): Skip when debug counter tells us.

From-SVN: r139454

13 years agosel-sched.c: Fix spacing in the overview comment.
Andrey Belevantsev [Fri, 22 Aug 2008 13:11:46 +0000 (22 17:11 +0400)]
sel-sched.c: Fix spacing in the overview comment.

* sel-sched.c: Fix spacing in the overview comment.
(enum MOVEUP_EXPR_CODE): Fix formatting, document entries.
(struct sel_sched_region_2_data_def,
sel_sched_region_2_data_t): Remove.
(vec_target_unavailable_vinsns): Document.
(stat_bookkeeping_copies, stat_insns_needed_bookkeeping,
stat_renamed_scheduled, stat_substitutions_total): Likewise.
(code_motion_path_driver): Change return type to bool.
(extract_new_fences_from): Fix comment.  Pass orig_max_seqno
instead of data.
(substitute_reg_in_expr): Document parameters.
(vinsn_writes_one_of_regs_p): Likewise.
(mode_ok_for_rename_p): Remove.
(reg_rename_this_tick): Document.
(choose_best_reg_1): Update comment.  Document parameters.
(choose_best_reg): Likewise.
(verify_target_availability): Likewise.
(collect_unavailable_regs_from_bnds): Likewise.
(find_best_reg_for_expr): Likewise.  Fix formatting.
(get_spec_check_type_for_insn): Remove unneeded forward declaration.
(can_speculate_dep_p): Fix comment.
(CANT_MOVE_TRAPPING): Document.
(moveup_expr): Fix typo in comment.
(try_bitmap_cache): Document parameters.
(try_transformation_cache): Likewise.
(compute_av_set_at_bb_end): Likewise.
(compute_live_after_bb): Likewise.
(find_used_regs): Update comment.
(process_pipelined_exprs): Likewise.
(fill_vec_av_set): Likewise.  Also document missing parameters.
(fill_ready_list): Likewise.
(invoke_reorder_hooks): Likewise.
(invoke_aftermath_hooks): Likewise.
(compute_av_set_on_boundaries): Likewise.
(find_sequential_best_exprs): Likewise.
(update_fence_and_insn): Likewise.
(update_boundaries): Likewise.
(move_op_after_merge_succs): Add blank line.
(maybe_emit_renaming_copy): Document parameters.
(maybe_emit_speculative_check): Likewise.
(remove_insn_from_stream): Likewise.
(move_op_orig_expr_found): Likewise.
(code_motion_process_successors): Likewise.
(code_motion_path_driver_cleanup): Likewise.
(code_motion_path_driver): Likewise.  Change return type to bool.
(move_op): Update comment.  Document missing parameters.
(init_seqno_1): Likewise.
(init_seqno): Likewise.
(schedule_on_fences): Likewise.
(calculate_new_fences): Pass orig_max_seqno instead of data.
(update_seqnos_and_stage): Document parameters.
(sel_sched_region_2): Pass orig_max_seqno instead of data.  Document it.
(sel_sched_region_1): Remove data variable, add orig_max_seqno.
Update all uses.

From-SVN: r139453

13 years agosel-sched.c (move_op): Fix typo in comment.
Alexander Monakov [Fri, 22 Aug 2008 12:52:51 +0000 (22 16:52 +0400)]
sel-sched.c (move_op): Fix typo in comment.

2008-08-22  Alexander Monakov  <amonakov@ispras.ru>

        * sel-sched.c (move_op): Fix typo in comment.
        * sched-int.h (add_forw_dep, compute_forward_dependences,
        add_or_update_back_dep, add_or_update_back_forw_dep,
        add_back_forw_dep, delete_back_forw_dep): Remove prototypes.
        (sched_deps_local_finish): Likewise.
        * sched-rgn.c: Do not include cselib.h.
        (compute_block_dependences): Remove if 0'd code.

From-SVN: r139451

13 years agosel-sched.c (move_exprs_to_boundary): Do not call print_marker_to_log.
Andrey Belevantsev [Fri, 22 Aug 2008 11:50:55 +0000 (22 15:50 +0400)]
sel-sched.c (move_exprs_to_boundary): Do not call print_marker_to_log.

* sel-sched.c (move_exprs_to_boundary): Do not call print_marker_to_log.
* sel-sched-ir.c (regset_pool, nop_pool): Document fields.
(finish_insns): Move forward declaration up.
(def_list_add): Add blank line.
(_advance_deps_context_sched_deps_info): Remove underscore in name,
adjust alll users, add comment.
(merge_fences): Document parameters.
(get_regset_from_pool): Document return value.
(get_clear_regset_from_pool): Likewise.
(return_regset_to_pool): Document function.
(cmp_v_in_regset_pool): Document function and parameters.
(free_regset_pool): Likewise.  Use #ifdef ENABLE_CHECKING instead of
ENABLE_SEL_CHECKING.  Add new page symbol after the function.
(skip_unspecs_callback): Document parameters.
(hash_with_unspec_callback): Likewise.
(vinsn_init): Likewise.
(find_in_history_vect_1): Likewise.
(find_in_history_vect): Likewise.
(insert_in_history_vect): Likewise.
(update_target_availability): Likewise.
(update_speculative_bits): Likewise.
(merge_expr): Likewise.
(speculate_expr): Likewise.
(sel_init_global_and_expr): Likewise.  Remove extra parentheses.
(deps_init_id_data): Document fields.
(deps_init_id_sched_deps_info, const_deps_init_id_sched_deps_info):
Document variables.
(has_dependence_sched_deps_info, const_has_dependence_sched_deps_info):
Likewise.
(sel_clear_has_dependence): Document function.
(has_dependence_p): Document parameters.
(tidy_control_flow): Likewise.
(copy_lv_set_from): Likewise.
(get_av_set): Document return parameter.
(tick_check_dep_with_dw): Remove assert.
(_tick_check_sched_deps_info): Remove underscore, document.
(verify_backedges): Move comment before the function.
(has_dependence_data): When declaring, remove _has_dependence_data.
(succs_info_pool): Document fields.
(compute_succs_info): Document parameters.
(sel_remove_empty_bb): Likewise.
(change_loops_latches): Likewise.
(sel_create_recovery_block): Likewise.
(create_vinsn_from_insn_rtx): Likewise.
(setup_nop_and_exit_insns): Remove extra parentheses.
(get_all_loop_exits): Likewise.
(bb_top_order_comparator): Fix comment.
* sel-sched-ir.h (ENABLE_SEL_CHECKING): Remove.
(struct _expr): Document usefulness field.
(struct _bnd): Document fields.
(_list_iterator): Likewise.
(struct idata_def): Remove commented field.
(struct transformed_insns): Document fields.
(INSN_NOP_P): Fix typo in comment.
(IN_CURRENT_FENCE_P): Likewise.
* sel-sched-dump.c: Do not include unistd.h.
(switch_dump): Document.  Add assert.
(sched_dump1): Rename to saved_sched_dump.
(restore_dump): Document.
(dump_vinsn_flags, debug_vinsn_flags, debug_expr_flags,
debug_insn_flags): Likewise.
(dump_all): Remove.  Update all code.
(dump_insn_rtx_1): Document.
(dump_insn_rtx): Likewise.
(debug_insn_rtx): Likewise.
(dump_vinsn_1): Likewise.
(dump_vinsn): Likewise.
(debug_vinsn): Likewise.
(dump_expr, debug_expr): Likewise.
(debug_insn): Likewise.
(dump_insn_1): Remove dead code.
(sel_prepare_string_for_dot_label): Make arrays static.
(insn_uid, block_for_insn, bb_av_set, insn_pattern, insn_code,
insn_is_set_p, hard_regno_rename_ok): Remove.
* sel-sched-dump.h (SEL_DUMP_CFG_*): Remove.
(enum sel_dump_cfg_def): Document fields.
(enum dump_insn_rtx_def): Likewise.  Kill first underscore from name,
add def suffix.
(enum dump_vinsn_def): Likewise.
(enum dump_expr_def): Likewise.
(enum dump_insn_def): Likewise.  Remove unneeded entries.
(enum _dump_idata): Remove.
(sel_print_to_dot, sel_print): Document macros.
(print_marker_to_log, insn_uid, block_for_insn, bb_av_set,
insn_pattern, insn_code, insn_is_set_p, hard_regno_rename_ok): Remove
declarations.
(debug_find_insn_loop, debug_find_unreachable_blocks, sel_debug_cfg,
mem_test, in_range_p, av_set_contains_insn_with_uid, av_set_for_bb_n,
sel_get_stat_file): Likewise.
* rtl.c (rtx_equal_p_cb): Remove unneeded blank line before function.

From-SVN: r139438

13 years agosel-sched.c (try_replace_dest_reg): Remove assert with insn_rtx_valid.
Andrey Belevantsev [Fri, 22 Aug 2008 11:19:59 +0000 (22 15:19 +0400)]
sel-sched.c (try_replace_dest_reg): Remove assert with insn_rtx_valid.

        * sel-sched.c (try_replace_dest_reg): Remove assert
        with insn_rtx_valid.
        * sel-sched-ir.c (insn_rtx_valid): Remove.
        (create_insn_rtx_from_pattern_1): Inline in ...
        (create_insn_rtx_from_pattern): ... here.  Do not call
        insn_rtx_valid, call recog_memoized instead.
        (create_copy_of_insn_rtx): Do not assert anything with
        insn_rtx_valid.
        * sel-sched-ir.h (insn_rtx_valid): Remove declaration.

From-SVN: r139437

13 years agohaifa-sched.c (sched_verbose_param): Make static.
Andrey Belevantsev [Fri, 22 Aug 2008 11:13:07 +0000 (22 15:13 +0400)]
haifa-sched.c (sched_verbose_param): Make static.

        * haifa-sched.c (sched_verbose_param): Make static.
        * sel-sched.c (reset_sched_cycles_p): Remove.
        (sel_sched_region_run): Likewise.
        (fill_insns_run): Likewise.
        (create_speculation_check): Do not call sel_dump_cfg.
        (move_exprs_to_boundary): Likewise.
        (remove_insns_for_debug): Never remove insns for now.
        (sel_region_init): Set preheader_removed to false here
        instead of sel_sched_region_1.
        (sel_region_target_finish): New parameter reset_sched_cycles_p.
        Use it instead of the former global variable.
        (sel_region_finish): Likewise.
        (sel_sched_region_1): Remove code that did full rescheduling.
        Remove calls to sel_dump_cfg.  Do not use debug parameters
        to decide whether the region should be skipped.
        (sel_sched_region): New local variable reset_sched_cycles_p.
        Pass it to sel_region_finish instead of the global variable.
        (maybe_skip_selective_scheduling): Always return false for now.
        (run_selective_scheduling): Do not call sel_dump_cfg_1 and
        do not prepare code for that.
        * opts.c (case OPT_fsel_insn_range): Remove.
        * sel-sched-ir.c (sel_split_edge): Move find_new_jump call after
        sel_add_bb.
        * sel-sched-dump.c: Remove wrong POSIX includes.
        (sel_stat_file): Remove.
        (flag_insn_range, sel_stat_output_buf): Remove.
        (sel_dump_cfg_insn, sel_dump_cfg_edge, sel_dump_cfg_2,
        sel_dump_cfg_1): Make static.
        (mem_test, in_range_p, in_range_p_1, sel_sched_fix_param,
        sel_get_stat_filename, sel_get_stat_file): Remove.
        * sel-sched-dump.h (flag_insn_range): Remove declaration.
        (sel_dump_cfg_insn, sel_dump_cfg_edge, sel_dump_cfg_2,
        sel_dump_cfg_1): Likewise.
        * common.opt (flag_sel_sched_bookkeeping, flag_sel_sched_renaming,
        flag_sel_sched_substitution, flag_sel_sched_dump_cfg,
        fsel-insn-range): Remove flags and all uses.
        * sched-int.h (sched_verbose_param): Remove declaration.
        * params.def (PARAM_SELSCHED_DUMP_CFG_FLAGS, PARAM_SEL1_*,
        PARAM_SEL2_*, PARAM_REGION_*, PARAM_INSN_*): Remove parameters
        and all uses.

From-SVN: r139436

13 years agohaifa-sched.c (dep_weak): Remove declaration.
Alexander Monakov [Fri, 22 Aug 2008 10:50:08 +0000 (22 14:50 +0400)]
haifa-sched.c (dep_weak): Remove declaration.

2008-08-22  Alexander Monakov  <amonakov@ispras.ru>

        * haifa-sched.c (dep_weak): Remove declaration.
        (sched_extend_bb): Likewise.
        (move_insn): Make static.
        (try_ready): Use ds_weak instead of dep_weak.
        (dep_weak): Kill.
        (sched_extend_bb, sched_init_bbs): Move up after
        find_fallthru_edge.

        * sched-int.h (move_insn): Remove declaration.

From-SVN: r139434

13 years agofinal.c (compute_alignments): Free dominance info after loop_optimizer_finalize.
Alexander Monakov [Wed, 20 Aug 2008 10:55:59 +0000 (20 14:55 +0400)]
final.c (compute_alignments): Free dominance info after loop_optimizer_finalize.

2008-08-20  Alexander Monakov  <amonakov@ispras.ru>

        * final.c (compute_alignments): Free dominance info after
        loop_optimizer_finalize.

From-SVN: r139268

13 years agoAdditionally merge rev. 139129.
Andrey Belevantsev [Wed, 20 Aug 2008 10:53:08 +0000 (20 14:53 +0400)]
Additionally merge rev. 139129.

From-SVN: r139267

13 years agobackport: sel-sched-ir.c (vinsn_init): Rename `class' to `insn_class'.
Andrey Belevantsev [Mon, 18 Aug 2008 14:50:38 +0000 (18 18:50 +0400)]
backport: sel-sched-ir.c (vinsn_init): Rename `class' to `insn_class'.

2008-08-18  Andrey Belevantsev  <abel@ispras.ru>

        Merge with trunk rev. 139128.

        * sel-sched-ir.c (vinsn_init): Rename `class' to `insn_class'.
        * sel-sched.c (substitute_reg_in_expr): Rename `new' to `new_rtx'.

From-SVN: r139199

13 years agoemit-rtl.c (add_insn, [...]): Remove calls to rtl_hooks.insn_added.
Andrey Belevantsev [Fri, 15 Aug 2008 12:21:47 +0000 (15 16:21 +0400)]
emit-rtl.c (add_insn, [...]): Remove calls to rtl_hooks.insn_added.

        * emit-rtl.c (add_insn, add_insn_after, add_insn_before,
        emit_insn_after_1): Remove calls to rtl_hooks.insn_added.
        * emit-rtl.h (struct rtl_hooks): Remove insn_added field.
        * rtlhooks-def.h (RTL_HOOKS_INSN_ADDED): Remove.
        (RTL_HOOKS_INITIALIZER): Remove RTL_HOOKS_INSN_ADDED.
        * sel-sched-ir.c (insn_init): Remove variable and all uses.
        (bulk_tc): Fix comment.
        (init_insn): Rename to init_insn_data.  Update all uses.
        (extend_insn): Rename to extend_insn_data.  Update all uses.
        (init_simplejump): Rename to init_simplejump_data.  Update all uses.
        (sel_rtl_insn_added): Remove function and all uses.
        (orig_rtl_hooks, sel_register_rtl_hooks,
        sel_unregister_rtl_hooks): Remove.
        (sel_init_new_insns): Rename to sel_init_new_insn.  New parameters
        insn and flags.  Do not call sched_scan, call extend/init functions
        directly.  Init data sets for basic block here when the new insn is
        the first in the bb.
        (sel_finish_new_insns): Remove.
        (get_nop_from_pool): New variable flags.  Call sel_init_new_insn
        with new nop and flags.
        (sel_gen_insn_from_rtx_after): Pass emitted insn to sel_init_new_insn.
        (sel_gen_insn_from_expr_after): Likewise.
        (init_invalid_lv_set): Remove.
        (init_invalid_av_set): Rename to invalidate_av_set.  Correct assert.
        (init_invalid_data_sets): Rename to create_initial_data_sets.
        (jump_destination, jump_to_back_edge_p, path_contains_back_edge_p,
        path_contains_switch_of_sched_times_p): Remove dead functions.
        (sel_add_bb): Tidy, improve comments.  Remove excessive checking.
        (can_add_real_insns_p): Remove variable and all uses.
        (check_for_new_jump, find_new_jump): New functions to locate jumps
        when altering control flow.
        (sel_split_edge): New variable prev_max_uid.  Use it to find new jump
        and init its data via sel_init_new_insn.
        (sel_redirect_edge_and_branch_force): Likewise.
        (sel_redirect_edge_and_branch): Likewise.
        (sel_create_recovery_block): Init a jump from recovery block with
        sel_init_new_insn.
        * sel-sched-ir.h (insn_init, sel_register_rtl_hooks,
        sel_unregister_rtl_hooks, can_add_real_insns_p, insn_init_what,
        struct _insn_init, insn_init): Remove declarations.
        (enum _deps_where): Rename to enum deps_where_def.
        (struct _sel_global_bb_info): Typedef to avoid underscore.
        * haifa-sched.c (sched_create_recovery_block): Fix comment.
        (sched_create_recovery_edges): Likewise.

From-SVN: r139128

13 years agocommon.opt (fsel-sched-restrict-pipelining): Remove.
Alexander Monakov [Fri, 15 Aug 2008 12:19:37 +0000 (15 16:19 +0400)]
common.opt (fsel-sched-restrict-pipelining): Remove.

2008-08-15  Alexander Monakov  <amonakov@ispras.ru>

        * common.opt (fsel-sched-restrict-pipelining): Remove.
        * sched-rgn.c (find_rgns): Update comment.
        * sel-sched-ir.c (expr_greater_p): Remove.
        (av_set_add_element): Simplify.  Update all callers.
        (join_distinct_sets): Simplify.  Update all callers.
        (av_set_truncate): Remove.
        * sel-sched-ir.h (av_set_truncate): Remove.
        * sel-sched.c (create_speculation_check): Decrease priority of
        generated check instructions.
        (fill_vec_av_set): Rewrite pipelining heuristics.
        (fill_insns): Do not stall for too long without updating fence.

From-SVN: r139127

14 years agosel-sched-ir.c (sel_add_or_remove_bb): Remove prototype.
Andrey Belevantsev [Tue, 22 Jul 2008 13:56:14 +0000 (22 17:56 +0400)]
sel-sched-ir.c (sel_add_or_remove_bb): Remove prototype.

2008-07-22  Andrey Belevantsev  <abel@ispras.ru>

        * sel-sched-ir.c (sel_add_or_remove_bb): Remove prototype.
        (can_add_insns_p): Remove as it is unused.
        (find_place_to_insert_bb): Move here the code finding the place
        for bb in the region array from ...
        (sel_add_or_remove_bb_1): ... here.  Remove and factor out the rest
        of the code to ...
        (add_block_to_current_region, remove_bb_from_region): ... these
        new functions.
        (sel_add_or_remove_bb): Remove, factoring out the code to ...
        (sel_add_bb, sel_remove_bb): ... these new functions.
        (sel_create_basic_block_before): Remove as it is unused.
        (sel_remove_empty_bb): Tidy.
        (remove_empty_bb, sel_remove_loop_preheader): Use sel_remove_bb.
        (sel_split_block, sel_split_edge, sel_create_recovery_block,
        sel_redirect_edge_and_branch_force): Use sel_add_bb instead of
        sel_add_or_remove_bb.
        (sel_add_loop_preheaders): Use sel_add_bb instead of
        sel_add_or_remove_bb_1.

        * sel-sched-ir.h (sel_create_basic_block_before): Remove prototype.

From-SVN: r138059

14 years agoMerge with trunk rev. 134323:137351.
Andrey Belevantsev [Mon, 7 Jul 2008 14:03:27 +0000 (7 18:03 +0400)]
Merge with trunk rev. 134323:137351.

        * haifa-sched.c (sched_extend_ready_list): Cast xrecalloc call.
        (sched_insn_is_legitimate_for_speculation): Use CONST_CAST_RTX.
        * sched-deps.c (maybe_extend_reg_info_p): Cast xrecalloc call.
        (sched_analyze_insn): Remove previous merge glitch.
        * sel-sched-dump.c (sel_dump_cfg_1): Use XNEWVEC instead of xmalloc.
        (mem_test): Likewise.
        * sel-sched-dump.h (sel_print_to_dot): Use XALLOCAVEC.
        * sel-sched-ir.c (copy_deps_context): Use XNEW.
        (init_fences, add_clean_fence_to_fences, add_dirty_fence_to_fences):
        Use XNEWVEC.
        (get_regset_from_pool, return_regset_to_pool): Use XRESIZEVEC.
        (return_nop_to_pool): Likewise.
        (cfg_preds_1): Likewise.
        (skip_unspecs_callback): Use CONST_CAST_RTX.
        (vinsn_create): Use XCNEW.
        (alloc_sched_pools): Use XCNEWVEC.
        (sel_create_basic_block): Cast headp and endp to rtx.
        * sel-sched.c (try_transformation_cache): Cast htab_find_with_hash
        result to 'struct transformed_insns'.
        (propagate_lv_set): Use df_simulate_one_insn.
        (fill_vec_av_set): Cast result of xrecalloc call.
        (schedule_expr_on_boundary): Use XALLOCA.
        (move_op_merge_succs): Properly cast static_params.
        (fur_merge_succs, move_op_after_merge_succs,
        move_op_orig_expr_found. fur_orig_expr_found,
        move_op_at_first_insn, move_op_ascend, fur_on_enter,
        move_op_orig_expr_not_found): Likewise.
        (run_selective_scheduling): Use XNEWVEC.

From-SVN: r137568

14 years agocfghooks.c (make_forwarder_block): Also check that dummy->loop_father is not NULL.
Andrey Belevantsev [Wed, 2 Jul 2008 09:56:58 +0000 (2 13:56 +0400)]
cfghooks.c (make_forwarder_block): Also check that dummy->loop_father is not NULL.

        * cfghooks.c (make_forwarder_block): Also check that dummy->loop_father
        is not NULL.
        * cfgloopmanip.c (create_preheader): Fix comment before function.
        Factor the conditional into three simpler ones.
        * cse.c (hash_rtx_cb): Fix whitespace formatting and indentation.
        * final.c (compute_alignments): Export.
        * genautomata.c (output_default_latencies): Add comment before function.
        (output_maximal_insn_latency_func): Fix typo in comment.
        * hard-reg-set.h (hard_reg_set_iter_set): Remove label 'next_bit'.
        Use break instead of goto.
        * passes.c (init_optimization_passes): Move pass_compute_alignments
        to its previous location.
        * rtl.h (compute_alignments): Export.
        (insn_added): Remove macro.  Adjust all uses to be rtl_hooks.insn_added.
        * sched-ebb.c (ebb_sched_deps_info): Init use_cselib bit to 1.
        * sel-sched.c (init_hard_regno_rename): Include this function only if
        HARD_REGNO_RENAME_OK is defined.
        * sel-sched-dump.c (hard_regno_rename_ok): Ditto.
        * sel-sched-ir.c (remove_empty_bb): Use redirect_edge_succ_nodup.
        * config/ia64/ia64.c (ia64_reorg): Call compute_alignments after
        scheduling.

From-SVN: r137348

14 years agotimevar.def (TV_SEL_SCHED): Remove.
Andrey Belevantsev [Mon, 2 Jun 2008 11:05:58 +0000 (2 15:05 +0400)]
timevar.def (TV_SEL_SCHED): Remove.

        * timevar.def (TV_SEL_SCHED): Remove.

From-SVN: r136275

14 years agocfghooks.h (rtl_delete_block_not_barriers): Remove prototype.
Andrey Belevantsev [Mon, 2 Jun 2008 10:42:38 +0000 (2 14:42 +0400)]
cfghooks.h (rtl_delete_block_not_barriers): Remove prototype.

        * cfghooks.h (rtl_delete_block_not_barriers): Remove prototype.
        * cfghooks.c (rtl_delete_block_not_barriers, rtl_delete_block_1,
        get_last_bb_insn_1): Remove.
        * sel-sched-ir.c (sel_register_cfg_hooks): Do not set
        delete_basic_block in sel_cfg_hooks.
        (remove_empty_bb): When the pred edge is fall thru, redirect it
        via redirect_edge_succ instead of sel_redirect_edge_and_branch.

From-SVN: r136274

14 years agosel-sched-ir.c (tidy_control_flow): Do not assume that next_bb equals to single_succ...
Andrey Belevantsev [Mon, 2 Jun 2008 07:27:58 +0000 (2 11:27 +0400)]
sel-sched-ir.c (tidy_control_flow): Do not assume that next_bb equals to single_succ when the successor is EXIT block.

        * sel-sched-ir.c (tidy_control_flow): Do not assume that next_bb equals
        to single_succ when the successor is EXIT block.  Tidy.

From-SVN: r136271

14 years agosel-sched.c (struct rtx_search_arg): Kill y, max_occur, iter, and bitmask fields.
Dmitry Melnik [Thu, 29 May 2008 14:28:58 +0000 (29 14:28 +0000)]
sel-sched.c (struct rtx_search_arg): Kill y, max_occur, iter, and bitmask fields.

2008-05-29  Dmitry Melnik  <dm@ispras.ru>
            Andrey Belevantsev  <abel@ispras.ru>

        * sel-sched.c (struct rtx_search_arg): Kill y, max_occur, iter, and
        bitmask fields.  Adjust all uses.
        (struct reg_rename): Add crosses_call field.
        (struct cmpd_local_params): Kill generated_nop field.
        MAke removed_last_insn a bool bitfield.
        (struct moveop_static_params): New field was_renamed.
        (vec_blocked_vinsns): Rename to vec_bookkeeping_blocked_vinsns.
        (vec_target_unavailable_vinsns): New.
        (rtx_search): Rename to rtx_ok_for_substitution_p.  Adjust all uses.
        (count_occurrences_1): Bail out if we find a multi-reg reference.
        (choose_best_pseudo_reg): Do not let a register cross a call if
        it doesn't already cross one.  Initialize REG_N_CALLS_CROSSED for
        the new pseudo register.
        (verify_target_availability): Pass reg_rename instead of
        unavailable_hard_regs to it.  Fix assert to consider
        REG_N_CALLS_CROSSED.
        (find_used_regs): Compute reg_rename_p->crosses_call.
        (vinsn_vec_has_expr_p, vinsn_vec_clear, vinsn_vec_add,
        vinsn_vec_free): New functions instead of add_to_blocked_exprs,
        free_blocked_exprs, clear_blocked_exprs, expr_blocked_by_bookkeeping_p.
        Adjust all uses.
        (fill_vec_av_set): Reset target_available bit for expressions which
        were already scheduled with another register on the fences.
        (emit_insn_from_expr_after): Restore the check for HARD_REGISTER_NUM_P.
        (compute_av_set_on_boundaries): When rewinding a boundary, also set
        FENCE_INSN correctly.
        (fill_insns): Pass fence to compute_av_set_on_boundaries.
        (schedule_expr_on_boundary): Compute cant_move before move_op.
        Add only renamed exprs to vec_target_unavailable_vinsns.
        (maybe_emit_renaming_copy): Set params->was_renamed to true.
        (remove_insn_from_stream): Also generate nop when we hit another fence.
        (move_op_at_first_insn): Generate bookkeeping and update sets only
        on non-toplevel move_op.
        (code_motion_process_successors): Also rescan when number of successors
        has changed.
        (move_op): Set EXPR_WAS_RENAMED to true when we renamed any of the insns
        found.
        (init_seqno): When not rescheduling, pass number of insns in a region
        instead of computing it from sched_max_luid.
        (purge_empty_blocks): New, factored out from ...
        (sel_region_init): ... here.  Even when we do not have to schedule
        the region, initialize its data for bundling.
        (sel_sched_region_1): Call purge_empty_blocks from here.
        * opts.c Set sel_sched_switch_set also when -fselective-scheduling.
        * sel-sched-ir.c (sel_move_insn): Assert that we have disconnected
        this insn properly.
        (merge_expr_data): Fix thinko.
        (set_unavailable_target_for_expr): Properly set EXPR_TARGET_AVAILABLE.
        (maybe_tidy_empty_bb): Export.  Free data sets in here, not ...
        (tidy_control_flow): ... here.  Do not apply the optimization
        to empty bbs.  Verify backedges later.
        (remove_empty_bb): Use sel_redirect_edge_and_branch.
        * sched-deps.c (maybe_extend_reg_info_p): New.
        (sched_analyze_reg): Use it.
        * config/ia64/ia64.c (ia64_set_sched_flags): Disable control speculation
        before reload.

Co-Authored-By: Andrey Belevantsev <abel@ispras.ru>
From-SVN: r136169

14 years agotree-pass.h (pass_sel_sched): Remove.
Andrey Belevantsev [Fri, 23 May 2008 14:50:58 +0000 (23 18:50 +0400)]
tree-pass.h (pass_sel_sched): Remove.

        * tree-pass.h (pass_sel_sched): Remove.
        * sel-sched.c (maybe_skip_selective_scheduling): New.  Export it.
        (gate_handle_sel_sched, handle_sel_sched, pass_sel_sched): Remove.
        (debug_state): New.
        (advance_one_cycle, advance_state_on_fence): Use it.
        (extract_new_fences_from): Fix formatting.
        (can_substitute_through_p): Disallow substitutions through CONST_INTs.
        (estimate_insn_cost): New, factored from ...
        (vinsn_dfa_cost): ... here.  Renamed to get_expr_cost.
        (choose_best_insn): When max_issue is not used, try to select
        the first available insn from the ready list.  Correctly set can_issue.
        (stall_for_cycles): When stalling for more than one cycle, always
        set FENCE_AFTER_STALL_P.
        (track_scheduled_insns_and_blocks): Always add found insns to
        current_originators.
        (reset_sched_cycles_in_current_ebb): New variables real_insn,
        after_stall.  Use estimate_insn_cost.  Handle the corner case when
        state_transition seems to be lying about the cost.
        * sel-sched-ir.c (state_create): Always start from advanced state.
        (deps_init_id_note_reg_set): When stack registers are used,
        make the instruction of type use to avoid renaming.
        (maybe_downgrade_id_to_use): Likewise.  Downgrade only SETs.
        (setup_id_reg_sets): Treat writes/reads to/from stack registers
        as corresponding action with the first stack reg.
        (has_dependence_p): Also punt for MOVE_BARRIER.
        * sched-rgn.c (rest_of_handle_sched, rest_of_handle_sched2): Run
        selective scheduling if requested.
        * passes.c (init_optimization_passes): Remove mentions of pass_sel_sched.
        * config/i386/i386.c (override_options): Turn on selective scheduling
        with -O2 for testing purposes.
        * config/ia64/ia64.c (ia64_reorg): Remove debug handling of selective
        scheduling.

From-SVN: r135816

14 years agosel-sched-ir.c (vinsn_init): Call init_id_from_df when possible.
Andrey Belevantsev [Tue, 13 May 2008 07:13:42 +0000 (13 11:13 +0400)]
sel-sched-ir.c (vinsn_init): Call init_id_from_df when possible.

        * sel-sched-ir.c (vinsn_init): Call init_id_from_df when possible.
        (setup_id_for_insn): New, factor from ...
        (deps_init_id_start_insn): ... here.  Tidy.
        (setup_id_lhs_rhs, maybe_downgrade_id_to_use, setup_id_reg_sets): New.
        (init_id_from_df): New.  Use the above functions to setup id for insn
        when DF's data for it is known.

        * sel-sched-ir.h (struct _expr): Make target_available signed char.
        * sel-sched.c: Fix typo in comment.

From-SVN: r135255

14 years agosched-int.h: Fix typos, remove unneeded comments.
Andrey Belevantsev [Tue, 13 May 2008 07:11:31 +0000 (13 11:11 +0400)]
sched-int.h: Fix typos, remove unneeded comments.

        * sched-int.h: Fix typos, remove unneeded comments.
        (struct sched_deps_info_def): Remove start_x and finish_x fields.
        Remove all uses.  Update appropriate hook structures.

        * sel-sched-ir.c (sel_move_insn): New.
        (free_history_vect): New, factored from ...
        (clear_expr): ... here.
        (prepare_insn_expr): New.
        (verify_backedges, maybe_tidy_empty_bb): New, factored from ...
        (sel_remove_insn): ... here.  Add only_disconnect and
        full_tidying parameters.  Call tidy_control_flow.
        (tidy_control_flow): New.
        (set_insn_init): Move initialization of EXPR_SPEC_DONE_DS
        to prepare_insn_expr.
        (init_insn): Use prepare_insn_expr.
        (get_seqno_by_preds): New.
        (remove_empty_bb): Tidy.  Remove an assert about edge fallthruness.

        * sel-sched-ir.h (EXPR_WAS_CHANGED): New.
        (sel_move_insn, get_seqno_by_preds, tidy_control_flow): Declare.

        * sel-sched.c (struct cmpd_local_params): New field removed_last_insn.
        (struct moveop_static_params): New field uid.
        (replace_dest_with_reg_in_expr): Move initialization of EXPR_WAS_RENAMED
        and EXPR_TARGET_AVAILABLE from ...
        (try_replace_dest_reg): ... here.
        (reg_rename_this_tick): New static variable.
        (fill_vec_av_set, find_best_expr): Tidy.
        (emit_insn_from_expr_after): Use EXPR_WAS_RENAMED.
        (find_seqno_for_bookkeeping): New, factored from ...
        (generate_bookkeeping_insn): .. here.
        (move_exprs_to_boundary): Pass expr_vliw to move_op.
        Do not adjust c_expr anymore.
        (schedule_expr_on_boundary): Emit insn from expr_vliw, not c_expr.
        When possible, move insn instead of reemitting.
        (fill_insns): Do not verify backedges here.
        (move_op_merge_succs): Just use merge_expr_data instead of
        trying to be clever about EXPR_USEFULNESS.
        (track_scheduled_insns_and_blocks, maybe_emit_renaming_copy,
        maybe_emit_speculative_check, handle_emitting_transformations,
        remove_insn_from_stream): New, factored from ...
        (move_op_orig_expr_found): ... here.  Do not clear data structures
        of removed insn if we are sure that it would be scheduled later.
        (move_op_at_first_insn): Do not update data sets on the removed boundary.
        Also do not update sets on the boundary which is a bb header.
        Fix comment.  Factor out some code to tidy_control_flow.
        (fur_orig_expr_not_found): Tidy comment.
        (code_motion_path_driver): Set removed_last_insn in local_params_in.
        Properly initialize first_insn and insn in corner cases.
        (move_op): Add expr_vliw parameter.  Initialize sparams.uid using it.
        (sel_region_init): Zero reg_rename_this_tick.

From-SVN: r135254

14 years agoia64.c (ia64_adjust_cost_2): Ignore true dependencies between a store and a call.
Alexander Monakov [Tue, 13 May 2008 07:08:56 +0000 (13 11:08 +0400)]
ia64.c (ia64_adjust_cost_2): Ignore true dependencies between a store and a call.

2008-05-13  Alexander Monakov  <amonakov@ispras.ru>

        * config/ia64/ia64.c (ia64_adjust_cost_2): Ignore true dependencies
        between a store and a call.
        * config/ia64/itanium2.md: Add bypass to reflect this.
        * sched-deps.c (sched_analyze_reg): Do not allow crossing calls for
        registers that not already cross one.

From-SVN: r135253

14 years agotree-ssa-reassoc.c (rewrite_expr_tree): Add hunk accidentally removed during merge.
Andrey Belevantsev [Mon, 12 May 2008 15:32:25 +0000 (12 19:32 +0400)]
tree-ssa-reassoc.c (rewrite_expr_tree): Add hunk accidentally removed during merge.

        * tree-ssa-reassoc.c (rewrite_expr_tree): Add hunk accidentally removed
        during merge.

From-SVN: r135217

14 years agocfgrtl.c (create_basic_block_structure): Set bb_index in one place.
Andrey Belevantsev [Fri, 18 Apr 2008 09:47:33 +0000 (18 13:47 +0400)]
cfgrtl.c (create_basic_block_structure): Set bb_index in one place.

2008-04-18  Andrey Belevanstev  <abel@ispras.ru>
            Dmitry Melnik  <dm@ispras.ru>
            Alexander Monakov  <amonakov@ispras.ru>

        * cfgrtl.c (create_basic_block_structure): Set bb_index in one place.
        * cse.c (hash_rtx_string): Make static inline.
        * haifa-sched.c: Tidy, add comments, move static definitions to one
        place.
        (schedule_block): Print less debugging info.
        (check_sched_flags, sched_finish_bbs): Remove.
        * loop-init.c (loop_optimizer_init): Remove old merge glitch.
        * modulo-sched.c: Remove #if 0'd code.
        * rtl.h (hash_rtx_string): Remove export.
        * sched-int.h (sched_extend_bbs): Remove export.
        (attach_life_info1): Likewise.
        (SEL_SCHED_P): Rewrite macro to inline function, rename to sel_sched_p.
        Update all uses.
        * sel-sched-dump.c, sel-sched-dump.h, sel-sched-ir.c, sel-sched-ir.h,
        sel-sched.c, sel-sched.h: Update headers to GPLv3.
        * sel-sched.c (cfglayout.h, cselib.h): Remove excessive includes.
        Update high-level overview of the scheduler.
        (collect_unavailable_regs_from_bnds,
        try_replace_dest_reg): Split from ...
        (find_best_reg_for_expr): ... here.
        (fur_orig_expr_found): Remove needs_spec_check_p.
        * sel-sched-ir.h (struct _def): Remove needs_spec_check_p.
        Update all uses.
        * config/ia64/ia64.c (ia64_sched_init): Check SCHED_GROUP_P bits
        when ! sel_sched_p.
        (sel2_run): Add comment.
        * config/ia64/ia64.opt (ia64_max_memory_insns): Extend comment.
        * doc/invoke.texi: Fix documentation wrt removed sel-sched flags.

Co-Authored-By: Alexander Monakov <amonakov@ispras.ru>
Co-Authored-By: Dmitry Melnik <dm@ispras.ru>
From-SVN: r134432

14 years agosel-sched-ir.c (expr_greater_p): Use UIDs instead of LUIDs for comparison.
Andrey Belevantsev [Thu, 17 Apr 2008 12:45:14 +0000 (17 16:45 +0400)]
sel-sched-ir.c (expr_greater_p): Use UIDs instead of LUIDs for comparison.

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

        * sel-sched-ir.c (expr_greater_p): Use UIDs instead of LUIDs
        for comparison.
        * ia64.c (ia64_override_options): Make the selective scheduler
        the default one starting from -O3.

From-SVN: r134389

14 years agobackport: tree-pass.h (pass_sel_sched): Declare.
Andrey Belevantsev [Wed, 16 Apr 2008 15:40:14 +0000 (16 19:40 +0400)]
backport: tree-pass.h (pass_sel_sched): Declare.

        Merge from trunk rev. 134322.
        * tree-pass.h (pass_sel_sched): Declare.
        * sel-sched.c (moveup_expr_cached): Initialize trans_type.
        (move_cond_jump): Properly use df_insn_change_bb.
        (pass_sel_sched): Convert to rtl_opt_pass.
        * sched-rgn.h: Inline into sched-int.h and kill.  Kill all uses.
        * sched-rgn.c (candidate_table, compute_trg_info, free_trg_info,
        check_live, update_live): Make static.

From-SVN: r134347

14 years agoMerge with trunk rev. 134322
Andrey Belevantsev [Tue, 15 Apr 2008 20:48:35 +0000 (16 00:48 +0400)]
Merge with trunk rev. 134322

From-SVN: r134333

14 years agocommon.opt (flag_selective_scheduling*): Disable by default.
Andrey Belevantsev [Mon, 14 Apr 2008 17:28:39 +0000 (14 21:28 +0400)]
common.opt (flag_selective_scheduling*): Disable by default.

        * common.opt (flag_selective_scheduling*): Disable by default.
        Put `Optimization' markers on sel-sched flags.
        * config/ia64/ia64.c (ia64_override_options): Turn on selective
        scheduling with -O3, disable -fauto-inc-dec.
        * opts.c (decode_options): Remove handling of selective scheduling
        options.
        * sel-sched.c (compute_av_set_at_bb_end, fill_vec_av_set): Do not
        truncate av set.

From-SVN: r134283

14 years agoia64.c (ia64_h_i_d_extended): Reallocate stops_p by larger chunks.
Andrey Belevantsev [Mon, 14 Apr 2008 15:00:52 +0000 (14 19:00 +0400)]
ia64.c (ia64_h_i_d_extended): Reallocate stops_p by larger chunks.

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.

Co-Authored-By: Alexander Monakov <amonakov@ispras.ru>
From-SVN: r134272

14 years agocfgloopmanip.c (has_preds_from_loop): New.
Andrey Belevantsev [Mon, 14 Apr 2008 14:58:49 +0000 (14 18:58 +0400)]
cfgloopmanip.c (has_preds_from_loop): New.

        * cfgloopmanip.c (has_preds_from_loop): New.
        (create_preheader): Use it.
        * sched-deps.c (deps_analyze_insn): Tidy.
        * sel-sched-ir.c (vinsns_correlate_as_rhses_p): Rename to vinsn_equal_p,
        deleting the latter.  Update all uses.
        (vinsn_copy): New.
        (find_in_history_vect_1): New parameter compare_vinsns.
        Do not compare when we're undoing transformations on a bookeeping copy.
        (find_in_history_vect, insert_in_history_vect): Use the new parameter.
        (merge_expr_data): Add usefulness only when merging on a split point.
        (has_dependence_p): Do not allow stores to move through checks.
        (init_insn): Properly init EXPR_TARGET_AVAILABLE and INSN_LIVE_VALID_P.
        (clear_outdated_rtx_info): Do not rely on INSN_TRANSFORMED_INSNS
        when rescheduling.
        (sel_remove_loop_preheader): Tidy.

        * sel-sched.c (struct code_motion_path_driver_info_def): Add new
        parameter to on_enter field. Rename at_bb_head to at_first_insn.
        (need_stall): Move to fill_insns.
        (vec_bk_blocked_exprs): Rename to vec_blocked_vinsns.
        (extract_new_fences_from): Fix for the case when a fence is not
        on a bb header.
        (substitute_reg_in_expr): New parameter undo.  Perform or undo
        the change based on this parameter.
        (find_best_reg_for_expr): Use find_sequential_best_exprs.
        When renaming, set EXPR_TARGET_AVAILABLE to 1.
        (undo_transformations): When un-substituting through bookkeeping,
        do not use the history data, but substitute_reg_in_expr instead.
        (moveup_expr_inside_insn_group): Do not care about any dependencies
        except substitutable ones.
        (try_bitmap_cache, try_transformation_cache, update_bitmap_cache,
        update_transformation_cache): Split from ...
        (moveup_set_expr): ... here.
        (moveup_expr_cached): New function.
        (moveup_set_path*): Kill and rewrite into ...
        (moveup_set_inside_insn_group): ... this.
        (equal_after_moveup_path_p): Rewrite without recursion.
        (compute_av_set_inside_bb): Check ineligibility for every insn.
        Leave a copy only on bb headers.
        (update_data_sets): Update only on bb headers.
        (expr_blocked_by_bookkeeping_p): Use vec_blocked_vinsns.
        (clear_blocked_exprs, add_to_blocked_exprs, free_blocked_exprs): New.
        (fill_vec_av_set): Remove unavailable due to bookeeping expressions
        even if they are separable.  Tidy.  Compute the minimal stall
        needed to be able to try any of the expressions in the ready set.
        (fill_ready_list, find_best_expr): Propagate the stall needed from
        fill_vec_av_set to fill_insns.
        (move_cond_jump): Fix for the case when a fence is not on a bb header.
        (compute_av_set_on_boundaries, find_sequential_best_exprs): Likewise.
        Handle substitutions inside insn group.
        (prepare_place_to_insert): Likewise.
        (move_exprs_to_boundary): Likewise for the case when more than one
        expression corresponds to expr_vliw.
        (fill_insns): Stall for more than one cycle if needed.
        Check that we never create an extra back edge in a region when
        pipelining.
        (update_and_record_unavailable_insns): Also update liveness in
        the middle of the bookkeeping block.
        (move_op_at_first_insn): Handle the case when the insn is not
        a bb header.
        (fur_at_first_insn): Likewise.
        (fur_on_enter): Move the handling of visited blocks to
        code_motion_path_driver.
        (move_op_on_enter): New.
        (code_motion_process_successors): Rescan when basic block
        numbers have changed due to bb splitting.
        (code_motion_path_driver): Update for fences not on bb headers.
        (sel_region_init, sel_region_finish): Update liveness on single-block
        loops when pipelining.  Use *_blocked_exprs routines.

From-SVN: r134271

14 years agosel-sched.c (extract_new_fences_from): Move fence to the new ones only if the succ...
Andrey Belevantsev [Mon, 14 Apr 2008 14:46:37 +0000 (14 18:46 +0400)]
sel-sched.c (extract_new_fences_from): Move fence to the new ones only if the succ insn has not yet been scheduled.

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

From-SVN: r134270

14 years agosched-deps.c (sched_deps_init): Tidy.
Andrey Belevantsev [Mon, 14 Apr 2008 14:44:53 +0000 (14 18:44 +0400)]
sched-deps.c (sched_deps_init): Tidy.

        * sched-deps.c (sched_deps_init): Tidy.
        * sel-sched-ir.c (init_fence_for_scheduling): New.
        (flist_add): Use it.
        (init_fences): Merge ready_ticks_size.
        (merge_fences): Likewise.
        (new_fences_add): Rename to add_to_fences.
        (move_fence_to_fences): New.
        (new_fences_add_clean): Rename to move_fence_to_fences.
        (new_fences_add_dirty): Rename to add_dirty_fence_to_fences.
        (insn_eligible_for_subst_p): Kill.

        * sel-sched-ir.h (ready_ticks, ready_ticks_size): New.
        * sel-sched.c (extract_new_fences_from,
        sel_sched_region_2): Use the new fence functions.
        (can_substitute_through_p): New.
        (moveup_expr): Use it.
        (can_overcome_dep_p): Rename to can_speculate_dep_p.
        (fill_vec_av_set): Use FENCE_READY_TICKS.

From-SVN: r134269

14 years agocommon.opt (flag_sel_sched_pipelining_outer_loops): Init to 0.
Alexander Monakov [Mon, 14 Apr 2008 14:42:44 +0000 (14 18:42 +0400)]
common.opt (flag_sel_sched_pipelining_outer_loops): Init to 0.

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.

From-SVN: r134268

14 years agocommon.opt (flag_sel_sched_emulate_haifa, [...]): Kill.
Andrey Belevantsev [Mon, 14 Apr 2008 14:40:54 +0000 (14 18:40 +0400)]
common.opt (flag_sel_sched_emulate_haifa, [...]): Kill.

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

From-SVN: r134267

14 years agogenattr.c (main): Output maximal_insn_latency prototype.
Andrey Belevantsev [Mon, 14 Apr 2008 13:13:52 +0000 (14 17:13 +0400)]
genattr.c (main): Output maximal_insn_latency prototype.

        * genattr.c (main): Output maximal_insn_latency prototype.
        * genautomata.c (output_default_latencies): New. Factor its code from ...
        (output_internal_insn_latency_func): ... here.
        (output_internal_maximal_insn_latency_func): New.
        (output_maximal_insn_latency_func): New.
        * hard-reg-set.h (UHOST_BITS_PER_WIDE_INT): Fix define.
        * lists.c (remove_free_EXPR_LIST_node): New.
        * rtl.h: Export it.
        * sched-deps.c (remove_from_dependence_list,
        remove_from_both_dependence_lists): New.
        (remove_from_deps): New. Use the above functions.
        * sched-deps.h (remove_from_deps): Export.
        * sel-sched-ir.h (struct _fence): New field `executing_insns'.
        (FENCE_EXECUTING_INSNS): New accessor.
        (struct _sel_insn_data): Remove _expr to expr.  Update all uses.
        Change asm_p to bool_bitfield. New field `ready_cycle'.
        * sel-sched-ir.c (fence_init, flist_add, fence_clear,
        init_fences, merge_fences, new_fences_add, new_fences_add_clean,
        new_fences_add_dirty): Update for FENCE_EXECUTING_INSNS.
        * sel-sched.c (advance_one_cycle): Remove excessive insns from
        FENCE_EXECUTING_INSNS.
        (undo_transformations): Forbid combined speculation.
        (process_use_exprs): Use EXPR_TARGET_AVAILABLE.
        (fill_insns): Set INSN_READY_CYCLE.  Update FENCE_EXECUTING_INSNS.
        (sel_sched_region_2): Likewise.

From-SVN: r134264

14 years agosel-sched-dump.c (get_print_blocks_num): New.
Dmitry Melnik [Mon, 14 Apr 2008 13:12:37 +0000 (14 13:12 +0000)]
sel-sched-dump.c (get_print_blocks_num): New.

        * sel-sched-dump.c (get_print_blocks_num): New.
        * sel-sched-dump.h: Export it.
        * sel-sched-ir.c (vinsn_equal_p): Use sel_rtx_equal_p for UNIQUE
        vinsns too.
        (speculate_expr): Pass false to create_vinsn_from_insn_rtx.
        (create_vinsn_from_insn_rtx): New parameter force_unique_p.
        Pass it to vinsn_create.
        * sel-sched-ir.h (struct _def): Add comment to crosses_call.
        * sel-sched.c (struct cmpd_local_params,
        struct moveop_static_params, struct fur_static_params,
        fur_static_params_p, cmpd_local_params_p, moveop_static_params_p,
        struct code_motion_path_driver_info_def,
        code_motion_path_driver_info, move_op_hooks, fur_hooks): New.
        (substitute_reg_in_rhs): Pass false to create_vinsn_from_insn_rtx.
        (replace_dest_with_reg_in_rhs, generate_bookkeeping_insn): Likewise.
        (code_motion_path_driver): New.
        (find_used_regs, move_op): Rewrite to use it.  Update all uses.
        (find_used_regs_1): Kill.
        (av_set_could_be_blocked_by_bookkeeping_p): New.
        (move_op_merge_succs, fur_merge_succs, move_op_after_merge_succs,
        move_op_orig_rhs_found, fur_orig_rhs_found, move_op_at_bb_head,
        fur_at_bb_head, move_op_ascend, fur_on_enter,
        move_op_orig_rhs_not_found, fur_orig_rhs_not_found,
        move_op_process_successors, code_motion_path_driver_cleanup): New.

From-SVN: r134263

14 years agosel-sched-dump.c (dump_expr_1): Print correct value of EXPR_TARGET_AVAILABLE.
Andrey Belevantsev [Thu, 28 Feb 2008 15:46:06 +0000 (28 18:46 +0300)]
sel-sched-dump.c (dump_expr_1): Print correct value of EXPR_TARGET_AVAILABLE.

        * sel-sched-dump.c (dump_expr_1): Print correct value of
        EXPR_TARGET_AVAILABLE.
        * sel-sched-ir.h (struct vinsn_def): New field hash_rtx.
        (VINSN_HASH_RTX): New accessor.
        (struct transformed_insns): New.
        (struct _sel_insn_data): New field transformed_insns.
        (INSN_TRANSFORMED_INSNS): New accessor.
        * sel-sched-ir.c (vinsn_init): Initialize VINSN_HASH_RTX.
        (vinsn_delete): Kill outdated comment.
        (speculate_expr): Return 2 when we think that the target
        register is unavailable for speculation.
        (hash_transformed_insns, eq_transformed_insns,
        free_transformed_insns): New.
        (init_first_time_insn_data): Init INSN_TRANSFORMED_INSNS.
        (free_first_time_insn_data): Free INSN_TRANSFORMED_INSNS.
        (finish_insns): Likewise.
        (finish_global_and_expr_insn): Do not assert that the vinsn
        is connected only to one insn.
        * sel-sched.c (undo_transformations): Also undo when only
        a dependence status has changed, not insn's pattern.
        Update comment.
        (was_target_conflict): New static variable.
        (moveup_rhs): Set it when a target conflict is encountered.
        (moveup_set_rhs): When an expression is changed, record this
        in INSN_TRANSFORMED_INSNS.  Lookup this hashtable before calling
        moveup_rhs.  Use was_target_conflict when recording.

From-SVN: r132752

14 years agosel-sched.c (sel_region_init): Move the removing empty blocks loop to a proper place.
Andrey Belevantsev [Thu, 28 Feb 2008 09:54:59 +0000 (28 12:54 +0300)]
sel-sched.c (sel_region_init): Move the removing empty blocks loop to a proper place.

        * sel-sched.c (sel_region_init): Move the removing empty blocks loop
        to a proper place.  Fix the call to sel_remove_empty_bb.

From-SVN: r132739

14 years agoMerge from trunk rev. 132164.
Andrey Belevantsev [Wed, 27 Feb 2008 17:34:58 +0000 (27 20:34 +0300)]
Merge from trunk rev. 132164.

From-SVN: r132724

14 years agosel-sched.c (sel_region_init): Iterate through region blocks removing unneeded empty...
Andrey Belevantsev [Wed, 27 Feb 2008 15:03:01 +0000 (27 18:03 +0300)]
sel-sched.c (sel_region_init): Iterate through region blocks removing unneeded empty ones.

        * sel-sched.c (sel_region_init): Iterate through region blocks removing
        unneeded empty ones.

From-SVN: r132720

14 years agoImplement an iterator over hard register sets.
Andrey Belevantsev [Wed, 27 Feb 2008 14:59:36 +0000 (27 17:59 +0300)]
Implement an iterator over hard register sets.

        * hard-reg-set.h (struct hard_reg_set_iterator): New.
        (hard_reg_set_iter_init, hard_reg_set_iter_set,
        hard_reg_set_iter_next): New functions.
        (EXECUTE_IF_SET_IN_HARD_REG_SET): New macro.
        * sel-sched.c (mark_unavailable_hard_regs): Use EXECUTE_IF_SET_IN_HARD_REG_SET.
        (choose_best_reg_1): Likewise.

        * sel-sched-ir.c (merge_expr_data): Change a bool parameter join_point_p
        to insn_t split_point.  When changing a speculative expression, record
        this in a history.
        (merge_expr): Also change a parameter.
        (av_set_union_and_clear): New parameter insn.  Pass it to merge_expr.
        Update all callers.
        (av_set_union_and_live): Likewise.
        * sel-sched-ir.h (_eligible_successor_edge_p): Fix assert.  Update
        declarations.

From-SVN: r132718

14 years agosel-sched.c (compute_av_set_inside_bb, [...]): New functions.
Dmitry Melnik [Wed, 27 Feb 2008 14:58:18 +0000 (27 14:58 +0000)]
sel-sched.c (compute_av_set_inside_bb, [...]): New functions.

2008-02-26  Dmitry Melnik  <dm@ispras.ru>

        * sel-sched.c (compute_av_set_inside_bb, compute_av_set_at_bb_end): New
        functions.
        (compute_av_set): Reimplement using them.

        * sel-sched-dump.c (sel_stat_file, sel_stat_output_buf): New
        static variables.
        (sel_get_stat_filename, sel_get_stat_file): New functions.

From-SVN: r132717

14 years agoAvoid computing register liveness below original insns.
Andrey Belevantsev [Wed, 27 Feb 2008 14:54:00 +0000 (27 17:54 +0300)]
Avoid computing register liveness below original insns.

        * haifa-sched.c (sched_create_recovery_edges): Tidy.
        * sel-sched-ir.c (init_lv_set, free_lv_sets,
        init_invalid_data_sets): Support creating liveness sets for empty blocks.
        (delete_and_free_basic_block): New function, factored from ...
        (sel_add_or_remove_bb): ... here.  Use it.
        (sel_create_recovery_block): Do not create unneeded empty basic block.
        (sel_remove_loop_preheader): Use delete_and_free_basic_block instead of
        plain delete_basic_block.
        * sel-sched-ir.h (get_all_loop_exits, _eligible_successor_edge_p): Assert
        that empty blocks are not met inside current scheduling region.
        * sel-sched.c (propagate_lv_set): Use df_simulate_one_insn_backwards.
        (compute_live_after_bb): Recurse through empty blocks.
        (compute_live_below_insn): Kill.
        (find_used_regs_1): New parameter live_way.  Also check INSN_REG_CLOBBERS
        along a code motion path.  Do not call  compute_live_below_insn, instead
        find registers whose live ranges we crossed from the saved liveness sets
        on our way ...
        (find_used_regs): ... and from registers set in the already scheduled
        insns of the current group.
        (sel_sched_region_1): Make gcc_assert allow valid liveness sets on
        empty blocks.

From-SVN: r132716

14 years agosched-int.h (struct deps): New field last_reg_pending_barrier.
Andrey Belevantsev [Wed, 27 Feb 2008 14:52:30 +0000 (27 17:52 +0300)]
sched-int.h (struct deps): New field last_reg_pending_barrier.

        * sched-int.h (struct deps): New field last_reg_pending_barrier.
        (enum reg_pending_barrier_mode): Move from ...
        * sched-deps.c: ... here.
        (sched_analyze_insn): Set last_reg_pending_barrier of the context.
        (init_deps): Init last_reg_pending_barrier.
        * sel-sched-ir.c (has_dependence_p): When last_reg_pending_barrier
        is set, mark insn->expr pair as having DEPS_IN_INSN dependency.

From-SVN: r132715

14 years agohaifa-sched.c (haifa_init_insn): Extend dependency caches for a new insn.
Andrey Belevantsev [Wed, 27 Feb 2008 14:50:58 +0000 (27 17:50 +0300)]
haifa-sched.c (haifa_init_insn): Extend dependency caches for a new insn.

        * haifa-sched.c (haifa_init_insn): Extend dependency caches for a new insn.

From-SVN: r132714

14 years agoSpeedup find_used_regs by restricting it from visiting same blocks on different paths.
Dmitry Melnik [Fri, 11 Jan 2008 14:10:38 +0000 (11 14:10 +0000)]
Speedup find_used_regs by restricting it from visiting same blocks on different paths.

2008-01-11  Dmitry Melnik  <dm@ispras.ru>

        Speedup find_used_regs by restricting it from visiting same blocks
        on different paths.

        * sel-sched-ir.c (init_expr): New parameter needs_spec_check_p.
        We now store it with the expression instead of computing in place.
        Init EXPR_NEEDS_SPEC_CHECK_P with the param.
        (copy_expr, copy_expr_onside): Pass the new param.
        (merge_expr_data): Merge EXPR_SPEC_DONE_DS.
        (speculate_expr): Init EXPR_NEEDS_SPEC_CHECK_P here.
        (init_global_and_expr_for_insn): Pass the new param.
        (init_simplejump): Ditto.
        * sel-sched-ir.c (struct _expr): New field needs_spec_check_p.
        (EXPR_NEEDS_SPEC_CHECK_P): New access macro.
        * sel-sched.c (current_originators, current_copies): These bitmaps
        record original instructions scheduled on the current iteration and
        bookkeeping copies created by them.
        (fur_visited_blocks): This bitmap marks the blocks visited by
        find_used_regs so we don't visit them afterwards.
        (find_used_regs_1): Do not go past fur_visited_blocks.  Record blocks
        we visit in this bitmap.
        (find_used_regs): Clear fur_visited_blocks here.  Compute whether
        expr needs speculation based upon EXPR_NEEDS_SPEC_CHECK_P.  Do not
        allow clobbering of ld.[sa] address in case some of the  original
        operations need a check.
        (sel_region_init): Allocate fur_visited_blocks.
        (sel_region_finish): Free fur_visited_blocks.

From-SVN: r131467

14 years agohaifa-sched.c (rtx_vec_t): Move to ...
Andrey Belevantsev [Fri, 11 Jan 2008 14:07:57 +0000 (11 17:07 +0300)]
haifa-sched.c (rtx_vec_t): Move to ...

        * haifa-sched.c (rtx_vec_t): Move to ...
        * sched-int.h: ... here.
        * sel-sched-dump.c (dump_insn_array): Rename to
        dump_insn_vector.  Rewrite for using vector of insns.
        (debug_insn_array): Likewise.
        * sel-sched-dump.h: Export the above functions.
        * sel-sched-ir.c (current_succs): New global variable.
        (init_fences): Use FOR_EACH_SUCC* instead of cfg_succs*.
        (get_seqno_of_a_pred): Likewise.
        (insert_in_history_vect): Properly handle the situation of
        merging different speculative statuses.
        (av_set_split_usefulness): Use FOR_EACH_RHS.
        (succs_info_pool): New variable.
        (cfg_succs_n, cfg_succs_1, cfg_succs_2, cfg_succs,
        cfg_succs_other, cfg_succ_1, cfg_succ, overall_prob_of_succs): Kill.
        (alloc_succs_info, free_succs_info, compute_succs_info): New.
        (alloc_sched_pools, free_sched_pools): Move and rename from ...

        * sel-sched-ir.h (init_sched_pools, free_sched_pools) ... here.
        Update all callers.
        (MAX_WS): Move from sel-sched.c.
        (struct succs_info): New.
        (succ_iterator): New fields flags, current_flags.
        (_succ_iter_start, _succ_iter_cond,
        _eligible_successor_edge_p): Use them.

        * sel-sched.c (compute_av_set): Use *_succs_info functions instead of
        cfg_succs*.  Stop when maximal lookahead is reached even
        on a bb header.
        (fill_insns): Use FOR_EACH_SUCC* instead of cfg_succs*.
        (sel_region_finish): Likewise.

From-SVN: r131466

14 years agoia64.opt (msched-fp-mem-deps-zero-cost): Init to 0.
Andrey Belevantsev [Fri, 11 Jan 2008 13:57:43 +0000 (11 16:57 +0300)]
ia64.opt (msched-fp-mem-deps-zero-cost): Init to 0.

2008-01-11  Andrey Belevantsev  <abel@ispras.ru>
            Dmitry Zhurikhin  <zhur@ispras.ru>

        * config/ia64/ia64.opt (msched-fp-mem-deps-zero-cost): Init to 0.
        (msel-sched-data-spec): Init to 1.
        * params.def (PARAM_SELSCHED_MAX_LOOKAHEAD): Default to 40.

        * sel-sched-ir.c (sel_gen_insn_from_rtx_after): Add vinsn parameter.
        (merge_expr_data): Properly merge speculative expressions with
        different speculation types.
        (speculate_expr): Move from sel-sched.c.
        (set_insn_init): Return the expression we've been initializing.
        Set speculative status to be as weak as possible.
        * sel-sched-ir.h (speculate_expr): Export.
        * sel-sched.c (create_speculation_check): Tidy.
        (undo_transformations): Add comment.
        (moveup_rhs): Avoid moving control flow insns through joins.
        (gen_insn_from_expr_after): Rename to emit_insn_from_expr_after.
        Tidy.
        (generate_bookkeeping_insn, fill_insns): Use it.  Tidy.
        (update_and_record_unavailable_insns): Fix assert.
        (init_seqno_1, sel_region_init): Tidy.

Co-Authored-By: Dmitry Zhurikhin <zhur@ispras.ru>
From-SVN: r131465

14 years agoFix different scheduler issues that prevent it from working correctly before reload.
Dmitry Melnik [Fri, 11 Jan 2008 13:52:05 +0000 (11 13:52 +0000)]
Fix different scheduler issues that prevent it from working correctly before reload.

2008-01-11  Dmitry Melnik  <dm@ispras.ru>

        Fix different scheduler issues that prevent it from working
        correctly before reload.

        * common.opt (fsel-insn-range): New flag for debugging.
        * ia64.c (get_mode_no_for_insn): Change the condition that prevents use
        of special hardware registers so it can now handle pseudos.
        (get_spec_check_gen_function): Assert so that we won't reference array
        with a negative index.
        (ia64_gen_spec_check): Ditto.
        * haifa-sched.c (after_recovery, adding_bb_to_current_region_p):
        New variables to handle correct insertion of the recovery code.
        (init_before_recovery): Add new BEFORE_RECOVERY_PTR parameter.
        (sched_extend_bb): Add the prototype.
        (haifa_sched_init): Init new variable.
        (init_before_recovery): Add new param.  Fix the handling of the case
        when we insert a recovery code before the EXIT which has a predecessor
        with a fallthrough edge to it.
        (sched_create_recovery_block): Pass new parameter.
        (create_check_block_twin): Change parameter.
        (haifa_init_insn): Do region specific insn initialization only if
        the insn was added to the current region.
        * opts.c (common_handle_option): Handle the fsel_insn_range option.
        * rtl.h (sel_sched_fix_param): Declare.
        * sched-deps.c (extend_deps_reg_info): Make sure REG_LAST vector is
        extended correctly before reload.
        (sched_analyze_reg): Permit move insn with pseudo even if it crosses
        call.
        (free_deps): Zero pointers explicitly after free.
        * sched-int.h (sched_create_recovery_block): Add new parameter.
        * sel-sched-dump.c (flag_insn_range): Insn range to perform selective
        scheduling.
        (block_for_insn, bb_av_set): New debug functions.
        (in_range_p_1, in_range_p): Parses expression that determines insn
        range for selective scheduling.
        (sel_sched_fix_param): Handle fsel-insn-range param in scheduler.
        (av_set_contains_insn_with_uid, av_set_for_bb_n): Debug functions.
        * sel-sched-dump.h (flag_insn_range, block_for_insn, bb_av_set,
        in_range_p, av_set_contains_insn_with_uid, av_set_for_bb_n):
        Declare.
        * sel-sched-ir.c (init_fences): Free unneeded successors.
        (sel_hash_rtx): Handle PRE_INC etc. as it's done in original hash_rtx.
        (sel_gen_insn_from_rtx_after): Add the assert that target reg is
        available.  Postpone the simplification of the insns until the end of
        the scheduling.
        (av_set_add): Assert that we never insert NOPs into the av_sets.
        (merge_with_other_exprs): Reset EXPR_TARGET_AVAILABLE to -1 if two
        exprs have different target availability values.
        (av_set_leave_one): Replace with av_set_leave_one_nonspec.  This
        function keeps all speculative insns, leaving only one non-speculative.
        (init_first_time_insn_data): Do not init dependences on NOPs.
        (sel_remove_insn): Do not clear data sets on the AFTER_RECOVERY basic
        block.
        (finish_insns): Free dependence contexts that may have left from
        insns that were removed during the scheduling.
        (sel_rtl_insn_added): Init new insns only if they're added to the
        current region.
        (copy_lv_set_from): New function.
        (is_ineligible_successor): Move to sel-sched.c.
        (sel_init_only_bb): Add call to extend_regions.
        (sel_create_recovery_block): Copy LV_SET to BEFORE_RECOVERY bb.
        * sel-sched-ir.h (adding_bb_to_current_region_p, after_recovery,
        av_set_leave_one_nonspec): Declare.
        (copy_insn_out_of_stream, copy_insn_and_insert_before,
        is_ineligible_successor): Remove unused declarations.
        (_succ_iter_cond): Handle AFTER_RECOVERY the same way as EXIT.
        * sel-sched.c (scheduled_something_on_previous_fence): New variable.
        (vec_temp_moveop_nops): New vector to store temporary NOPs inserted
        in move_op to prevent removal of empty BBs.
        (substitute_reg_in_rhs): Do not allow clobbering the address register
        of speculative insns.
        (replace_in_vinsn_using_bitmask_1, replace_in_rtx_using_bitmask,
        un_substitute): Remove.
        (verify_target_availability): Assert target availability if only
        something was scheduled on the previous fence.
        (has_spec_dependence_p, un_speculate): Remove.
        (undo_transformations): Use history to undo transformations.
        (is_ineligible_successor): Move the function here.
        (compute_av_set): Free SUCCS that are no longer needed.
        (find_used_regs_1): Use av_set_leave_one_nonspec.
        (expr_blocked_by_bookkeeping, vec_bk_blocked_exprs_clear):
        New functions.
        (fill_vec_av_set): Recompute target availability or remove expr if the
        it's availability was invalidated by the insertion of bookkeeping
        earlier.
        (remove_temp_moveop_nops): New function.  Removes the temporary NOPs
        that might have been created during move_op.
        (fill_insns): Handle only insns that satisfy the FLAG_INSN_RANGE
        expression.  Call remove_temp_moveop_nops after the move_op.
        Init EXPR_TARGET_AVAILABLE with TRUE by default.
        Init scheduled_something_on_previous_fence.
        (update_and_record_unavailable_insns): New function.  Updates data sets
        for the bookkeeping block and records those expressions that become
        no longer available after inserting the bookkeeping.
        (move_op): Use av_set_leave_one_nonspec.  Insert NOP in the bb if it's
        becoming empty so it won't be removed and we'll be able to insert
        bookkeeping in it when coming later through another branch.  Call
        update_and_record_unavailable_insns on the bookkeeping block to
        record exprs that no longer can be scheduled above it.
        (simplify_changed_insns): New function.  Handles insn simplification
        after the scheduling have completed.
        (sel_region_finish): Use simplify_changed_insns.  Free vector
        vec_bk_blocked_exprs.
        (sel_sched_region_2): Init scheduled_something_on_previous_fence and
        vec_bk_blocked_exprs.
        (sel_global_init): Init after_recovery.

From-SVN: r131464

14 years agoFixing the screwed merge with trunk rev. 130104, last one.
Andrey Belevantsev [Fri, 11 Jan 2008 13:37:46 +0000 (11 16:37 +0300)]
Fixing the screwed merge with trunk rev. 130104, last one.

From-SVN: r131463

14 years agoFirst attempt at fixing the merge problems with trunk rev.130104.
Andrey Belevantsev [Thu, 10 Jan 2008 16:02:02 +0000 (10 19:02 +0300)]
First attempt at fixing the merge problems with trunk rev.130104.

From-SVN: r131443

14 years agoia64.c (ia64_speculate_insn): Use ds_get_speculation_types when determining whether...
Andrey Belevantsev [Fri, 28 Dec 2007 11:27:47 +0000 (28 14:27 +0300)]
ia64.c (ia64_speculate_insn): Use ds_get_speculation_types when determining whether we need to change the pattern.

        * config/ia64/ia64.c (ia64_speculate_insn): Use ds_get_speculation_types
        when determining whether we need to change the pattern.
        * sched-int.h (LUID_BY_UID): New accessor macro.
        * sched-rgn.c (compute_block_dependences): Do not call add_branch_dependences
        for selective scheduling.
        (free_rgn_deps): Tidy.

        * sel-sched-ir.c (vinsn_attach, vinsn_detach): Export.
        (find_in_hash_vect{,_1}): Rename to find_in_history_vect{,_1}.
        Rewrite to use a history vector.
        (insert_in_hash_vect): Likewise.  Rename to insert_in_history_vect.
        (init_expr): Change CHANGED_ON parameter to be a history vector.
        Update all callers.
        (merge_expr_data): Update for history vectors.
        (clear_expr): Likewise.
        (free_first_time_insn_data): Handle INSN_ORIGINATORS.
        (is_ineligible_successor): Do not check the path for back edges.
        (bb_ends_ebb_p, clear_outdated_rtx_info): Tidy.

        * sel-sched-ir.h (enum local_trans_type): New.
        (struct expr_history_def_1, expr_history_def): New.
        (struct _expr): Rename changed_on_insns vector to history_of_changes.
        Make it of expr_history_def type.
        (EXPR_CHANGED_ON_INSNS): Rename to EXPR_HISTORY_OF_CHANGES.
        (struct _sel_insn_data): Fix comments.  New field originators.
        (SID_BY_UID, INSN_ORIGINATORS, INSN_ORIGINATORS_BY_UID): New accessor
        macros.

        * sel-sched.c (un_substitute): Mark as unused.
        (apply_spec_to_expr): Inline to ...
        (speculate_expr): ... here.  Change return value to int.
        Do not copy a pattern when no changes were made.
        (un_speculate): Mark as unused.
        (undo_transformations): Perform unspeculation and unsubstitution
        by looking into the history vector.
        (moveup_rhs): Add PTRANS_TYPE parameter, adjust all callers.  Return
        the type of transformation being done.  Assert that we don't do
        speculation and substitution on the same insn.
        (moveup_set_rhs): Record the performed transformation into the history
        vector of an expression.
        (current_copies, current_originators): New static variables.
        (generate_bookkeeping_insn): Record the generated insn in
        current_copies.  Always set SCHED_TIMES of a bookkeeping insn to 0.
        (fill_insns): Clear current_* bitmaps before move_op.
        When some bookkeeping insns were generated, allocate INSN_ORIGINATORS
        for them and set it to the copy of current_originators.
        (move_op): Add dest parameter.  Pass it explicitly instead of
        calculating from original operations.  When an original insn was
        found, adjust current_copies and current_originators accordingly.
        (sel_region_init): Initialize current_* bitmaps.
        (sel_region_finish): Free them.

From-SVN: r131212

14 years agoMerge with trunk r.130104.
Andrey Belevantsev [Thu, 27 Dec 2007 15:33:27 +0000 (27 18:33 +0300)]
Merge with trunk r.130104.

        * sel-sched-dump.c (sel_print_insn): Constify the first parameter.
        * sel-sched-dump.h (sel_print_insn): Likewise.
        * sel-sched-ir.c (sel_rtx_equal_p): Fix formatting.
        (av_set_split_usefulness): Avoid division by zero.
        * sel-sched.c (speculate_expr): Avoid combined data and control
        speculation when pipelining.
        (fill_vec_av_set): Do not try to rename data speculative insns.

From-SVN: r131205

14 years agosel-sched.c (sel_rank_for_schedule): Tidy.
Andrey Belevantsev [Thu, 27 Dec 2007 14:48:20 +0000 (27 17:48 +0300)]
sel-sched.c (sel_rank_for_schedule): Tidy.

2007-12-27  Andrey Belevantsev  <abel@ispras.ru>

        * sel-sched.c (sel_rank_for_schedule): Tidy.
        (fill_vec_av_set): Use VEC_unordered_remove instead of ordered.
        Properly calculate is_orig_reg_p.  Add the final qsort call
        after filtering out the av set.
        * sched-rgn.c (sched_rgn_init): With selective scheduling,
        always try to compute ebb regions instead of single block reagions.

From-SVN: r131203

14 years agoCache that an expression can be moved up only as RHS.
Andrey Belevantsev [Thu, 27 Dec 2007 14:47:04 +0000 (27 17:47 +0300)]
Cache that an expression can be moved up only as RHS.

2007-12-27  Andrey Belevantsev  <abel@ispras.ru>

        Cache that an expression can be moved up only as RHS.

        * sel-sched.c (enum MOVEUP_RHS_CODE): New value MOVEUP_RHS_AS_RHS.
        (moveup_rhs): Return it when an expression can be moved up as
        a RHS only.  Return MOVEUP_RHS_CHANGED only when expression
        was really changed.
        (moveup_set_rhs): Use fourth bit in INSN_ANALYZED_DEPS /
        INSN_FOUND_DEPS bitmaps for caching MOVEUP_RHS_AS_RHS results.
        Set EXPR_TARGET_AVAILABLE to false when moveup_rhs returns
        MOVEUP_RHS_AS_RHS.  Assert that when MOVEUP_RHS_CHANGED,
        expression's UID has been really changed.
        (fill_vec_av_set): Properly handle max_insns_to_rename.
        (sel_global_init): Use setup_sched_dumps.

        * sel-sched-dump.c (setup_sched_dump_to_stderr): Rename to
        setup_sched_dumps.  When sched_verbose_param >= 10, print to
        stderr.
        * sel-sched-dump.h (setup_sched_dumps): Export.

From-SVN: r131202

14 years agoCompute availability of target registers on the fly.
Andrey Belevantsev [Wed, 26 Dec 2007 15:35:10 +0000 (26 18:35 +0300)]
Compute availability of target registers on the fly.

        Limit renaming to the best instructions.

        * sel-sched.c (max_insns_to_rename): New variable.
        (struct reg_rename): New structure that incapsulates the data
        about hard registers available for renaming.
        (expr_dest_reg, rhs_dest_regno): Kill.
        (vinsn_writes_one_of_regs_p): Also check VINSN_REG_CLOBBERS.
        (mark_unavailable_hard_regs): Use struct reg_rename instead of
        separate hard reg sets.
        (choose_best_reg_1): Ditto.  Also check all hard_regno_nregs
        registers, not only the first one.
        (choose_best_reg, choose_best_pseudo_reg): Ditto.
        (verify_target_availability): New.
        (find_used_regs): Use it for checking that EXPR_TARGET_AVAILABLE
        bit is consistent with find_used_regs_info.  Also check for
        VINSN_REG_CLOBBERS.  Use struct reg_rename.
        (apply_spec_to_expr): Properly compute EXPR_TARGET_AVAILABLE
        for speculative insns.
        (moveup_rhs): Fix formatting.  Mark the target register of separate
        instructions having dependencies in LHS as unavailable.
        (moveup_set_rhs): Use merge_with_other_exprs when an expression
        was changed.
        (compute_av_set): Add comment.  Compute other successors and
        calculate whether target registers of expressions are available.
        Use av_set_union_and_live and mark_unavailable_targets.
        (propagate_lv_set): Handle INSN_REG_CLOBBERS too.
        (compute_live): Export.
        (find_used_regs_1): Use struct reg_rename.  Handle INSN_REG_CLOBBERS.
        (find_used_regs): Ditto.
        (fill_vec_av_set): Calculate statistics about target availability
        of expressions.  Sort the vector before filtering out expressions.
        Use target_available information for all expressions.  Try to rename
        only max_insns_to_rename expressions.
        (find_best_expr): Record whether an instruction was renamed.
        (generate_bookkeeping_insn, remove_insns_that_need_bookkeeping): Tidy.
        (fill_insns): Tidy.  Use expr_dest_regno.  Set target availability
        flag for the newly emitted insn to true.
        (sel_global_init): Set max_insns_to_rename.
        * sel-sched-ir.c (vinsn_delete): Also handle VINSN_REG_CLOBBERS.
        (init_expr): Add target_available, was_renamed parameters.
        Update all callers.
        (merge_expr_data): New parameter JOIN_POINT_P.  Compute target
        availability also using this parameter.  Handle EXPR_WAS_RENAMED.
        (merge_expr): Ditto.  Properly change vinsns of speculative exprs.
        (set_unavailable_target_for_expr, expr_dest_reg, expr_dest_regno,
        mark_unavailable_targets, av_set_add_nocopy, av_set_lookup_and_remove,
        merge_with_other_exprs, av_set_union_and_live): New.
        (av_set_lookup_other_equiv_rhs): New parameter laterp.
        (deps_init_id_start_insn, deps_init_id_note_reg_clobber): Handle
        IDATA_REG_CLOBBERS.
        (cfg_succs_other): New.
        (sel_split_edge): New variable other_bb.  Assert that there is no more
        than two blocks added during splitting.  Put the correct lv set on the
        other bb.
        * sel-sched-ir.h (struct _expr): New fields target_available,
        was_renamed.
        (EXPR_TARGET_AVAILABLE, EXPR_WAS_RENAMED): New accessor macros.
        (_list_remove_nofree, _list_iter_remove_nofree): New.
        (struct idata_def): New field reg_clobbers.
        (IDATA_REG_CLOBBERS, VINSN_REG_CLOBBERS, INSN_REG_CLOBBERS): New
        accessor macros.
        (cfg_succs_other, av_set_union_and_live, merge_with_other_exprs,
        expr_dest_regno, expr_dest_reg. max_insns_to_rename): Export.
        * sel-sched-dump.c (dump_expr_1): Handle EXPR_TARGET_AVAILABLE.
        * sched-rgn.h (struct region): Kill has_renaming_p, was_pipelined_p,
        needs_global_live_update fields.  Kill all uses.
        (RGN_HAS_RENAMING_P, RGN_WAS_PIPELINED_P,
        RGN_NEEDS_GLOBAL_LIVE_UPDATE): Kill accessor macros.  Kill all uses.
        * params.def (PARAM_SELSCHED_INSNS_TO_RENAME): New.

From-SVN: r131184

14 years agohaifa-sched.c (sched_init): Add initialization of new spec_info field: control_weakne...
Dmitry Zhurikhin [Wed, 26 Dec 2007 14:23:14 +0000 (26 14:23 +0000)]
haifa-sched.c (sched_init): Add initialization of new spec_info field: control_weakness_cutoff.

        * haifa-sched.c (sched_init): Add initialization of new spec_info
        field: control_weakness_cutoff.
        (try_ready): Change weakness_cutoff for data_weakness_cutoff.
        * sel-sched.c (find_best_reg_for_rhs): New parameter - pointer
        to bool, showing if best reg for rhs is an original reg.
        Update all callers.
        (moveup_set_rhs): Add computation of usefullness of rhses in av sets.
        (compute_av_set): Same.
        (end_of_loop_p): New.
        (can_overcome_dep_p): Change weakness_cutoff for data_weakness_cutoff.
        (process_spec_exprs): Same.
        (check_stalling_p): New.
        (fill_vec_av_set): Remove from av set at the end of the loop insns
        that will always cause stall at the beginning of
        the next iteration if pipelined.
        (generate_bookkeeping_insn): Change return from void to basic_block
        where bookkeeping has been generated.
        Also add correction of some av sets.
        (fill_insns): When creating new floating bb header move data sets from
        the new basic block created above back to the old one.
        (move_op): Always assert that all bb headers that move_op passes has
        valid data sets.  Also correct data sets for bookkeeping
        block and remove unneeded jumps created by bookkeeping.
        (split_edges_incoming_to_rgn): Remove.
        (sel_region_init): Correctly initialize MARK_LOOP_FOR_PIPELINING.
        Also do not split edges coming into region, because
        generate_bookkeeping_code can correctly handle it.
        (sel_sched_region_1): Add cleanup of preheader block of pipelined loop
        if it is empty after pipelining.
        (sel_global_finish): Rearrange initialization routines so that if we
        cannot pipeline loop preheaders are not created.
        * sel-sched-ir.c (preheader_removed): New variable.
        (merge_fences): New.
        (new_fences_add): Use merge_fences.
        (init_expr): Add handling of new expr fields: usefullness and
        orig_sched_cycle.
        (copy_expr): Same.
        (merge_expr_data): Same.
        (merge_expr): Same.
        (init_global_and_expr_for_insn): Same.
        (init_insn): Same.
        (av_set_split_usefulness): New.
        (free_lv_sets): Assert that empty basic blocks have empty lv_sets.
        (free_av_set): Make non-static.
        (exchange_av_sets): Same.
        (copy_data_sets): New.
        (cfg_succs_2): New.
        (cfg_succs): Add computation of probabilities of succs.
        (overall_prob_of_succs): New.
        (sel_num_cfg_preds_gt_1): Remove wrong assert.
        (jump_destination): New.
        (jump_to_back_edge_p): New.
        (path_contains_back_edge_p): New.
        (path_contains_switch_of_sched_times_p): New.
        (is_ineligible_successor): Consider insns scheduled on other fences as
        ineligible successors even if pipelining.
        (sel_remove_empty_bb): Assert removing only empty bbs and after
        removing empty block remove unused jump in prev_bb if it exists.
        (considered_for_pipelining_p): Do initialization of pipelining of
        outer loops only if pipelining current region.
        (sel_find_rgns): Move pipeline_outer_loops_init here from
         sel_global_init.
        (sel_is_loop_preheader): Return false if preheader was removed.
        (jump_leads_only_to_bb_p): New.
        (sel_remove_loop_preheader): Do not create empty regions from empty
        preheader block - just remove it.
        * sel-sched-ir.h (struct _expr): New fields usefullness and
        orig_sched_cycle.  Also access macros for them.
        * sel-sched-dump.c (dump_expr_1): Add dump for expr_usefullness.
        * passes.c (init_optimization_passes): Move pass_compute_alignments
        below of pass_machine_reorg.
        * config/ia64/ia64.opt (mstop-bit-before-check): New flag.
        * config/ia64/ia64.c (group_barrier_needed): Use new flag.

From-SVN: r131182

14 years agosel-sched.c (create_speculation_check): Always create a recovery block when original...
Alexander Monakov [Wed, 26 Dec 2007 11:35:57 +0000 (26 14:35 +0300)]
sel-sched.c (create_speculation_check): Always create a recovery block when original instruction was speculative.

        * sel-sched.c (create_speculation_check): Always create a recovery
        block when original instruction was speculative.  Make check
        instruction non-speculative irregardless of which speculation types it
        checks.  Use attributes of original instruction when creating a load
        in the recovery block.
        (selective_scheduling_run): Do not try to print liveness information
        in before-init and after-finish dumps.
        * config/ia64/ia64.opt (msched-max-memory-insns,
        msched-max-memory-insns-hard-limit): New target flags.
        * config/ia64/ia64.c (mem_ops_in_group, current_cycle): New variables.
        (ia64_sched_init): Initialize them.
        (is_load_p, record_memory_reference): New functions.
        (ia64_dfa_sched_reorder): Lower priority of loads when limit is
        reached.
        (ia64_variable_issue): Note if a load or a store is issued.
        (ia64_first_cycle_multipass_dfa_lookahead_guard_spec): Require a cycle
        advance if maximal number of loads or stores was issued on current cycle.
        (ia64_dfa_new_cycle): Update current_cycle and mem_ops_in_group.
        (struct _ia64_sched_context): New members.
        (ia64_init_sched_context): Initialize them.
        (ia64_set_sched_context): Copy them.
        * config/ia64/itanium2.md: Remove strange bypass.

From-SVN: r131181

14 years agosel-sched-ir.c (sched_lists_pool): New global variable.
Andrey Belevantsev [Tue, 2 Oct 2007 12:36:26 +0000 (2 16:36 +0400)]
sel-sched-ir.c (sched_lists_pool): New global variable.

        * sel-sched-ir.c (sched_lists_pool): New global variable.
        * sel-sched-ir.h (sched_lists_pool): Export.
        (init_sched_pools, free_sched_pools): New inline functions.
        (_list_add): Allocate memory from pool.
        (_list_remove): Return memory to pool.
        * sel-sched.c (stage): Kill unused variable.
        (sel_global_init): Call init_sched_pools.

From-SVN: r128955

14 years agoImplement readonly dependence contexts.
Andrey Belevantsev [Tue, 2 Oct 2007 10:57:38 +0000 (2 14:57 +0400)]
Implement readonly dependence contexts.

        * sched-int.h (struct deps): New bitfield readonly.
        * sched-deps.c (add_dependence_list_and_free): Add deps parameter.
        Update all users.  Do not free dependence list when
        deps context is readonly.
        (flush_pending_lists): Likewise.
        (add_insn_mem_dependence): Assert that deps context is not readonly.
        (deps_start_bb): Likewise.
        (extend_deps_reg_info): In a readonly context, do not extend
        reg arrays.
        (sched_analyze_reg): Do not allocate sched_before_next_call in a
        readonly context.
        (sched_analyze_1): Do not add memory dependence to a readonly context.
        (sched_analyze_2): Likewise.
        (sched_analyze_insn): Do not modify reg_last array of
        a readonly context.  Likewise for reg_conditional_* regsets.
        Do not handle post-call groups.
        (deps_analyze_insn): Do not flush lists on jumps for
        a readonly context.  Also, do not remember last function call;
        do not process libcalls.
        (init_deps_global, finish_deps_global): Kill #if 0'd code.
        * sel-sched-ir.h (struct _sel_insn_data): New field deps_context.
        (INSN_DEPS_CONTEXT, SUCC_ITER_EDGE): New accessor macros.
        (fallthru_bb_of_jump): Export.
        (inner_loop_header_p): Mark as inline.
        * sel-sched.c (moveup_rhs): Reformat conditions for moving up
        a jump.
        (generate_bookkeeping_insn): Kill unneeded code.
        (move_cond_jump): Set EXPR_ORIG_BB_INDEX when moving an insn.
        (move_op): Tidy comments.  When merging expression data, do not
        take into account bookkeeping insns.
        * sel-sched-ir.c (first_time_insn_init,
        init_first_time_insn_data, free_first_time_insn_data): New.
        (init_global_and_expr_for_insn, finish_global_and_expr_insn,
        init_insn, init_simplejump): Use them.
        (fallthru_bb_of_jump): New.
        (sel_is_loop_preheader_p): Fix a merge thinko.
        (has_dependence_p, tick_check_p): Tidy up.  Use readonly contexts
        when analyzing.

From-SVN: r128953

14 years agoPatch to allow moving conditional jumps through some instructions.
Dmitry Zhurikhin [Thu, 27 Sep 2007 09:41:20 +0000 (27 09:41 +0000)]
Patch to allow moving conditional jumps through some instructions.

2007-09-27  Dmitry Zhurikhin  <zhur@ispras.ru>
        Patch to allow moving conditional jumps through some instructions.

        * sel-sched.c (moveup_rhs): Allow jumps to go through instructions
        if dependencies allow.
        (sel_rank_for_schedule): Prioritize jumps over other instructions.
        (fill_vec_av_set): Added more debug.
        (generate_bookkeeping_insn): Reset sched times on
        bookkeeping instructions.
        (move_cond_jump): New function.
        (fill_insns): Now handles scheduling of jumps.
        (sel_region_init): Added check to stop scheduling empty regions early.
        (sel_region_finish): Added some dump.
        (sel_sched_region_1): Cleanup.
        (sel_sched_region): Same.

        * sel-sched-ir.c (sel_split_edge): Remove now wrong assert.
        (bookkeeping_can_be_created_if_moved_through_p): Remove wrong
        early check.

From-SVN: r128832

14 years agoFix a merge glitch in the change log.
Andrey Belevantsev [Wed, 26 Sep 2007 15:25:55 +0000 (26 19:25 +0400)]
Fix a merge glitch in the change log.

From-SVN: r128814

14 years agoMerge with trunk rev. 127475.
Andrey Belevantsev [Wed, 26 Sep 2007 15:14:24 +0000 (26 19:14 +0400)]
Merge with trunk rev. 127475.

        * recog.c (validate_replace_rtx_1): New parameter simplify.
        Default it to true.  Update all uses.  Factor out simplifying
        code to ...
        (simplify_while_replacing): ... this new function.
        (validate_replace_rtx_part_nosimplify): New.

        * sel-sched-dump.c (sel_dump_cfg_2): Use df_get_live_*
        instead of global_live_at_*.

        * sel-sched-ir.c (sel_extend_global_bb_info,
        extend_region_bb_info, extend_bb_info, sel_finish_global_bb_info,
        finish_region_bb_info): Move to appropriate place.
        Regroup forward static declarations.
        (sel_gen_insn_from_expr_after): Simplify insn here.
        (sel_mark_hard_insn): New.
        (has_dependence_p): Initialize pro and dc fields.
        (init_lv_set): Use df sets.
        (recompute_rev_top_order): Update to new interface of
        post_order_compute.
        (sel_add_or_remove_bb): Do not use glat.
        (sel_split_block): Call change_loops_latches after
        sel_add_or_remove_bb.
        (sched_sel_haifa_sched_info): Initialize flags.
        (sel_set_sched_flags): New.
        (sel_setup_common_sched_info): Use it.  Kill outdated code.
        (sel_is_loop_preheader_p): Tidy.  Kill #if 0'd code.

        * sel-sched-ir.h (sel_set_sched_flags): Export.

        * sel-sched.c (substitute_reg_in_rhs): Do not simplify replaced
        rtx immediately using validate_replace_rtx_part_nosimplify.
        (init_hard_regs_data, choose_best_pseudo_reg,
        gen_insn_from_expr_after): Use df sets.
        (generate_bookkeeping_insn): Tidy.  Fix SCHED_TIMES field for
        preheader insns.
        (fill_insns): Rewind fence boundaries in case new bookkeeping code
        is created.
        (add_region_head): Kill glat handling code.
        (sel_region_init): Setup sched infos according to new flags.
        (sel_global_init): Kill no_new_pseudos code.
        Update setup of sched infos.
        (sel_global_finish): Likewise.
        (handle_sel_sched): Update a call to split_all_insns.

From-SVN: r128813

14 years agocommon.opt (fsel-sched-reset-tc-on-join): New option.
Alexander Monakov [Thu, 16 Aug 2007 13:59:36 +0000 (16 17:59 +0400)]
common.opt (fsel-sched-reset-tc-on-join): New option.

* gcc/common.opt (fsel-sched-reset-tc-on-join): New option.
* gcc/config/ia64/ia64.c (group_barrier_needed): Add heuristic.
(struct bundle_state): New field.
(issue_nops_and_insn): Initialize it.
(insert_bundle_state): Minimize mid-bundle stop bits.
(bundling): Print number of mid-bundle stop bits.  Minimize mid-bundle
stop bits.  Check correct calculation of mid-bundle stop bits.
* gcc/haifa-sched.c (schedule_block): Call sched_init_luids to reset
scheduler datastructure before target generates new insns.
* gcc/sched-deps.c (sched_has_condition_p): New function.  Adjust
users of sched_get_condition to use it instead.
(conditions_mutex_p): Add arguments indicating which conditions are
reversed.  Use them.
(sched_get_condition_with_rev): Rename from sched_get_condition.  Add
argument to indicate whether returned condition is reversed.  Do not
generate new rtx when condition should be reversed; indicate it by
setting new argument instead.
(sched_insns_mutex_p): Use sched_get_condition_with_rev.
(deps_analyze_insn): Do not flush pending write lists on speculation
checks.  Do not make speculation check a scheduling barrier for memory
references.
* gcc/sched-int.h (sel_insn_is_speculation_check): Declare.
* gcc/sched-rgn.c (sched_rgn_init): Do not calculate and free
dominance info for selective scheduler here.
* gcc/sel-sched-dump.c (dump_expr_1): Print new field.
* gcc/sel-sched-dump.h (enum dump_expr): New member.
* gcc/sel-sched-ir.c (init_expr): New arguments.  Initialize new
fields of expr_t.
(copy_expr): Update to pass new arguments to init_expr.
(copy_expr_onside): Ditto.
(init_global_and_expr_for_insn): Ditto.
(init_simplejump): Ditto.
(merge_expr_data): Calculate new fields of expr_t.
(sel_insn_is_speculation_check): New function.
(get_seqno_of_a_pred): Remove wrong assertion.
(init_insn): Calculate new field of expr_t.
(sel_split_block): Ditto.
(pipeline_outer_loops_finish): Do not free dominance info here.
* gcc/sel-sched-ir.h (struct _expr): New fields.
(EXPR_ORIG_BB_INDEX): New accessor macro.
(EXPR_WAS_SUBSTITUTED): Ditto.
* gcc/sel-sched.c (stat_bookkeeping_copies,
stat_insns_needed_bookkeeping, stat_renamed_scheduled,
stat_substitutions_total): New global variables.
(in_fallthru_bb_p): New function.
(extract_new_fences_from): Use it.
(moveup_rhs_inside_insn_group): Record whether expr was substituted.
(moveup_rhs): Ditto.  Do not disable motion of exprs that might need
bookkeeping.
(CANT_MOVE_TRAPPING): Allow moving trapping insns through speculation
checks.
(sel_rank_for_schedule): New heuristic.
(generate_bookkeeping_insn): Avoid creating new basic block.
(max_uid_before_move_op): New global variable.
(remove_insns_that_need_bookkeeping): New function.
(fill_insns): Use it.  Adjust statistical counters.
(move_op): Adjust statistical counter.
(sel_region_finish): Cleanup.
(sel_sched_region_2): Initialize statistical counters, print them.
(sel_global_init): Always calculate dominance info.
(sel_global_finish): Always free calculate dominance info.

Co-Authored-By: Dmitry Zhurikhin <zhur@ispras.ru>
From-SVN: r127557

14 years agosched-ebb.c (sched_ebbs): Set ebb_region_jead_or_leaf_p when ENABLE_CHECKING is defined.
Andrey Belevantsev [Tue, 14 Aug 2007 17:18:22 +0000 (14 21:18 +0400)]
sched-ebb.c (sched_ebbs): Set ebb_region_jead_or_leaf_p when ENABLE_CHECKING is defined.

* sched-ebb.c (sched_ebbs): Set ebb_region_jead_or_leaf_p
when ENABLE_CHECKING is defined.

* haifa-sched.c (haifa_sched_init, haifa_init_insn): Use
sched_deps_init instead of sched_deps_local_init.
(haifa_sched_finish): Use sched_deps_finish.

* sel-sched.c (find_best_reg_for_rhs): Bail out early when insn
doesn't set any registers.
(moveup_rhs, moveup_rhs_inside_insn_group): Print correct rtx
when substituting.
(fill_ready_list): Factor out the code into ...
(process_pipelined_exprs, process_spec_exprs, process_use_exprs,
fill_vec_av_set, convert_vec_av_set_to_ready): ... these
new functions.
(find_best_rhs_and_reg_that_fits): Rename to find_best_expr.
Adjust the caller.  Factor out the code into ...
(invoke_reorder_hooks, find_expr_for_ready,
invoke_dfa_lookahead_guard, calculate_privileged_insns,
invoke_aftermath_hooks, choose_best_insn): ... these new functions.
(get_dest_reg_from_orig_ops): Support also memory destinations.
Remove to get_dest_from_orig_ops.
(move_op): Adjust for the destination being memory.
(sel_region_init): Use sched_deps_init instead of
sched_deps_local_init. Use free_rgn_deps.
(sel_region_finish): Free succs array.
(sel_global_init): Use sched_deps_init and sched_extend_target
instead of sel_extend_insn_rtx_data.
(sel_global_finish): Use sched_deps_finish instead of
sel_finish_insn_rtx_data.

* sel-sched-ir.h (struct _sel_insn_rtx_data): Kill.
(sel_insn_rtx_data_def, sel_insn_rtx_data_t,
SIRD, GET_VINSN_BY_INSN): Ditto.
(s_i_r_d, sel_extend_insn_rtx_data,
sel_finish_insn_rtx_data): Kill declaration.
(lhs_of_insn_equals_to_reg_p): Adjust declaration.

* sel-sched-ir.c (s_i_r_d): Remove variable.
(fence_clear): Use delete_deps_context instead of free_deps.
(lhs_of_insn_equals_to_reg_p): Rename to
lhs_of_insn_equals_to_dest_p.  Adjust for destination being
memory.
(sel_extend_insn_rtx_data, sel_finish_insn_rtx_data): Remove.
(extend_insn, create_insn_rtx_from_pattern_1): Use sched_deps_init
instead of the above functions.

(lhs_and_rhs_separable_p): Use CONSTANT_P instead of the wrong
set of tests on constness.

* sched-deps.c (deps_extend_d_i_d): Make static. Do not init
obstack on each extension. Instead, do it ...
(sched_deps_local_init): ... here.  Rename to sched_deps_init.
Rename create_caches_p to global_p, adjust code.
(sched_deps_finish): New.  Move some code from ...
(sched_deps_local_finish): ... here.  Adjust for the new function.

* sched_deps.h (sched_deps_init, sched_deps_finish): Declare.
* sched-int.h (free_rgn_deps): Declare.
* sched-rgn.c (free_rgn_deps): New.
* vecprim.h: Add definitions for a vector of unsigned int.

* config/ia64/ia64.c (ia64_first_cycle_multipass_dfa_lookahead_guard):
Fix whitespace.
* params.def (PARAM_SELSCHED_MAX_SCHED_TIMES): Fix typo.

Co-Authored-By: Dmitry Melnik <dm@ispras.ru>
From-SVN: r127486

15 years agocse.c (hash_rtx_string): Export.
Andrey Belevantsev [Thu, 21 Jun 2007 08:46:10 +0000 (21 12:46 +0400)]
cse.c (hash_rtx_string): Export.

        * cse.c (hash_rtx_string): Export.
        * sel-sched.c (struct hard_regs_data): New struct.
        (sel_all_regs): Rename to regs_ever_used, change to HARD_REG_SET
        and move to the above struct.  Update all uses.
        (sel_hrd): New global variable.
        (init_hard_regno_rename, sel_hard_regno_rename_ok,
        init_regs_for_mode, init_hard_regs_data): New functions.
        (mark_unavailable_hard_regs): Move some code to the above
        functions and use them.  Return early when a destination
        is not a register.  Move code dealing with frame pointers
        from ...
        (choose_best_reg_1): ... here.
        (find_best_reg_for_rhs): Tidy comment.
        (undo_transformations): Fix comment.  Use hashes instead of bitmaps
        to determine whether an expr was changed on this insns.
        (moveup_set_rhs): Likewise.
        (sel_global_init): Call init_hard_regs_data.
        * sel-sched-ir.c (sel_hash_rtx): New static function.  Adopt from
        hash_rtx, tidy.  Leave only necessary comments.
        (vinsn_init): Use it.
        (find_in_hash_vect_1, find_in_hash_vect, insert_in_hash_vect): New
        functions.
        (vinsns_correlate_as_rhses_p): Use vinsn hashes.
        (init_expr, copy_expr, merge_expr_data, clear_expr): Update to use
        hash vectors instead of bitmaps.
        (sel_bb_head): Check for head being NULL before using it.
        (sel_add_or_remove_bb): Disable too expensive check.
        * sel-sched-ir.h: Include vecprim.h.
        (struct _expr): Change the type of change_on_insns field to a vector.
        (struct vinsn_def): New field hash.
        (VINSN_HASH): New accessor macro.
        (find_in_hash_vect, insert_in_hash_vect): Declare.
        * rtl.h (hash_rtx_string): Declare.
        * vecprim.h: Define a vector type for unsigned values.

From-SVN: r125913

15 years agofwprop.c: Fix merge problem.
Maxim Kuvyrkov [Sat, 16 Jun 2007 21:11:49 +0000 (16 21:11 +0000)]
fwprop.c: Fix merge problem.

* fwprop.c: Fix merge problem.
* df-problems.c: Ditto.
* df-scan.c: Ditto.

From-SVN: r125761

15 years agoMerge revisions 121417-125587 from trunk.
Maxim Kuvyrkov [Sat, 16 Jun 2007 20:17:11 +0000 (16 20:17 +0000)]
Merge revisions 121417-125587 from trunk.

From-SVN: r125760

15 years agoInitialized merge tracking via "svnmerge" with revisions "1-121416"
Maxim Kuvyrkov [Thu, 14 Jun 2007 14:16:26 +0000 (14 14:16 +0000)]
Initialized merge tracking via "svnmerge" with revisions "1-121416"
from svn+ssh://gcc.gnu.org/svn/gcc/trunk.

From-SVN: r125714

15 years agoExtend support for ia64 speculation to generate branchy checks.
Maxim Kuvyrkov [Thu, 14 Jun 2007 13:30:47 +0000 (14 13:30 +0000)]
Extend support for ia64 speculation to generate branchy checks.

Move data sets to per basic block data structures.

* sched-ebb.c (begin_schedule_ready): Update.

* rtlanal.c (may_trap_p_1): Fix bug.

* cfghooks.c (get_cfg_hooks, set_cfg_hooks): New functions.

* cfghooks.h (get_cfg_hooks, set_cfg_hooks): Declare.

* haifa-sched.c (restore_other_notes): Fix bug.
(haifa_sched_init): Initialize hooks.
(haifa_sched_finish): Finalize hooks.
(init_before_recovery): Update.
(create_recovery_block): Make global.  Rename to
sched_create_recovery_block ().  Update.
(sched_create_recovery_edges): Separate cfg manipulation code from
create_check_block_twin () into new function.
(create_check_block_twin): Update.
(sched_speculate_insn): Handle be-in speculations.
(insn_luid): New debug function.
(sched_init_only_bb): New hook.
(haifa_init_only_bb): Make static.
(sched_split_block): New hook.
(sched_split_block_1): New function.
(sched_create_empty_bb): New hook.
(sched_create_empty_bb_1): New function.

* sel-sched.c (old_create_basic_block, old_delete_basic_block): Remove.
(create_insn_rtx_with_rhs, replace_src_with_reg_ok_p): Update.
(replace_dest_with_reg_ok_p, create_insn_rtx_with_lhs): Ditto.
(create_speculation_check_insn_rtx): Rename to
create_speculation_check ().  Rewrite to handle branchy speculation
checks.
(apply_spec_to_expr, un_speculate, undo_transformations): Update.
(compute_av_set, compute_lv_set, update_data_sets): Move data sets
to per basic block data structures.
(find_used_regs_1, gen_insn_from_expr_after): Update.
(generate_bookkeeping_insn, fill_insns, move_op): Ditto.
(old_rtl_hooks): Remove.
(sel_region_init): Move initialization of hooks to
sel_register_rtl_hooks () and sel_register_cfg_hooks ().  Update.
(sel_region_finish): Make sure lv sets at region entries are valid.
Update.
(sel_sched_region_1, sel_global_init, sel_global_finish): Update.

* sel-sched-ir.c (sel_global_bb_info, sel_region_bb_info): New vector
variables.
(sel_bb_info): Remove.
(sel_extend_global_bb_info): New function.
(extend_region_bb_info, extend_bb_info): New static functions.
(sel_finish_global_bb_info): New function.
(finish_region_bb_info): New static functions.
(init_fences, new_fences_add): Update.
(nop_vinsn): New static variable.
(get_nop_from_pool, return_nop_to_pool, free_nop_pool): Update.
(sel_rtx_equal_p): New static function.
(vinsn_equal_p): Use it.
(sel_gen_insn_from_rtx_after): Update.
(init_insn_force_unique_p): New static variable.
(sel_gen_recovery_insn_from_rtx_after): New function.
(vinsns_correlate_as_rhses_p, merge_expr_data, merge_expr): Update.
(sel_cfg_note_p): Remove.
(init_global_and_expr_for_bb): New static function.
(init_global_and_expr_for_insn, sel_init_global_and_expr): Update.
(finish_global_and_expr_insn_1): Remove.
(finish_global_and_expr_for_bb): New static function.
(finish_global_and_expr_insn_2): Rename to
finish_global_and_expr_insn ().  Update.
(sel_finish_global_and_expr): Update.
(has_dependence_note_reg_use): Handle be-in speculations.
(bookkeeping_can_be_created_if_moved_through): Update.
(insn_is_the_only_one_in_bb_p): New static function.
(sched_sel_remove_insn): Rename to sel_remove_insn ().  Update.
(transfer_data_sets): Remove.
(get_seqno_of_a_pred): Update.
(finish_insn): Rename to finish_insns ().
(sel_rtl_insn_added): Update.
(orig_rtl_hooks, sel_rtl_hooks): New static variable.
(sel_register_rtl_hooks, sel_unregister_rtl_hooks): New functions.
(empty_vinsn): Remove.
(insn_init_create_new_vinsn_p): New static variable.
(set_insn_init, init_insn, init_simplejump): Update.
(insn_init_move_lv_set_if_bb_header): Remove.
(sel_init_new_insns): Update.
(init_lv_set_for_insn): Rename to init_lv_set ().  Update.
(init_lv_sets): Update.
(release_lv_set_for_insn): Rename to free_lv_set ().  Update.
(free_lv_sets): Update.
(init_invalid_lv_set, init_invalid_av_set, init_invalid_data_sets): New
static functions.
(free_av_set, free_data_sets, exchange_lv_sets, exchange_av_sets):
Ditto.
(exchange_data_sets): Ditto.
(get_av_set, get_av_level): New functions.
(sel_bb_header_1): Remove.
(sel_bb_header): Rename to sel_bb_head ().  Update.
(sel_bb_header_p): Rename to sel_bb_head_p ().  Update.
(sel_bb_empty_p_1): Remove.
(sel_bb_empty_p, sel_bb_end): Update.
(extend_bb): Remove.
(sel_init_bbs): Update.
(num_preds_gt_1): Rename to sel_num_cfg_preds_gt_1 ().  Update.
(rtx_vec_t): New typedef.
(bb_note_pool): New vector variable.
(return_bb_to_pool, get_bb_note_from_pool, free_bb_note_pool): New
static functions.
(sel_add_or_remove_bb): Make static.  Update.
(move_bb_info): New static function.
(sel_remove_empty_bb): Update.
(remove_empty_bb): New static function.
(orig_cfg_hooks): New static variable.
(sel_init_only_bb): New static function.
(sel_split_block): Make static.  Update.
(sel_split_edge): Update.
(sel_create_empty_bb, sel_create_recovery_block): New static function.
(sel_redirect_edge_force): Rename to
sel_redirect_edge_and_branch_force ().  Update.
(sel_redirect_edge_and_branch): Update.
(sel_cfg_hooks): New static variable.
(sel_register_cfg_hooks, sel_unregister_cfg_hooks): New functions.
(create_insn_rtx_from_pattern_1, create_insn_rtx_from_pattern): Update.
(create_copy_of_insn_rtx, setup_nop_and_exit_insns): Ditto.
(setup_empty_vinsn): Rename to setup_nop_vinsn ().  Update.
(free_empty_vinsn): Rename to free_nop_vinsn.  Update.
(sel_add_loop_preheader, sel_is_loop_preheader_p): Update.
(insn_sid): New debug function.

* sel-sched-ir.h: Update.
(expr_equal_p): Remove.
(struct _sel_insn_data: ws_level, spec_checked_ds): New fields.
(struct _sel_insn_rtx_data: lv): Remove field.
(struct _sel_global_bb_info, struct _sel_region_bb_info): New types.
(get_all_loop_exits, _succ_iter_cond, _eligible_successor_edge_p):
Update.

* sel-sched-dump.c (dump_vinsn_flags, sel_dump_cfg_insn): Update.
(sel_dump_cfg_2): Ditto.

* sel-sched-dump.h: Update.

* sched-deps.c (ds_max_merge): Update.

* sched-int.h: Update.

* sched-rgn.c (rgn_make_new_region_out_of_new_block): New function.
(rgn_add_block): Update.

* sched-rgn.h: Update.

* config/ia64/ia64.c (insn_can_be_in_speculative_p): New static
function.
(ia64_speculate_insn, ia64_needs_block_p): Support branchy checks
during selective scheduling.

* cfgrtl.c (create_basic_block_structure): Update.

From-SVN: r125712

15 years agosel-sched.c (substitue_reg_in_rhs): Fix vertical spacing.
Andrey Belevantsev [Thu, 14 Jun 2007 13:06:41 +0000 (14 17:06 +0400)]
sel-sched.c (substitue_reg_in_rhs): Fix vertical spacing.

2007-06-14  Andrey Belevantsev  <abel@ispras.ru>
            Alexander Monakov  <amonakov@ispras.ru>

        * sel-sched.c (substitue_reg_in_rhs): Fix vertical spacing.
        (un_substitute): Use correct vinsn when fixing expr.
        (identical_copy_p): New function.
        (undo_transformations): Use it when killing from the current av set
        all exprs that use registers set by an insn.  Do not use
        expression caches for now.
        (moveup_rhs): Fix spacing.  Add missing line_finish ().

        * sel-sched-ir.c (deps_init_id_finish_insn): When downgrading to USE,
        leave LHS and RHS fields of an expression intact for future use.
        (insn_eligible_for_subst_p): Fix thinko.  Do not consider 'reg=const'
        insns.

Co-Authored-By: Alexander Monakov <amonakov@ispras.ru>
From-SVN: r125709

15 years agosel-sched.c (moveup_set_rhs): When analyzing an expression, first check the caches.
Andrey Belevantsev [Thu, 14 Jun 2007 13:01:25 +0000 (14 17:01 +0400)]
sel-sched.c (moveup_set_rhs): When analyzing an expression, first check the caches.

        * sel-sched.c (moveup_set_rhs): When analyzing an expression,
        first check the caches.  When a hard dependence/no dependence
        is found, record this in the caches.

        * sel-sched-ir.h (struct sel_insn_data): Reorder fields.
        New fields analyzed_deps, found_deps.
        (INSN_ANALYZED_DEPS, INSN_FOUND_DEPS): New macros.

        * sel-sched-ir.c (init_global_and_expr_for_insn, init_insn,
        init_simplejump): Initialize INSN_ANALYZED_DEPS and
        INSN_FOUND_DEPS caches.
        (finish_global_and_expr_1): Free them.

From-SVN: r125707

15 years agosel-sched-ir.h (struct _expr): New field changed_on_insns.
Andrey Belevantsev [Thu, 14 Jun 2007 12:51:53 +0000 (14 16:51 +0400)]
sel-sched-ir.h (struct _expr): New field changed_on_insns.

        * sel-sched-ir.h (struct _expr): New field changed_on_insns.
        (EXPR_CHANGED_ON_INSNS): New macro.
        (copy_expr_onside): Declare.

        * sel-sched.c: Kill #if 0'd code.
        (undo_transformations): New function.
        (un_substitute): Adapt for undo_transformations.  Add RHS parameter,
        rename AV_PTR parameter to NEW_SET_PTR.  Kill #if 0'd code.  Process
        just one RHS instead of looping through the whole av set.
        (un_speculate): Likewise.
        (moveup_set_rhs): When an expr has been changed, mark this.
        (equal_after_moveup_path_p): Use copy_expr_onside instead of
        copy_expr.
        (generate_bookkeeping_insns): Likewise.
        (find_used_regs_1): Use undo_transformations.
        (move_op): Likewise.  Also use copy_expr_onside.

        * sel-sched-ir.c (init_expr): Add changed_on parameter.  Use it.
        Update all callers.
        (copy_expr_onside): New function.
        (merge_expr_data): Merge cache bitmaps.
        (clear_expr): Free the cache bitmap.
        (av_set_union_and_clear): Set *FROMP to NULL to mark that it's empty.

From-SVN: r125706

15 years agohaifa-sched.c (haifa_classify_insn_1): Rename from haifa_classify_insn...
Alexander Monakov [Wed, 13 Jun 2007 15:02:40 +0000 (13 19:02 +0400)]
haifa-sched.c (haifa_classify_insn_1): Rename from haifa_classify_insn...

2007-06-13  Alexander Monakov  <amonakov@ispras.ru>

        * haifa-sched.c (haifa_classify_insn_1): Rename from
        haifa_classify_insn, add COND_EXEC handling, use recursion to analyze
        PARALLEL and COND_EXEC.
        (haifa_classify_insn): New implementation.
        * sel-sched.c (CANT_MOVE_TRAPPING): New macro.
        (moveup_rhs): Use it.

From-SVN: r125679

15 years agocommon.opt (fsel-sched-substitute-inside-insn-group): New flag.
Andrey Belevantsev [Wed, 13 Jun 2007 14:50:04 +0000 (13 18:50 +0400)]
common.opt (fsel-sched-substitute-inside-insn-group): New flag.

        * common.opt (fsel-sched-substitute-inside-insn-group): New flag.
        * sel-sched.c (moveup_rhs_inside_insn_group): New.
        (moveup_rhs): Add inside_insn_group parameter.  When it is true,
        use the above function.  Kill unneeded comment.
        (moveup_set_rhs): Add inside_insn_group parameter.  Pass it to
        moveup_rhs.
        (equal_after_moveup_path_p_1): Call moveup_rhs with inside_insn_group
        set to true.
        (compute_av_set): Call moveup_set_rhs with inside_insn_group == false.
        (find_used_regs_1): Tidy.
        (generate_bookkeeping_insn): Kill #if 0'd code.
        (fill_insns): Add to rhs_seq expressions from boundaries' av sets
        instead of rhs_vliw.  Put correct register in them.  Fix comment.
        Take pattern for the final insn to schedule from rhs_vliw.
        Move comment before 'if'.  Kill unneeded scope.
        (sel_region_init): Enable moveup_set_path when the user requested
        substitution inside insn groups.
        (sel_global_init): Do not pipeline outer loops when the user doesn't
        permit any kind of pipelining.
        * sel-sched-ir.c: Include sel-sched-dump.h.  Use again sel_print_insn
        as a debug hook.
        (RHS_DEST): New macro.
        * sel-sched-dump.c (sel_print_insn): Resurrect.  Fix it to not
        segfault, use new macros.
        * sched-vis.c (dump_insn_slim_1): Pass 1 instead of 0 to print_insn.
        * config/ia64/ia64.opt (msched-spec-verbose, msched-prefer-non-data-spec-insns,
        msched-prefer-non-control-spec-insns, msched-count-spec-in-critical-path,
        msel-sched-renaming, msel-sched-substitution, msel-sched-data-spec,
        msel-sched-control-spec, msel-sched-dont-check-control-spec): Use Target
        Report Var instead of Common Report Var.

From-SVN: r125678

15 years agoinstall.html: Adjust consistently with libstdc++/31717.
Paolo Carlini [Sat, 9 Jun 2007 00:55:43 +0000 (9 00:55 +0000)]
install.html: Adjust consistently with libstdc++/31717.

2007-06-08  Paolo Carlini  <pcarlini@suse.de>

* docs/html/install.html: Adjust consistently with libstdc++/31717.

From-SVN: r125587

15 years agoDaily bump.
GCC Administrator [Sat, 9 Jun 2007 00:17:00 +0000 (9 00:17 +0000)]
Daily bump.

From-SVN: r125585

15 years agoreload1.c (fixup_abnormal_edges): Clear bb field for insns not inserted on the edge.
Eric Botcazou [Fri, 8 Jun 2007 23:22:46 +0000 (8 23:22 +0000)]
reload1.c (fixup_abnormal_edges): Clear bb field for insns not inserted on the edge.

* reload1.c (fixup_abnormal_edges): Clear bb field for insns
not inserted on the edge.

From-SVN: r125582

15 years ago* ChangeLog fix * ChangeLog fix.
Uros Bizjak [Fri, 8 Jun 2007 20:55:46 +0000 (8 22:55 +0200)]
* ChangeLog fix * ChangeLog fix.

From-SVN: r125578

15 years agolib1funcs.asm (__udivsi3): Use hardware divide instructions if they are supported.
Bob Wilson [Fri, 8 Jun 2007 16:49:23 +0000 (8 16:49 +0000)]
lib1funcs.asm (__udivsi3): Use hardware divide instructions if they are supported.

* config/xtensa/lib1funcs.asm (__udivsi3): Use hardware divide
instructions if they are supported.
(__divsi3, __umodsi3, __modsi3): Likewise.
(__ashldi3, __ashrdi3, __lshrdi3): New.
* config/xtensa/t-xtensa (LIB1ASMFUNCS): Add DImode shift functions.

From-SVN: r125577

15 years agoextend.texi: Add fvect-cost-model flag.
Harsha Jagasia [Fri, 8 Jun 2007 16:30:49 +0000 (8 16:30 +0000)]
extend.texi: Add fvect-cost-model flag.

gcc/ChangeLog:
2007-06-08  Harsha Jagasia <harsha.jagasia@amd.com>
            Tony Linthicum <tony.linthicum@amd.com>

* doc/extend.texi: Add fvect-cost-model flag.
* common.opt (fvect-cost-model): New flag.
* tree-vectorizer.c (new_stmt_vec_info): Initialize inside and outside
cost fields in stmt_vec_info struct for STMT.
* tree-vectorizer.h (stmt_vec_info): Define inside and outside cost
fields in stmt_vec_info struct and access functions for the same.
(TARG_COND_BRANCH_COST): Define cost of conditional branch.
(TARG_VEC_STMT_COST): Define cost of any vector operation, excluding
load, store and vector to scalar operation.
(TARG_VEC_TO_SCALAR_COST): Define cost of vector to scalar operation.
(TARG_VEC_LOAD_COST): Define cost of aligned vector load.
(TARG_VEC_UNALIGNED_LOAD_COST): Define cost of misasligned vector load.
(TARG_VEC_STORE_COST): Define cost of vector store.
(vect_estimate_min_profitable_iters): Define new function.
* tree-vect-analyze.c (vect_analyze_operations): Add a compile-time
check to evaluate if loop iterations are less than minimum profitable
iterations determined by cost model or minimum vect loop bound defined
by user, whichever is more conservative.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound): Add a
run-time check to evaluate if loop iterations are less than minimum
profitable iterations determined by cost model or minimum vect loop
bound defined by user, whichever is more conservative.
(vect_estimate_min_profitable_iterations): New function to estimate
mimimimum iterartions required for vector version of loop to be
profitable over scalar version.
        (vect_model_reduction_cost): New function.
(vect_model_induction_cost): New function.
(vect_model_simple_cost): New function.
(vect_cost_strided_group_size): New function.
(vect_model_store_cost): New function.
(vect_model_load_cost): New function.
(vectorizable_reduction): Call vect_model_reduction_cost during
analysis phase.
(vectorizable_induction): Call vect_model_induction_cost during
analysis phase.
(vectorizable_load): Call vect_model_load_cost during analysis phase.
(vectorizable_store): Call vect_model_store_cost during analysis phase.
(vectorizable_call, vectorizable_assignment, vectorizable_operation,
vectorizable_promotion, vectorizable_demotion): Call
vect_model_simple_cost during analysis phase.

gcc/testsuite/ChangeLog:
2007-06-08  Harsha Jagasia <harsha.jagasia@amd.com>

* gcc.dg/vect/costmodel: New directory.
* gcc.dg/vect/costmodel/i386: New directory.
* gcc.dg/vect/costmodel/i386/i386-costmodel-vect.exp: New testsuite.
* gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c:
New test.
* gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: New test.
* gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: New test.
* gcc.dg/vect/costmodel/i386/costmodel-vect-68.c: New test.
* gcc.dg/vect/costmodel/i386/costmodel-vect-reduc-1char.c: New test.
* gcc.dg/vect/costmodel/x86_64: New directory.
* gcc.dg/vect/costmodel/x86_64/x86_64-costmodel-vect.exp:
New testsuite.
* gcc.dg/vect/costmodel/x86_64/costmodel-fast-math-vect-pr29925.c:
New test.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: New test.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: New test.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-68.c: New test.
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-reduc-1char.c: New test.
* gcc.dg/vect/costmodel/x86_64/costmodel-pr30843.c: New test.

Co-Authored-By: Tony Linthicum <tony.linthicum@amd.com>
From-SVN: r125575