From d9214e537de1b3251676c568012d1eedc69ccc2f Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Sun, 20 May 2001 13:03:15 -0700 Subject: [PATCH] sched-deps.c (sched_analyze_insn): Force volatile memory reads to be output before a branch. * sched-deps.c (sched_analyze_insn): Force volatile memory reads to be output before a branch. From-SVN: r42358 --- gcc/ChangeLog | 5 +++++ gcc/sched-deps.c | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7843db40cd1..1ed2011415b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-05-20 Richard Henderson + + * sched-deps.c (sched_analyze_insn): Force volatile memory reads + to be output before a branch. + 2001-05-20 Richard Henderson * Makefile.in (dwarf2asm.o): Depend on $(TREE_H). diff --git a/gcc/sched-deps.c b/gcc/sched-deps.c index ecdf28212ba..d303e7a86df 100644 --- a/gcc/sched-deps.c +++ b/gcc/sched-deps.c @@ -1044,12 +1044,25 @@ sched_analyze_insn (deps, x, insn, loop_notes) CLEAR_REG_SET (&tmp); + /* All memory writes and volatile reads must happen before the + jump. Non-volatile reads must happen before the jump iff + the result is needed by the above register used mask. */ + pending = deps->pending_write_insns; pending_mem = deps->pending_write_mems; while (pending) { add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT); + pending = XEXP (pending, 1); + pending_mem = XEXP (pending_mem, 1); + } + pending = deps->pending_read_insns; + pending_mem = deps->pending_read_mems; + while (pending) + { + if (MEM_VOLATILE_P (XEXP (pending_mem, 0))) + add_dependence (insn, XEXP (pending, 0), REG_DEP_OUTPUT); pending = XEXP (pending, 1); pending_mem = XEXP (pending_mem, 1); } -- 2.30.2