Commit 6e456a10 by Eric Botcazou Committed by Eric Botcazou

re PR rtl-optimization/16294 (Missed delay slot scheduling opportunity)

	PR rtl-optimization/16294
	* resource.c (return_insn_p): New predicate.
	(mark_target_live_regs): Use it.  Special-case return insns.
	(init_resource_info): Use it.  Don't scan the epilogue past
	a return.

From-SVN: r84874
parent 8a807136
2004-07-17 Eric Botcazou <ebotcazou@libertysurf.fr>
PR rtl-optimization/16294
* resource.c (return_insn_p): New predicate.
(mark_target_live_regs): Use it. Special-case return insns.
(init_resource_info): Use it. Don't scan the epilogue past
a return.
2004-07-17 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> 2004-07-17 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* loop-init.c (loop_optimizer_init, loop_optimizer_finalize): Do not * loop-init.c (loop_optimizer_init, loop_optimizer_finalize): Do not
......
...@@ -836,6 +836,20 @@ mark_set_resources (rtx x, struct resources *res, int in_dest, ...@@ -836,6 +836,20 @@ mark_set_resources (rtx x, struct resources *res, int in_dest,
} }
} }
/* Return TRUE if INSN is a return, possibly with a filled delay slot. */
static bool
return_insn_p (rtx insn)
{
if (GET_CODE (insn) == JUMP_INSN && GET_CODE (PATTERN (insn)) == RETURN)
return true;
if (GET_CODE (insn) == INSN && GET_CODE (PATTERN (insn)) == SEQUENCE)
return return_insn_p (XVECEXP (PATTERN (insn), 0, 0));
return false;
}
/* Set the resources that are live at TARGET. /* Set the resources that are live at TARGET.
If TARGET is zero, we refer to the end of the current function and can If TARGET is zero, we refer to the end of the current function and can
...@@ -894,6 +908,14 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res) ...@@ -894,6 +908,14 @@ mark_target_live_regs (rtx insns, rtx target, struct resources *res)
return; return;
} }
/* Handle return insn. */
else if (return_insn_p (target))
{
*res = end_of_function_needs;
mark_referenced_resources (target, res, 0);
return;
}
/* We have to assume memory is needed, but the CC isn't. */ /* We have to assume memory is needed, but the CC isn't. */
res->memory = 1; res->memory = 1;
res->volatil = res->unch_memory = 0; res->volatil = res->unch_memory = 0;
...@@ -1204,8 +1226,12 @@ init_resource_info (rtx epilogue_insn) ...@@ -1204,8 +1226,12 @@ init_resource_info (rtx epilogue_insn)
start_of_epilogue_needs = end_of_function_needs; start_of_epilogue_needs = end_of_function_needs;
while ((epilogue_insn = next_nonnote_insn (epilogue_insn))) while ((epilogue_insn = next_nonnote_insn (epilogue_insn)))
mark_set_resources (epilogue_insn, &end_of_function_needs, 0, {
MARK_SRC_DEST_CALL); mark_set_resources (epilogue_insn, &end_of_function_needs, 0,
MARK_SRC_DEST_CALL);
if (return_insn_p (epilogue_insn))
break;
}
/* Allocate and initialize the tables used by mark_target_live_regs. */ /* Allocate and initialize the tables used by mark_target_live_regs. */
target_hash_table = xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *)); target_hash_table = xcalloc (TARGET_HASH_PRIME, sizeof (struct target_info *));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment