Commit b5241a5a by David Malcolm Committed by David Malcolm

Convert nonlocal_goto_handler_labels from an EXPR_LIST to an INSN_LIST

gcc/
2014-08-28  David Malcolm  <dmalcolm@redhat.com>

	* function.h (struct rtl_data): Convert field
	"x_nonlocal_goto_handler_labels" from rtx_expr_list * to
	rtx_insn_list *.
	* rtl.h (remove_node_from_insn_list): New prototype.

	* builtins.c (expand_builtin): When prepending to
	nonlocal_goto_handler_labels, use gen_rtx_INSN_LIST rather than
	gen_rtx_EXPR_LIST.
	* cfgbuild.c (make_edges): Convert local "x" from rtx_expr_list *
	to rtx_insn_list *, and use its "insn" method rather than
	"element" method.
	* cfgrtl.c (delete_insn): Use new function
	remove_node_from_insn_list rather than
	remove_node_from_expr_list.
	(cfg_layout_initialize): Convert local "x" from rtx_expr_list *
	to rtx_insn_list *, and use its "insn" method rather than
	"element" method.
	* dwarf2cfi.c (create_trace_edges): Likewise for local "lab".
	* reload1.c (set_initial_label_offsets): Likewise for local "x".
	* rtlanal.c (remove_node_from_insn_list): New function, adapted
	from remove_node_from_expr_list.
	* stmt.c (expand_label): When prepending to
	nonlocal_goto_handler_labels, use gen_rtx_INSN_LIST rather than
	gen_rtx_EXPR_LIST.

From-SVN: r214687
parent f48bd60e
2014-08-28 David Malcolm <dmalcolm@redhat.com> 2014-08-28 David Malcolm <dmalcolm@redhat.com>
* function.h (struct rtl_data): Convert field
"x_nonlocal_goto_handler_labels" from rtx_expr_list * to
rtx_insn_list *.
* rtl.h (remove_node_from_insn_list): New prototype.
* builtins.c (expand_builtin): When prepending to
nonlocal_goto_handler_labels, use gen_rtx_INSN_LIST rather than
gen_rtx_EXPR_LIST.
* cfgbuild.c (make_edges): Convert local "x" from rtx_expr_list *
to rtx_insn_list *, and use its "insn" method rather than
"element" method.
* cfgrtl.c (delete_insn): Use new function
remove_node_from_insn_list rather than
remove_node_from_expr_list.
(cfg_layout_initialize): Convert local "x" from rtx_expr_list *
to rtx_insn_list *, and use its "insn" method rather than
"element" method.
* dwarf2cfi.c (create_trace_edges): Likewise for local "lab".
* reload1.c (set_initial_label_offsets): Likewise for local "x".
* rtlanal.c (remove_node_from_insn_list): New function, adapted
from remove_node_from_expr_list.
* stmt.c (expand_label): When prepending to
nonlocal_goto_handler_labels, use gen_rtx_INSN_LIST rather than
gen_rtx_EXPR_LIST.
2014-08-28 David Malcolm <dmalcolm@redhat.com>
* function.h (struct rtl_data): Strengthen fields "x_return_label" * function.h (struct rtl_data): Strengthen fields "x_return_label"
and "x_naked_return_label" from rtx to rtx_code_label *. and "x_naked_return_label" from rtx to rtx_code_label *.
...@@ -6185,7 +6185,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode, ...@@ -6185,7 +6185,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget, enum machine_mode mode,
/* This is copied from the handling of non-local gotos. */ /* This is copied from the handling of non-local gotos. */
expand_builtin_setjmp_setup (buf_addr, label_r); expand_builtin_setjmp_setup (buf_addr, label_r);
nonlocal_goto_handler_labels nonlocal_goto_handler_labels
= gen_rtx_EXPR_LIST (VOIDmode, label_r, = gen_rtx_INSN_LIST (VOIDmode, label_r,
nonlocal_goto_handler_labels); nonlocal_goto_handler_labels);
/* ??? Do not let expand_label treat us as such since we would /* ??? Do not let expand_label treat us as such since we would
not want to be both on the list of non-local labels and on not want to be both on the list of non-local labels and on
......
...@@ -337,10 +337,10 @@ make_edges (basic_block min, basic_block max, int update_p) ...@@ -337,10 +337,10 @@ make_edges (basic_block min, basic_block max, int update_p)
taken, then only calls to those functions or to other taken, then only calls to those functions or to other
nested functions that use them could possibly do nested functions that use them could possibly do
nonlocal gotos. */ nonlocal gotos. */
for (rtx_expr_list *x = nonlocal_goto_handler_labels; for (rtx_insn_list *x = nonlocal_goto_handler_labels;
x; x;
x = x->next ()) x = x->next ())
make_label_edge (edge_cache, bb, x->element (), make_label_edge (edge_cache, bb, x->insn (),
EDGE_ABNORMAL | EDGE_ABNORMAL_CALL); EDGE_ABNORMAL | EDGE_ABNORMAL_CALL);
} }
......
...@@ -159,7 +159,7 @@ delete_insn (rtx uncast_insn) ...@@ -159,7 +159,7 @@ delete_insn (rtx uncast_insn)
} }
} }
remove_node_from_expr_list (insn, &nonlocal_goto_handler_labels); remove_node_from_insn_list (insn, &nonlocal_goto_handler_labels);
} }
if (really_delete) if (really_delete)
...@@ -4216,7 +4216,7 @@ cfg_layout_duplicate_bb (basic_block bb) ...@@ -4216,7 +4216,7 @@ cfg_layout_duplicate_bb (basic_block bb)
void void
cfg_layout_initialize (unsigned int flags) cfg_layout_initialize (unsigned int flags)
{ {
rtx_expr_list *x; rtx_insn_list *x;
basic_block bb; basic_block bb;
/* Once bb partitioning is complete, cfg layout mode should not be /* Once bb partitioning is complete, cfg layout mode should not be
...@@ -4237,7 +4237,7 @@ cfg_layout_initialize (unsigned int flags) ...@@ -4237,7 +4237,7 @@ cfg_layout_initialize (unsigned int flags)
/* Make sure that the targets of non local gotos are marked. */ /* Make sure that the targets of non local gotos are marked. */
for (x = nonlocal_goto_handler_labels; x; x = x->next ()) for (x = nonlocal_goto_handler_labels; x; x = x->next ())
{ {
bb = BLOCK_FOR_INSN (x->element ()); bb = BLOCK_FOR_INSN (x->insn ());
bb->flags |= BB_NON_LOCAL_GOTO_TARGET; bb->flags |= BB_NON_LOCAL_GOTO_TARGET;
} }
......
...@@ -2338,10 +2338,10 @@ create_trace_edges (rtx insn) ...@@ -2338,10 +2338,10 @@ create_trace_edges (rtx insn)
/* Process non-local goto edges. */ /* Process non-local goto edges. */
if (can_nonlocal_goto (insn)) if (can_nonlocal_goto (insn))
for (rtx_expr_list *lab = nonlocal_goto_handler_labels; for (rtx_insn_list *lab = nonlocal_goto_handler_labels;
lab; lab;
lab = lab->next ()) lab = lab->next ())
maybe_record_trace_start_abnormal (lab->element (), insn); maybe_record_trace_start_abnormal (lab->insn (), insn);
} }
else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (PATTERN (insn))) else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (PATTERN (insn)))
{ {
......
...@@ -264,9 +264,9 @@ struct GTY(()) rtl_data { ...@@ -264,9 +264,9 @@ struct GTY(()) rtl_data {
Used for detecting stack clobbers. */ Used for detecting stack clobbers. */
tree stack_protect_guard; tree stack_protect_guard;
/* List (chain of EXPR_LIST) of labels heading the current handlers for /* List (chain of INSN_LIST) of labels heading the current handlers for
nonlocal gotos. */ nonlocal gotos. */
rtx_expr_list *x_nonlocal_goto_handler_labels; rtx_insn_list *x_nonlocal_goto_handler_labels;
/* Label that will go on function epilogue. /* Label that will go on function epilogue.
Jumping to this label serves as a "return" instruction Jumping to this label serves as a "return" instruction
......
...@@ -3915,9 +3915,9 @@ set_initial_label_offsets (void) ...@@ -3915,9 +3915,9 @@ set_initial_label_offsets (void)
if (x->element ()) if (x->element ())
set_label_offsets (x->element (), NULL, 1); set_label_offsets (x->element (), NULL, 1);
for (rtx_expr_list *x = nonlocal_goto_handler_labels; x; x = x->next ()) for (rtx_insn_list *x = nonlocal_goto_handler_labels; x; x = x->next ())
if (x->element ()) if (x->insn ())
set_label_offsets (x->element (), NULL, 1); set_label_offsets (x->insn (), NULL, 1);
for_each_eh_label (set_initial_eh_label_offset); for_each_eh_label (set_initial_eh_label_offset);
} }
......
...@@ -2828,6 +2828,7 @@ extern rtx regno_use_in (unsigned int, rtx); ...@@ -2828,6 +2828,7 @@ extern rtx regno_use_in (unsigned int, rtx);
extern int auto_inc_p (const_rtx); extern int auto_inc_p (const_rtx);
extern int in_expr_list_p (const_rtx, const_rtx); extern int in_expr_list_p (const_rtx, const_rtx);
extern void remove_node_from_expr_list (const_rtx, rtx_expr_list **); extern void remove_node_from_expr_list (const_rtx, rtx_expr_list **);
extern void remove_node_from_insn_list (const rtx_insn *, rtx_insn_list **);
extern int loc_mentioned_in_p (rtx *, const_rtx); extern int loc_mentioned_in_p (rtx *, const_rtx);
extern rtx_insn *find_first_parameter_load (rtx, rtx); extern rtx_insn *find_first_parameter_load (rtx, rtx);
extern bool keep_with_call_p (const_rtx); extern bool keep_with_call_p (const_rtx);
......
...@@ -2243,6 +2243,35 @@ remove_node_from_expr_list (const_rtx node, rtx_expr_list **listp) ...@@ -2243,6 +2243,35 @@ remove_node_from_expr_list (const_rtx node, rtx_expr_list **listp)
temp = temp->next (); temp = temp->next ();
} }
} }
/* Search LISTP (an INSN_LIST) for an entry whose first operand is NODE and
remove that entry from the list if it is found.
A simple equality test is used to determine if NODE matches. */
void
remove_node_from_insn_list (const rtx_insn *node, rtx_insn_list **listp)
{
rtx_insn_list *temp = *listp;
rtx prev = NULL;
while (temp)
{
if (node == temp->insn ())
{
/* Splice the node out of the list. */
if (prev)
XEXP (prev, 1) = temp->next ();
else
*listp = temp->next ();
return;
}
prev = temp;
temp = temp->next ();
}
}
/* Nonzero if X contains any volatile instructions. These are instructions /* Nonzero if X contains any volatile instructions. These are instructions
which may cause unpredictable machine state instructions, and thus no which may cause unpredictable machine state instructions, and thus no
......
...@@ -187,7 +187,7 @@ expand_label (tree label) ...@@ -187,7 +187,7 @@ expand_label (tree label)
{ {
expand_builtin_setjmp_receiver (NULL); expand_builtin_setjmp_receiver (NULL);
nonlocal_goto_handler_labels nonlocal_goto_handler_labels
= gen_rtx_EXPR_LIST (VOIDmode, label_r, = gen_rtx_INSN_LIST (VOIDmode, label_r,
nonlocal_goto_handler_labels); nonlocal_goto_handler_labels);
} }
......
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