Commit e429a50b by David Malcolm Committed by David Malcolm

final.c: Use rtx_sequence

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

	* final.c (get_attr_length_1): Replace GET_CODE check with a
	dyn_cast, introducing local "seq" and the use of methods of
	rtx_sequence.
	(shorten_branches): Likewise, introducing local "body_seq".
	Strengthen local "inner_insn" from rtx to rtx_insn *.
	(reemit_insn_block_notes): Replace GET_CODE check with a
	dyn_cast, strengthening local "body" from rtx to rtx_sequence *.
	Use methods of rtx_sequence.
	(final_scan_insn): Likewise, introducing local "seq" for when
	"body" is known to be a SEQUENCE, using its methods.

From-SVN: r214594
parent 2a62e439
2014-08-27 David Malcolm <dmalcolm@redhat.com> 2014-08-27 David Malcolm <dmalcolm@redhat.com>
* final.c (get_attr_length_1): Replace GET_CODE check with a
dyn_cast, introducing local "seq" and the use of methods of
rtx_sequence.
(shorten_branches): Likewise, introducing local "body_seq".
Strengthen local "inner_insn" from rtx to rtx_insn *.
(reemit_insn_block_notes): Replace GET_CODE check with a
dyn_cast, strengthening local "body" from rtx to rtx_sequence *.
Use methods of rtx_sequence.
(final_scan_insn): Likewise, introducing local "seq" for when
"body" is known to be a SEQUENCE, using its methods.
2014-08-27 David Malcolm <dmalcolm@redhat.com>
* except.c (can_throw_external): Strengthen local "seq" from rtx * except.c (can_throw_external): Strengthen local "seq" from rtx
to rtx_sequence *. Use methods of rtx_sequence. to rtx_sequence *. Use methods of rtx_sequence.
(insn_nothrow_p): Likewise. (insn_nothrow_p): Likewise.
......
...@@ -407,9 +407,9 @@ get_attr_length_1 (rtx uncast_insn, int (*fallback_fn) (rtx)) ...@@ -407,9 +407,9 @@ get_attr_length_1 (rtx uncast_insn, int (*fallback_fn) (rtx))
else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0) else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
length = asm_insn_count (body) * fallback_fn (insn); length = asm_insn_count (body) * fallback_fn (insn);
else if (GET_CODE (body) == SEQUENCE) else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
for (i = 0; i < XVECLEN (body, 0); i++) for (i = 0; i < seq->len (); i++)
length += get_attr_length_1 (XVECEXP (body, 0, i), fallback_fn); length += get_attr_length_1 (seq->insn (i), fallback_fn);
else else
length = fallback_fn (insn); length = fallback_fn (insn);
break; break;
...@@ -1149,12 +1149,12 @@ shorten_branches (rtx_insn *first) ...@@ -1149,12 +1149,12 @@ shorten_branches (rtx_insn *first)
} }
else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0) else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn); insn_lengths[uid] = asm_insn_count (body) * insn_default_length (insn);
else if (GET_CODE (body) == SEQUENCE) else if (rtx_sequence *body_seq = dyn_cast <rtx_sequence *> (body))
{ {
int i; int i;
int const_delay_slots; int const_delay_slots;
#ifdef DELAY_SLOTS #ifdef DELAY_SLOTS
const_delay_slots = const_num_delay_slots (XVECEXP (body, 0, 0)); const_delay_slots = const_num_delay_slots (body_seq->insn (0));
#else #else
const_delay_slots = 0; const_delay_slots = 0;
#endif #endif
...@@ -1163,14 +1163,14 @@ shorten_branches (rtx_insn *first) ...@@ -1163,14 +1163,14 @@ shorten_branches (rtx_insn *first)
/* Inside a delay slot sequence, we do not do any branch shortening /* Inside a delay slot sequence, we do not do any branch shortening
if the shortening could change the number of delay slots if the shortening could change the number of delay slots
of the branch. */ of the branch. */
for (i = 0; i < XVECLEN (body, 0); i++) for (i = 0; i < body_seq->len (); i++)
{ {
rtx inner_insn = XVECEXP (body, 0, i); rtx_insn *inner_insn = body_seq->insn (i);
int inner_uid = INSN_UID (inner_insn); int inner_uid = INSN_UID (inner_insn);
int inner_length; int inner_length;
if (GET_CODE (body) == ASM_INPUT if (GET_CODE (body) == ASM_INPUT
|| asm_noperands (PATTERN (XVECEXP (body, 0, i))) >= 0) || asm_noperands (PATTERN (inner_insn)) >= 0)
inner_length = (asm_insn_count (PATTERN (inner_insn)) inner_length = (asm_insn_count (PATTERN (inner_insn))
* insn_default_length (inner_insn)); * insn_default_length (inner_insn));
else else
...@@ -1685,15 +1685,14 @@ reemit_insn_block_notes (void) ...@@ -1685,15 +1685,14 @@ reemit_insn_block_notes (void)
this_block = insn_scope (insn); this_block = insn_scope (insn);
/* For sequences compute scope resulting from merging all scopes /* For sequences compute scope resulting from merging all scopes
of instructions nested inside. */ of instructions nested inside. */
if (GET_CODE (PATTERN (insn)) == SEQUENCE) if (rtx_sequence *body = dyn_cast <rtx_sequence *> (PATTERN (insn)))
{ {
int i; int i;
rtx body = PATTERN (insn);
this_block = NULL; this_block = NULL;
for (i = 0; i < XVECLEN (body, 0); i++) for (i = 0; i < body->len (); i++)
this_block = choose_inner_scope (this_block, this_block = choose_inner_scope (this_block,
insn_scope (XVECEXP (body, 0, i))); insn_scope (body->insn (i)));
} }
if (! this_block) if (! this_block)
{ {
...@@ -2614,7 +2613,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, ...@@ -2614,7 +2613,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
app_disable (); app_disable ();
if (GET_CODE (body) == SEQUENCE) if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
{ {
/* A delayed-branch sequence */ /* A delayed-branch sequence */
int i; int i;
...@@ -2626,16 +2625,16 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, ...@@ -2626,16 +2625,16 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
thought unnecessary. If that happens, cancel this sequence thought unnecessary. If that happens, cancel this sequence
and cause that insn to be restored. */ and cause that insn to be restored. */
next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, 1, seen); next = final_scan_insn (seq->insn (0), file, 0, 1, seen);
if (next != XVECEXP (body, 0, 1)) if (next != seq->insn (1))
{ {
final_sequence = 0; final_sequence = 0;
return next; return next;
} }
for (i = 1; i < XVECLEN (body, 0); i++) for (i = 1; i < seq->len (); i++)
{ {
rtx insn = XVECEXP (body, 0, i); rtx_insn *insn = seq->insn (i);
rtx_insn *next = NEXT_INSN (insn); rtx_insn *next = NEXT_INSN (insn);
/* We loop in case any instruction in a delay slot gets /* We loop in case any instruction in a delay slot gets
split. */ split. */
...@@ -2653,7 +2652,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED, ...@@ -2653,7 +2652,7 @@ final_scan_insn (rtx uncast_insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
called function. Hence we don't preserve any CC-setting called function. Hence we don't preserve any CC-setting
actions in these insns and the CC must be marked as being actions in these insns and the CC must be marked as being
clobbered by the function. */ clobbered by the function. */
if (CALL_P (XVECEXP (body, 0, 0))) if (CALL_P (seq->insn (0)))
{ {
CC_STATUS_INIT; CC_STATUS_INIT;
} }
......
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