From c8f5fc7032940ad6633f932ac40cade82ec4d0cc Mon Sep 17 00:00:00 2001 From: obrien Date: Thu, 9 May 2002 20:02:13 +0000 Subject: Gcc 3.1.0 pre-release from the FSF anoncvs repo on 9-May-2002 15:57:15 EDT. --- contrib/gcc/sched-rgn.c | 52 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 8 deletions(-) (limited to 'contrib/gcc/sched-rgn.c') diff --git a/contrib/gcc/sched-rgn.c b/contrib/gcc/sched-rgn.c index e5a241b..ab65e2c 100644 --- a/contrib/gcc/sched-rgn.c +++ b/contrib/gcc/sched-rgn.c @@ -294,6 +294,8 @@ static int haifa_classify_insn PARAMS ((rtx)); static int is_prisky PARAMS ((rtx, int, int)); static int is_exception_free PARAMS ((rtx, int, int)); +static bool sets_likely_spilled PARAMS ((rtx)); +static void sets_likely_spilled_1 PARAMS ((rtx, rtx, void *)); static void add_branch_dependences PARAMS ((rtx, rtx)); static void compute_block_backward_dependences PARAMS ((int)); void debug_dependencies PARAMS ((void)); @@ -337,7 +339,7 @@ is_cfg_nonregular () /* If we have exception handlers, then we consider the cfg not well structured. ?!? We should be able to handle this now that flow.c computes an accurate cfg for EH. */ - if (exception_handler_labels) + if (current_function_has_exception_handlers ()) return 1; /* If we have non-jumping insns which refer to labels, then we consider @@ -2268,6 +2270,31 @@ static struct sched_info region_sched_info = 0, 0 }; +/* Determine if PAT sets a CLASS_LIKELY_SPILLED_P register. */ + +static bool +sets_likely_spilled (pat) + rtx pat; +{ + bool ret = false; + note_stores (pat, sets_likely_spilled_1, &ret); + return ret; +} + +static void +sets_likely_spilled_1 (x, pat, data) + rtx x, pat; + void *data; +{ + bool *ret = (bool *) data; + + if (GET_CODE (pat) == SET + && REG_P (x) + && REGNO (x) < FIRST_PSEUDO_REGISTER + && CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (REGNO (x)))) + *ret = true; +} + /* Add dependences so that branches are scheduled to run last in their block. */ @@ -2277,15 +2304,22 @@ add_branch_dependences (head, tail) { rtx insn, last; - /* For all branches, calls, uses, clobbers, and cc0 setters, force them - to remain in order at the end of the block by adding dependencies and - giving the last a high priority. There may be notes present, and - prev_head may also be a note. + /* For all branches, calls, uses, clobbers, cc0 setters, and instructions + that can throw exceptions, force them to remain in order at the end of + the block by adding dependencies and giving the last a high priority. + There may be notes present, and prev_head may also be a note. Branches must obviously remain at the end. Calls should remain at the end since moving them results in worse register allocation. Uses remain - at the end to ensure proper register allocation. cc0 setters remaim - at the end because they can't be moved away from their cc0 user. */ + at the end to ensure proper register allocation. + + cc0 setters remaim at the end because they can't be moved away from + their cc0 user. + + Insns setting CLASS_LIKELY_SPILLED_P registers (usually return values) + are not moved before reload because we can wind up with register + allocation failures. */ + insn = tail; last = 0; while (GET_CODE (insn) == CALL_INSN @@ -2293,10 +2327,12 @@ add_branch_dependences (head, tail) || (GET_CODE (insn) == INSN && (GET_CODE (PATTERN (insn)) == USE || GET_CODE (PATTERN (insn)) == CLOBBER + || can_throw_internal (insn) #ifdef HAVE_cc0 || sets_cc0_p (PATTERN (insn)) #endif - )) + || (!reload_completed + && sets_likely_spilled (PATTERN (insn))))) || GET_CODE (insn) == NOTE) { if (GET_CODE (insn) != NOTE) -- cgit v1.1