summaryrefslogtreecommitdiff
path: root/gcc/sched-deps.c
diff options
context:
space:
mode:
authorvmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-25 20:40:57 +0000
committervmakarov <vmakarov@138bc75d-0d04-0410-961f-82ee72b054a4>2003-02-25 20:40:57 +0000
commit9b7c6f02f57bb9b25dd127dacf55219a8432b03e (patch)
tree438a955cba1ac5046f0de88f563fe3a571086f7f /gcc/sched-deps.c
parentad92037a0defae40f46ee012e85e7caa00adc7e7 (diff)
downloadgcc-9b7c6f02f57bb9b25dd127dacf55219a8432b03e.tar.gz
2003-02-25 Vladimir Makarov <vmakarov@redhat.com>
Richard Henderson <rth@redhat.com> * sched-int.h (INSN_TRAP_CLASS, WORST_CLASS): Move them from sched-rgn.c. (add_forward_dependence): New function prototype. * sched-rgn.c (INSN_TRAP_CLASS, WORST_CLASS): Move them to sched-init.h. (CONST_BASED_ADDRESS_P, may_trap_exp, haifa_classify_insn): Move them to haifa-sched.c. * haifa-sched.c (CONST_BASED_ADDRESS_P, may_trap_exp, haifa_classify_insn): Move them from sched-rgn.c. * sched-deps.c (add_dependence): Return flag of creating a new entry. (add_forward_dependence): New function. (compute_forward_dependences): Use the function. * sched-ebb.c (earliest_block_with_similiar_load): New function. (add_deps_for_risky_insns): New function. (schedule_ebb): Call the function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63415 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/sched-deps.c')
-rw-r--r--gcc/sched-deps.c101
1 files changed, 54 insertions, 47 deletions
diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c
index fc9d4d857db..b3c619df51d 100644
--- a/gcc/sched-deps.c
+++ b/gcc/sched-deps.c
@@ -173,10 +173,11 @@ conditions_mutex_p (cond1, cond2)
}
/* Add ELEM wrapped in an INSN_LIST with reg note kind DEP_TYPE to the
- LOG_LINKS of INSN, if not already there. DEP_TYPE indicates the type
- of dependence that this link represents. */
+ LOG_LINKS of INSN, if not already there. DEP_TYPE indicates the
+ type of dependence that this link represents. The function returns
+ nonzero if a new entry has been added to insn's LOG_LINK. */
-void
+int
add_dependence (insn, elem, dep_type)
rtx insn;
rtx elem;
@@ -188,13 +189,13 @@ add_dependence (insn, elem, dep_type)
/* Don't depend an insn on itself. */
if (insn == elem)
- return;
+ return 0;
/* We can get a dependency on deleted insns due to optimizations in
the register allocation and reloading or due to splitting. Any
such dependency is useless and can be ignored. */
if (GET_CODE (elem) == NOTE)
- return;
+ return 0;
/* flow.c doesn't handle conditional lifetimes entirely correctly;
calls mess up the conditional lifetimes. */
@@ -213,7 +214,7 @@ add_dependence (insn, elem, dep_type)
/* Make sure second instruction doesn't affect condition of first
instruction if switched. */
&& !modified_in_p (cond2, insn))
- return;
+ return 0;
}
present_p = 1;
@@ -227,7 +228,7 @@ add_dependence (insn, elem, dep_type)
elem is a CALL is still required. */
if (GET_CODE (insn) == CALL_INSN
&& (INSN_BB (elem) != INSN_BB (insn)))
- return;
+ return 0;
#endif
/* If we already have a dependency for ELEM, then we do not need to
@@ -251,7 +252,7 @@ add_dependence (insn, elem, dep_type)
else
present_p = 0;
if (present_p && (int) dep_type >= (int) present_dep_type)
- return;
+ return 0;
}
#endif
@@ -276,7 +277,7 @@ add_dependence (insn, elem, dep_type)
abort ();
}
#endif
-
+
/* If this is a more restrictive type of dependence than the existing
one, then change the existing dependence to this type. */
if ((int) dep_type < (int) REG_NOTE_KIND (link))
@@ -298,8 +299,8 @@ add_dependence (insn, elem, dep_type)
INSN_LUID (elem));
}
#endif
- return;
- }
+ return 0;
+ }
/* Might want to check one level of transitivity to save conses. */
link = alloc_INSN_LIST (elem, LOG_LINKS (insn));
@@ -321,6 +322,7 @@ add_dependence (insn, elem, dep_type)
SET_BIT (output_dependency_cache[INSN_LUID (insn)], INSN_LUID (elem));
}
#endif
+ return 1;
}
/* A convenience wrapper to operate on an entire list. */
@@ -1310,6 +1312,46 @@ sched_analyze (deps, head, tail)
abort ();
}
+
+/* The following function adds forward dependence (FROM, TO) with
+ given DEP_TYPE. The forward dependence should be not exist before. */
+
+void
+add_forward_dependence (from, to, dep_type)
+ rtx from;
+ rtx to;
+ enum reg_note dep_type;
+{
+ rtx new_link;
+
+#ifdef ENABLE_CHECKING
+ /* If add_dependence is working properly there should never
+ be notes, deleted insns or duplicates in the backward
+ links. Thus we need not check for them here.
+
+ However, if we have enabled checking we might as well go
+ ahead and verify that add_dependence worked properly. */
+ if (GET_CODE (from) == NOTE
+ || INSN_DELETED_P (from)
+ || (forward_dependency_cache != NULL
+ && TEST_BIT (forward_dependency_cache[INSN_LUID (from)],
+ INSN_LUID (to)))
+ || (forward_dependency_cache == NULL
+ && find_insn_list (to, INSN_DEPEND (from))))
+ abort ();
+ if (forward_dependency_cache != NULL)
+ SET_BIT (forward_dependency_cache[INSN_LUID (from)],
+ INSN_LUID (to));
+#endif
+
+ new_link = alloc_INSN_LIST (to, INSN_DEPEND (from));
+
+ PUT_REG_NOTE_KIND (new_link, dep_type);
+
+ INSN_DEPEND (from) = new_link;
+ INSN_DEP_COUNT (to) += 1;
+}
+
/* Examine insns in the range [ HEAD, TAIL ] and Use the backward
dependences from LOG_LINKS to build forward dependences in
INSN_DEPEND. */
@@ -1320,7 +1362,6 @@ compute_forward_dependences (head, tail)
{
rtx insn, link;
rtx next_tail;
- enum reg_note dep_type;
next_tail = NEXT_INSN (tail);
for (insn = head; insn != next_tail; insn = NEXT_INSN (insn))
@@ -1329,41 +1370,7 @@ compute_forward_dependences (head, tail)
continue;
for (link = LOG_LINKS (insn); link; link = XEXP (link, 1))
- {
- rtx x = XEXP (link, 0);
- rtx new_link;
-
- if (x != XEXP (link, 0))
- continue;
-
-#ifdef ENABLE_CHECKING
- /* If add_dependence is working properly there should never
- be notes, deleted insns or duplicates in the backward
- links. Thus we need not check for them here.
-
- However, if we have enabled checking we might as well go
- ahead and verify that add_dependence worked properly. */
- if (GET_CODE (x) == NOTE
- || INSN_DELETED_P (x)
- || (forward_dependency_cache != NULL
- && TEST_BIT (forward_dependency_cache[INSN_LUID (x)],
- INSN_LUID (insn)))
- || (forward_dependency_cache == NULL
- && find_insn_list (insn, INSN_DEPEND (x))))
- abort ();
- if (forward_dependency_cache != NULL)
- SET_BIT (forward_dependency_cache[INSN_LUID (x)],
- INSN_LUID (insn));
-#endif
-
- new_link = alloc_INSN_LIST (insn, INSN_DEPEND (x));
-
- dep_type = REG_NOTE_KIND (link);
- PUT_REG_NOTE_KIND (new_link, dep_type);
-
- INSN_DEPEND (x) = new_link;
- INSN_DEP_COUNT (insn) += 1;
- }
+ add_forward_dependence (XEXP (link, 0), insn, REG_NOTE_KIND (link));
}
}