diff options
author | vmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-09 23:15:34 +0000 |
---|---|---|
committer | vmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-01-09 23:15:34 +0000 |
commit | 58ada791d3cb97df7eae8ab3db29f9a5d4149e79 (patch) | |
tree | 4c2dc43818bfc1ad93057e3973541f95b57fd3cc /gcc/sched-deps.c | |
parent | e7bf79cf831a76f2e0d6c514f704aebcb6c389e8 (diff) | |
download | gcc-58ada791d3cb97df7eae8ab3db29f9a5d4149e79.tar.gz |
2003-01-09 Vladimir Makarov <vmakarov@redhat.com>
Merging changes from itanium-sched-branch:
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@61132 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r-- | gcc/sched-deps.c | 136 |
1 files changed, 36 insertions, 100 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index ec3df2c1596..a735125495c 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -83,14 +83,12 @@ static sbitmap *forward_dependency_cache; static int deps_may_trap_p PARAMS ((rtx)); static void add_dependence_list PARAMS ((rtx, rtx, enum reg_note)); static void add_dependence_list_and_free PARAMS ((rtx, rtx *, enum reg_note)); -static void remove_dependence PARAMS ((rtx, rtx)); static void set_sched_group_p PARAMS ((rtx)); static void flush_pending_lists PARAMS ((struct deps *, rtx, int, int)); static void sched_analyze_1 PARAMS ((struct deps *, rtx, rtx)); static void sched_analyze_2 PARAMS ((struct deps *, rtx, rtx)); static void sched_analyze_insn PARAMS ((struct deps *, rtx, rtx, rtx)); -static rtx group_leader PARAMS ((rtx)); static rtx get_condition PARAMS ((rtx)); static int conditions_mutex_p PARAMS ((rtx, rtx)); @@ -237,18 +235,16 @@ add_dependence (insn, elem, dep_type) rtx nnext; while ((nnext = next_nonnote_insn (next)) != NULL && INSN_P (nnext) + && next != insn && SCHED_GROUP_P (nnext)) next = nnext; - /* Again, don't depend an insn on itself. */ - if (insn == next) - return; + if (insn != next) + add_dependence (insn, next, REG_DEP_ANTI); - /* Make the dependence to NEXT, the last insn of the group, instead - of the original ELEM. */ - elem = next; } + present_p = 1; #ifdef INSN_SCHEDULING /* ??? No good way to tell from here whether we're doing interblock @@ -384,76 +380,6 @@ add_dependence_list_and_free (insn, listp, dep_type) } } -/* Remove ELEM wrapped in an INSN_LIST from the LOG_LINKS - of INSN. Abort if not found. */ - -static void -remove_dependence (insn, elem) - rtx insn; - rtx elem; -{ - rtx prev, link, next; - int found = 0; - - for (prev = 0, link = LOG_LINKS (insn); link; link = next) - { - next = XEXP (link, 1); - if (XEXP (link, 0) == elem) - { - if (prev) - XEXP (prev, 1) = next; - else - LOG_LINKS (insn) = next; - -#ifdef INSN_SCHEDULING - /* If we are removing a dependency from the LOG_LINKS list, - make sure to remove it from the cache too. */ - if (true_dependency_cache != NULL) - { - if (REG_NOTE_KIND (link) == 0) - RESET_BIT (true_dependency_cache[INSN_LUID (insn)], - INSN_LUID (elem)); - else if (REG_NOTE_KIND (link) == REG_DEP_ANTI) - RESET_BIT (anti_dependency_cache[INSN_LUID (insn)], - INSN_LUID (elem)); - else if (REG_NOTE_KIND (link) == REG_DEP_OUTPUT) - RESET_BIT (output_dependency_cache[INSN_LUID (insn)], - INSN_LUID (elem)); - } -#endif - - free_INSN_LIST_node (link); - - found = 1; - } - else - prev = link; - } - - if (!found) - abort (); - return; -} - -/* Return an insn which represents a SCHED_GROUP, which is - the last insn in the group. */ - -static rtx -group_leader (insn) - rtx insn; -{ - rtx prev; - - do - { - prev = insn; - insn = next_nonnote_insn (insn); - } - while (insn && INSN_P (insn) && SCHED_GROUP_P (insn)); - - return prev; -} - /* Set SCHED_GROUP_P and care for the rest of the bookkeeping that goes along with that. */ @@ -465,21 +391,21 @@ set_sched_group_p (insn) SCHED_GROUP_P (insn) = 1; - /* There may be a note before this insn now, but all notes will - be removed before we actually try to schedule the insns, so - it won't cause a problem later. We must avoid it here though. */ + for (link = LOG_LINKS (insn); link; link = XEXP (link, 1)) + { + prev = insn; + do + { + prev = prev_nonnote_insn (prev); + if (XEXP (link, 0) == prev) + break; + } + while (SCHED_GROUP_P (prev)); + if (XEXP (link, 0) != prev) + add_dependence (prev, XEXP (link, 0), REG_DEP_ANTI); + } prev = prev_nonnote_insn (insn); - - /* Make a copy of all dependencies on the immediately previous insn, - and add to this insn. This is so that all the dependencies will - apply to the group. Remove an explicit dependence on this insn - as SCHED_GROUP_P now represents it. */ - - if (find_insn_list (prev, LOG_LINKS (insn))) - remove_dependence (insn, prev); - - for (link = LOG_LINKS (prev); link; link = XEXP (link, 1)) - add_dependence (insn, XEXP (link, 0), REG_NOTE_KIND (link)); + add_dependence (insn, prev, REG_DEP_ANTI); } /* Process an insn's memory dependencies. There are four kinds of @@ -983,7 +909,15 @@ sched_analyze_insn (deps, x, insn, loop_notes) INIT_REG_SET (&tmp); (*current_sched_info->compute_jump_reg_dependencies) (insn, &tmp); - IOR_REG_SET (reg_pending_uses, &tmp); + /* Make latency of jump equal to 0 by using anti-dependence. */ + EXECUTE_IF_SET_IN_REG_SET (&tmp, 0, i, + { + struct deps_reg *reg_last = &deps->reg_last[i]; + add_dependence_list (insn, reg_last->sets, REG_DEP_ANTI); + add_dependence_list (insn, reg_last->clobbers, REG_DEP_ANTI); + reg_last->uses_length++; + reg_last->uses = alloc_INSN_LIST (insn, reg_last->uses); + }); CLEAR_REG_SET (&tmp); /* All memory writes and volatile reads must happen before the @@ -1049,14 +983,16 @@ sched_analyze_insn (deps, x, insn, loop_notes) /* Add dependencies if a scheduling barrier was found. */ if (reg_pending_barrier) { + /* In the case of barrier the most added dependencies are not + real, so we use anti-dependence here. */ if (GET_CODE (PATTERN (insn)) == COND_EXEC) { EXECUTE_IF_SET_IN_REG_SET (&deps->reg_last_in_use, 0, i, { struct deps_reg *reg_last = &deps->reg_last[i]; add_dependence_list (insn, reg_last->uses, REG_DEP_ANTI); - add_dependence_list (insn, reg_last->sets, 0); - add_dependence_list (insn, reg_last->clobbers, 0); + add_dependence_list (insn, reg_last->sets, REG_DEP_ANTI); + add_dependence_list (insn, reg_last->clobbers, REG_DEP_ANTI); }); } else @@ -1066,8 +1002,10 @@ sched_analyze_insn (deps, x, insn, loop_notes) struct deps_reg *reg_last = &deps->reg_last[i]; add_dependence_list_and_free (insn, ®_last->uses, REG_DEP_ANTI); - add_dependence_list_and_free (insn, ®_last->sets, 0); - add_dependence_list_and_free (insn, ®_last->clobbers, 0); + add_dependence_list_and_free (insn, ®_last->sets, + REG_DEP_ANTI); + add_dependence_list_and_free (insn, ®_last->clobbers, + REG_DEP_ANTI); reg_last->uses_length = 0; reg_last->clobbers_length = 0; }); @@ -1432,11 +1370,9 @@ compute_forward_dependences (head, tail) if (! INSN_P (insn)) continue; - insn = group_leader (insn); - for (link = LOG_LINKS (insn); link; link = XEXP (link, 1)) { - rtx x = group_leader (XEXP (link, 0)); + rtx x = XEXP (link, 0); rtx new_link; if (x != XEXP (link, 0)) |