Commit c3f14d55 by David Malcolm Committed by David Malcolm

re PR bootstrap/62304 (ICE in follow_jumps, find_dead_or_set_registers)

	PR bootstrap/62304

	* gcc/reorg.c (skip_consecutive_labels): Convert return type and
	param back from rtx_insn * to rtx.  Rename param from "label" to
	"label_or_return", reintroducing "label" as an rtx_insn * after
	we've ensured it's not a RETURN.
	(first_active_target_insn): Likewise for return type and param;
	add a checked cast to rtx_insn * once we've ensured "insn" is not
	a RETURN.
	(steal_delay_list_from_target): Convert param "pnew_thread" back
	from rtx_insn ** to rtx *.  Replace use of JUMP_LABEL_AS_INSN
	with JUMP_LABEL.
	(own_thread_p): Convert param "thread" back from an rtx_insn * to
	an rtx.  Introduce local rtx_insn * "thread_insn" with a checked
	cast once we've established we're not dealing with a RETURN,
	renaming subsequent uses of "thread" to "thread_insn".
	(fill_simple_delay_slots): Convert uses of JUMP_LABEL_AS_INSN back
	to JUMP_LABEL.
	(follow_jumps): Convert return type and param "label" from
	rtx_insn * back to rtx.  Move initialization of "value" to after
	the handling for ANY_RETURN_P, adding a checked cast there to
	rtx_insn *.  Convert local rtx_insn * "this_label" to an rtx and
	rename to "this_label_or_return", reintroducing "this_label" as
	an rtx_insn * once we've handled the case where it could be an
	ANY_RETURN_P.
	(fill_slots_from_thread): Rename param "thread" to
	"thread_or_return", converting from an rtx_insn * back to an rtx.
	Reintroduce name "thread" as an rtx_insn * local with a checked
	cast once we've handled the case of it being an ANY_RETURN_P.
	Convert local "new_thread" from an rtx_insn * back to an rtx.
	Add a checked cast when assigning to "trial" from "new_thread".
	Convert use of JUMP_LABEL_AS_INSN back to JUMP_LABEL.  Add a
	checked cast to rtx_insn * from "new_thread" when invoking
	get_label_before.
	(fill_eager_delay_slots): Convert locals "target_label",
	"insn_at_target" from rtx_insn * back to rtx.
	Convert uses of JUMP_LABEL_AS_INSN back to JUMP_LABEL.
	(relax_delay_slots): Convert locals "trial", "target_label" from
	rtx_insn * back to rtx.  Convert uses of JUMP_LABEL_AS_INSN back
	to JUMP_LABEL.  Add a checked cast to rtx_insn * on "trial" when
	invoking update_block.
	(dbr_schedule): Convert use of JUMP_LABEL_AS_INSN back to
	JUMP_LABEL; this removes all JUMP_LABEL_AS_INSN from reorg.c.

	* resource.h (mark_target_live_regs): Undo erroneous conversion
	of second param of r214693, converting it back from rtx_insn * to
	rtx, since it could be a RETURN.

	* resource.c (find_dead_or_set_registers): Similarly, convert
	param "jump_target" back from an rtx_insn ** to an rtx *, as we
	could be writing back a RETURN.  Rename local rtx_insn * "next" to
	"next_insn", and introduce "lab_or_return" as a local rtx,
	handling the case where JUMP_LABEL (this_jump_insn) is a RETURN.
	(mark_target_live_regs): Undo erroneous conversion
	of second param of r214693, converting it back from rtx_insn * to
	rtx, since it could be a RETURN.  Rename it from "target" to
	"target_maybe_return", reintroducing the name "target" as a local
	rtx_insn * with a checked cast, after we've handled the case of
	ANY_RETURN_P.

From-SVN: r214752
parent 124aeea1
2014-08-30 David Malcolm <dmalcolm@redhat.com>
PR bootstrap/62304
* gcc/reorg.c (skip_consecutive_labels): Convert return type and
param back from rtx_insn * to rtx. Rename param from "label" to
"label_or_return", reintroducing "label" as an rtx_insn * after
we've ensured it's not a RETURN.
(first_active_target_insn): Likewise for return type and param;
add a checked cast to rtx_insn * once we've ensured "insn" is not
a RETURN.
(steal_delay_list_from_target): Convert param "pnew_thread" back
from rtx_insn ** to rtx *. Replace use of JUMP_LABEL_AS_INSN
with JUMP_LABEL.
(own_thread_p): Convert param "thread" back from an rtx_insn * to
an rtx. Introduce local rtx_insn * "thread_insn" with a checked
cast once we've established we're not dealing with a RETURN,
renaming subsequent uses of "thread" to "thread_insn".
(fill_simple_delay_slots): Convert uses of JUMP_LABEL_AS_INSN back
to JUMP_LABEL.
(follow_jumps): Convert return type and param "label" from
rtx_insn * back to rtx. Move initialization of "value" to after
the handling for ANY_RETURN_P, adding a checked cast there to
rtx_insn *. Convert local rtx_insn * "this_label" to an rtx and
rename to "this_label_or_return", reintroducing "this_label" as
an rtx_insn * once we've handled the case where it could be an
ANY_RETURN_P.
(fill_slots_from_thread): Rename param "thread" to
"thread_or_return", converting from an rtx_insn * back to an rtx.
Reintroduce name "thread" as an rtx_insn * local with a checked
cast once we've handled the case of it being an ANY_RETURN_P.
Convert local "new_thread" from an rtx_insn * back to an rtx.
Add a checked cast when assigning to "trial" from "new_thread".
Convert use of JUMP_LABEL_AS_INSN back to JUMP_LABEL. Add a
checked cast to rtx_insn * from "new_thread" when invoking
get_label_before.
(fill_eager_delay_slots): Convert locals "target_label",
"insn_at_target" from rtx_insn * back to rtx.
Convert uses of JUMP_LABEL_AS_INSN back to JUMP_LABEL.
(relax_delay_slots): Convert locals "trial", "target_label" from
rtx_insn * back to rtx. Convert uses of JUMP_LABEL_AS_INSN back
to JUMP_LABEL. Add a checked cast to rtx_insn * on "trial" when
invoking update_block.
(dbr_schedule): Convert use of JUMP_LABEL_AS_INSN back to
JUMP_LABEL; this removes all JUMP_LABEL_AS_INSN from reorg.c.
* resource.h (mark_target_live_regs): Undo erroneous conversion
of second param of r214693, converting it back from rtx_insn * to
rtx, since it could be a RETURN.
* resource.c (find_dead_or_set_registers): Similarly, convert
param "jump_target" back from an rtx_insn ** to an rtx *, as we
could be writing back a RETURN. Rename local rtx_insn * "next" to
"next_insn", and introduce "lab_or_return" as a local rtx,
handling the case where JUMP_LABEL (this_jump_insn) is a RETURN.
(mark_target_live_regs): Undo erroneous conversion
of second param of r214693, converting it back from rtx_insn * to
rtx, since it could be a RETURN. Rename it from "target" to
"target_maybe_return", reintroducing the name "target" as a local
rtx_insn * with a checked cast, after we've handled the case of
ANY_RETURN_P.
2014-08-29 DJ Delorie <dj@redhat.com> 2014-08-29 DJ Delorie <dj@redhat.com>
* cppbuiltin.c (define_builtin_macros_for_type_sizes): Round * cppbuiltin.c (define_builtin_macros_for_type_sizes): Round
...@@ -81,7 +81,7 @@ static void update_live_status (rtx, const_rtx, void *); ...@@ -81,7 +81,7 @@ static void update_live_status (rtx, const_rtx, void *);
static int find_basic_block (rtx, int); static int find_basic_block (rtx, int);
static rtx_insn *next_insn_no_annul (rtx_insn *); static rtx_insn *next_insn_no_annul (rtx_insn *);
static rtx_insn *find_dead_or_set_registers (rtx_insn *, struct resources*, static rtx_insn *find_dead_or_set_registers (rtx_insn *, struct resources*,
rtx_insn **, int, struct resources, rtx *, int, struct resources,
struct resources); struct resources);
/* Utility function called from mark_target_live_regs via note_stores. /* Utility function called from mark_target_live_regs via note_stores.
...@@ -422,19 +422,20 @@ mark_referenced_resources (rtx x, struct resources *res, ...@@ -422,19 +422,20 @@ mark_referenced_resources (rtx x, struct resources *res,
static rtx_insn * static rtx_insn *
find_dead_or_set_registers (rtx_insn *target, struct resources *res, find_dead_or_set_registers (rtx_insn *target, struct resources *res,
rtx_insn **jump_target, int jump_count, rtx *jump_target, int jump_count,
struct resources set, struct resources needed) struct resources set, struct resources needed)
{ {
HARD_REG_SET scratch; HARD_REG_SET scratch;
rtx_insn *insn, *next; rtx_insn *insn;
rtx_insn *next_insn;
rtx_insn *jump_insn = 0; rtx_insn *jump_insn = 0;
int i; int i;
for (insn = target; insn; insn = next) for (insn = target; insn; insn = next_insn)
{ {
rtx_insn *this_jump_insn = insn; rtx_insn *this_jump_insn = insn;
next = NEXT_INSN (insn); next_insn = NEXT_INSN (insn);
/* If this instruction can throw an exception, then we don't /* If this instruction can throw an exception, then we don't
know where we might end up next. That means that we have to know where we might end up next. That means that we have to
...@@ -497,14 +498,16 @@ find_dead_or_set_registers (rtx_insn *target, struct resources *res, ...@@ -497,14 +498,16 @@ find_dead_or_set_registers (rtx_insn *target, struct resources *res,
if (any_uncondjump_p (this_jump_insn) if (any_uncondjump_p (this_jump_insn)
|| ANY_RETURN_P (PATTERN (this_jump_insn))) || ANY_RETURN_P (PATTERN (this_jump_insn)))
{ {
next = JUMP_LABEL_AS_INSN (this_jump_insn); rtx lab_or_return = JUMP_LABEL (this_jump_insn);
if (ANY_RETURN_P (next)) if (ANY_RETURN_P (lab_or_return))
next = NULL; next_insn = NULL;
else
next_insn = as_a <rtx_insn *> (lab_or_return);
if (jump_insn == 0) if (jump_insn == 0)
{ {
jump_insn = insn; jump_insn = insn;
if (jump_target) if (jump_target)
*jump_target = JUMP_LABEL_AS_INSN (this_jump_insn); *jump_target = JUMP_LABEL (this_jump_insn);
} }
} }
else if (any_condjump_p (this_jump_insn)) else if (any_condjump_p (this_jump_insn))
...@@ -572,7 +575,7 @@ find_dead_or_set_registers (rtx_insn *target, struct resources *res, ...@@ -572,7 +575,7 @@ find_dead_or_set_registers (rtx_insn *target, struct resources *res,
find_dead_or_set_registers (JUMP_LABEL_AS_INSN (this_jump_insn), find_dead_or_set_registers (JUMP_LABEL_AS_INSN (this_jump_insn),
&target_res, 0, jump_count, &target_res, 0, jump_count,
target_set, needed); target_set, needed);
find_dead_or_set_registers (next, find_dead_or_set_registers (next_insn,
&fallthrough_res, 0, jump_count, &fallthrough_res, 0, jump_count,
set, needed); set, needed);
IOR_HARD_REG_SET (fallthrough_res.regs, target_res.regs); IOR_HARD_REG_SET (fallthrough_res.regs, target_res.regs);
...@@ -880,26 +883,30 @@ return_insn_p (const_rtx insn) ...@@ -880,26 +883,30 @@ return_insn_p (const_rtx insn)
init_resource_info () was invoked before we are called. */ init_resource_info () was invoked before we are called. */
void void
mark_target_live_regs (rtx_insn *insns, rtx_insn *target, struct resources *res) mark_target_live_regs (rtx_insn *insns, rtx target_maybe_return, struct resources *res)
{ {
int b = -1; int b = -1;
unsigned int i; unsigned int i;
struct target_info *tinfo = NULL; struct target_info *tinfo = NULL;
rtx_insn *insn; rtx_insn *insn;
rtx jump_insn = 0; rtx jump_insn = 0;
rtx_insn *jump_target; rtx jump_target;
HARD_REG_SET scratch; HARD_REG_SET scratch;
struct resources set, needed; struct resources set, needed;
/* Handle end of function. */ /* Handle end of function. */
if (target == 0 || ANY_RETURN_P (target)) if (target_maybe_return == 0 || ANY_RETURN_P (target_maybe_return))
{ {
*res = end_of_function_needs; *res = end_of_function_needs;
return; return;
} }
/* We've handled the case of RETURN/SIMPLE_RETURN; we should now have an
instruction. */
rtx_insn *target = as_a <rtx_insn *> (target_maybe_return);
/* Handle return insn. */ /* Handle return insn. */
else if (return_insn_p (target)) if (return_insn_p (target))
{ {
*res = end_of_function_needs; *res = end_of_function_needs;
mark_referenced_resources (target, res, false); mark_referenced_resources (target, res, false);
......
...@@ -44,7 +44,7 @@ enum mark_resource_type ...@@ -44,7 +44,7 @@ enum mark_resource_type
MARK_SRC_DEST_CALL = 1 MARK_SRC_DEST_CALL = 1
}; };
extern void mark_target_live_regs (rtx_insn *, rtx_insn *, struct resources *); extern void mark_target_live_regs (rtx_insn *, rtx, struct resources *);
extern void mark_set_resources (rtx, struct resources *, int, extern void mark_set_resources (rtx, struct resources *, int,
enum mark_resource_type); enum mark_resource_type);
extern void mark_referenced_resources (rtx, struct resources *, bool); extern void mark_referenced_resources (rtx, struct resources *, bool);
......
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