+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
else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
length = asm_insn_count (body) * fallback_fn (insn);
- else if (GET_CODE (body) == SEQUENCE)
- for (i = 0; i < XVECLEN (body, 0); i++)
- length += get_attr_length_1 (XVECEXP (body, 0, i), fallback_fn);
+ else if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
+ for (i = 0; i < seq->len (); i++)
+ length += get_attr_length_1 (seq->insn (i), fallback_fn);
else
length = fallback_fn (insn);
break;
}
else if (GET_CODE (body) == ASM_INPUT || asm_noperands (body) >= 0)
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 const_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
const_delay_slots = 0;
#endif
/* Inside a delay slot sequence, we do not do any branch shortening
if the shortening could change the number of delay slots
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_length;
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))
* insn_default_length (inner_insn));
else
this_block = insn_scope (insn);
/* For sequences compute scope resulting from merging all scopes
of instructions nested inside. */
- if (GET_CODE (PATTERN (insn)) == SEQUENCE)
+ if (rtx_sequence *body = dyn_cast <rtx_sequence *> (PATTERN (insn)))
{
int i;
- rtx body = PATTERN (insn);
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,
- insn_scope (XVECEXP (body, 0, i)));
+ insn_scope (body->insn (i)));
}
if (! this_block)
{
app_disable ();
- if (GET_CODE (body) == SEQUENCE)
+ if (rtx_sequence *seq = dyn_cast <rtx_sequence *> (body))
{
/* A delayed-branch sequence */
int i;
thought unnecessary. If that happens, cancel this sequence
and cause that insn to be restored. */
- next = final_scan_insn (XVECEXP (body, 0, 0), file, 0, 1, seen);
- if (next != XVECEXP (body, 0, 1))
+ next = final_scan_insn (seq->insn (0), file, 0, 1, seen);
+ if (next != seq->insn (1))
{
final_sequence = 0;
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);
/* We loop in case any instruction in a delay slot gets
split. */
called function. Hence we don't preserve any CC-setting
actions in these insns and the CC must be marked as being
clobbered by the function. */
- if (CALL_P (XVECEXP (body, 0, 0)))
+ if (CALL_P (seq->insn (0)))
{
CC_STATUS_INIT;
}