From cb1c661c6fd5c664dd371d82037ee108d8ed8099 Mon Sep 17 00:00:00 2001 From: Ghassan Shobaki Date: Mon, 13 Jul 2009 22:42:41 +0000 Subject: 2009-07-13 Ghassan Shobaki * haifa-sched.c (rank_for_schedule): Introduced flags to enable/disable individual scheduling heuristics. * common.opt: Introduced flags to enable/disable individual heuristics in the scheduler. * doc/invoke.texi: Introduced flags to enable/disable individual heuristics in the scheduler. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@149603 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 ++++++++++ gcc/common.opt | 28 ++++++++++++++++++++++++++++ gcc/doc/invoke.texi | 47 +++++++++++++++++++++++++++++++++++++++++++++++ gcc/haifa-sched.c | 15 ++++++++------- 4 files changed, 93 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f24600fb804..52f41bae013 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2009-07-13 Ghassan Shobaki + + * haifa-sched.c + (rank_for_schedule): Introduced flags to enable/disable + individual scheduling heuristics. + * common.opt: Introduced flags to enable/disable + individual heuristics in the scheduler. + * doc/invoke.texi: Introduced flags to enable/disable + individual heuristics in the scheduler. + 2009-07-13 Kai Tietz * config/i386/t-gthr-win32 (LIB2FUNCS_EXTRA): Remove file diff --git a/gcc/common.opt b/gcc/common.opt index e33bc4c6116..ada94e95a18 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -1056,6 +1056,34 @@ fsched-stalled-insns-dep= Common RejectNegative Joined UInteger -fsched-stalled-insns-dep= Set dependence distance checking in premature scheduling of queued insns +fsched-group-heuristic +Common Report Var(flag_sched_group_heuristic) Init(1) Optimization +Enable the group heuristic in the scheduler + +fsched-critical-path-heuristic +Common Report Var(flag_sched_critical_path_heuristic) Init(1) Optimization +Enable the critical path heuristic in the scheduler + +fsched-spec-insn-heuristic +Common Report Var(flag_sched_spec_insn_heuristic) Init(1) Optimization +Enable the speculative instruction heuristic in the scheduler + +fsched-reg-pressure-heuristic +Common Report Var(flag_sched_reg_pressure_heuristic) Init(1) Optimization +Enable the register pressure heuristic in the scheduler + +fsched-rank-heuristic +Common Report Var(flag_sched_rank_heuristic) Init(1) Optimization +Enable the rank heuristic in the scheduler + +fsched-last-insn-heuristic +Common Report Var(flag_sched_last_insn_heuristic) Init(1) Optimization +Enable the last instruction heuristic in the scheduler + +fsched-dep-count-heuristic +Common Report Var(flag_sched_dep_count_heuristic) Init(1) Optimization +Enable the dependent count heuristic in the scheduler + fsection-anchors Common Report Var(flag_section_anchors) Optimization Access data in the same section from shared anchor points diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index b8313956d2d..cff2431db97 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -364,6 +364,10 @@ Objective-C and Objective-C++ Dialects}. -frounding-math -fsched2-use-superblocks @gol -fsched2-use-traces -fsched-spec-load -fsched-spec-load-dangerous @gol -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol +-fsched-group-heuristic -fsched-critical-path-heuristic @gol +-fsched-spec-insn-heuristic -fsched-reg-pressure-heuristic @gol +-fsched-rank-heuristic -fsched-last-insn-heuristic @gol +-fsched-dep-count-heuristic @gol -fschedule-insns -fschedule-insns2 -fsection-anchors @gol -fselective-scheduling -fselective-scheduling2 @gol -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol @@ -6229,6 +6233,49 @@ results from the algorithm. This only makes sense when scheduling after register allocation, i.e.@: with @option{-fschedule-insns2} or at @option{-O2} or higher. +@item -fsched-group-heuristic +@opindex fsched-group-heuristic +Enable the group heuristic in the scheduler. This is enabled by default +when scheduling is enabled, i.e.@: with @option{-fschedule-insns} +or @option{-fschedule-insns2} or at @option{-O2} or higher. + +@item -fsched-critical-path-heuristic +@opindex fsched-critical-path-heuristic +Enable the critical-path heuristic in the scheduler. This is enabled +by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} +or @option{-fschedule-insns2} or at @option{-O2} or higher. + +@item -fsched-spec-insn-heuristic +@opindex fsched-spec-insn-heuristic +Enable the speculative instruction heuristic in the scheduler. This is +enabled by default when scheduling is enabled, i.e.@: with +@option{-fschedule-insns} or @option{-fschedule-insns2} or +at @option{-O2} or higher. + +@item -fsched-reg-pressure-heuristic +@opindex fsched-reg-pressure-heuristic +Enable the register pressure heuristic in the scheduler. This only makes +sense when scheduling before register allocation, i.e.@: +with @option{-fschedule-insns} or at @option{-O2} or higher. + +@item -fsched-rank-heuristic +@opindex fsched-rank-heuristic +Enable the rank heuristic in the scheduler. This is enabled by default +when scheduling is enabled, i.e.@: with @option{-fschedule-insns} +or @option{-fschedule-insns2} or at @option{-O2} or higher. + +@item -fsched-last-insn-heuristic +@opindex fsched-last-insn-heuristic +Enable the last-instruction heuristic in the scheduler. This is enabled +by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} +or @option{-fschedule-insns2} or at @option{-O2} or higher. + +@item -fsched-dep-count-heuristic +@opindex fsched-dep-count-heuristic +Enable the dependent-count heuristic in the scheduler. This is enabled +by default when scheduling is enabled, i.e.@: with @option{-fschedule-insns} +or @option{-fschedule-insns2} or at @option{-O2} or higher. + @item -fsched2-use-traces @opindex fsched2-use-traces Use @option{-fsched2-use-superblocks} algorithm when scheduling after register diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c index 66be7e5d94b..95cbfc1b1a8 100644 --- a/gcc/haifa-sched.c +++ b/gcc/haifa-sched.c @@ -890,7 +890,8 @@ rank_for_schedule (const void *x, const void *y) int val, priority_val, weight_val, info_val; /* The insn in a schedule group should be issued the first. */ - if (SCHED_GROUP_P (tmp) != SCHED_GROUP_P (tmp2)) + if (flag_sched_group_heuristic && + SCHED_GROUP_P (tmp) != SCHED_GROUP_P (tmp2)) return SCHED_GROUP_P (tmp2) ? 1 : -1; /* Make sure that priority of TMP and TMP2 are initialized. */ @@ -899,11 +900,11 @@ rank_for_schedule (const void *x, const void *y) /* Prefer insn with higher priority. */ priority_val = INSN_PRIORITY (tmp2) - INSN_PRIORITY (tmp); - if (priority_val) + if (flag_sched_critical_path_heuristic && priority_val) return priority_val; /* Prefer speculative insn with greater dependencies weakness. */ - if (spec_info) + if (flag_sched_spec_insn_heuristic && spec_info) { ds_t ds1, ds2; dw_t dw1, dw2; @@ -927,16 +928,16 @@ rank_for_schedule (const void *x, const void *y) } /* Prefer an insn with smaller contribution to registers-pressure. */ - if (!reload_completed && + if (flag_sched_reg_pressure_heuristic && !reload_completed && (weight_val = INSN_REG_WEIGHT (tmp) - INSN_REG_WEIGHT (tmp2))) return weight_val; info_val = (*current_sched_info->rank) (tmp, tmp2); - if (info_val) + if(flag_sched_rank_heuristic && info_val) return info_val; /* Compare insns based on their relation to the last-scheduled-insn. */ - if (INSN_P (last_scheduled_insn)) + if (flag_sched_last_insn_heuristic && INSN_P (last_scheduled_insn)) { dep_t dep1; dep_t dep2; @@ -977,7 +978,7 @@ rank_for_schedule (const void *x, const void *y) val = (sd_lists_size (tmp2, SD_LIST_FORW) - sd_lists_size (tmp, SD_LIST_FORW)); - if (val != 0) + if (flag_sched_dep_count_heuristic && val != 0) return val; /* If insns are equally good, sort by INSN_LUID (original insn order), -- cgit v1.2.3