From 1709e4ab8017400a780051534cb7ef668b438221 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 8 Jan 2014 12:21:27 -0500 Subject: [PATCH 094/159] FIXME: use rtx_sequence within final.c --- gcc/final.c | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/gcc/final.c b/gcc/final.c index 0cd8bfa..882e287 100644 --- a/gcc/final.c +++ b/gcc/final.c @@ -404,9 +404,9 @@ get_attr_length_1 (rtx insn, int (*fallback_fn) (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 = body->dyn_cast_rtx_sequence ()) + for (i = 0; i < seq->len (); i++) + length += get_attr_length_1 (seq->element (i), fallback_fn); else length = fallback_fn (insn); break; @@ -1146,12 +1146,12 @@ shorten_branches (rtx first) } 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 = body->dyn_cast_rtx_sequence ()) { 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->element (0)); #else const_delay_slots = 0; #endif @@ -1160,14 +1160,14 @@ shorten_branches (rtx first) /* 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_base_insn inner_insn = body_seq->element_as_an_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 @@ -1685,12 +1685,12 @@ reemit_insn_block_notes (void) if (GET_CODE (PATTERN (insn)) == SEQUENCE) { int i; - rtx body = PATTERN (insn); + rtx_sequence body = PATTERN (insn)->as_an_rtx_sequence (); 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->element (i))); } if (! this_block) { @@ -2620,7 +2620,7 @@ final_scan_insn (rtx_base_insn insn, FILE *file, app_disable (); - if (GET_CODE (body) == SEQUENCE) + if (rtx_sequence seq = body->dyn_cast_rtx_sequence ()) { /* A delayed-branch sequence */ int i; @@ -2633,18 +2633,16 @@ final_scan_insn (rtx_base_insn insn, FILE *file, and cause that insn to be restored. */ next = - final_scan_insn (XVECEXP (body, 0, 0)->as_an_rtx_base_insn (), - file, 0, 1, seen); - if (next != XVECEXP (body, 0, 1)) + final_scan_insn (seq->element_as_an_insn (0), file, 0, 1, seen); + if (next != seq->element (1)) { final_sequence = 0; return next; } - for (i = 1; i < XVECLEN (body, 0); i++) + for (i = 1; i < seq->len (); i++) { - rtx_base_insn insn = - XVECEXP (body, 0, i)->as_an_rtx_base_insn (); + rtx_base_insn insn = seq->element_as_an_insn (i); rtx_base_insn next = NEXT_INSN (insn); /* We loop in case any instruction in a delay slot gets split. */ @@ -2662,7 +2660,7 @@ final_scan_insn (rtx_base_insn insn, FILE *file, 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->element (0))) { CC_STATUS_INIT; } -- 1.7.11.7