From 8d97c9bffb3a962008d6c4be7986587ce4d1cb94 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Wed, 8 Jan 2014 12:44:58 -0500 Subject: [PATCH 100/159] FIXME: use rtx_sequence within resource.c --- gcc/resource.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/gcc/resource.c b/gcc/resource.c index 4609c3a..c4325a2 100644 --- a/gcc/resource.c +++ b/gcc/resource.c @@ -308,16 +308,16 @@ mark_referenced_resources (rtx x, struct resources *res, However, we may have moved some of the parameter loading insns into the delay slot of this CALL. If so, the USE's for them don't count and should be skipped. */ - rtx insn = PREV_INSN (x); - rtx sequence = 0; + rtx_base_insn insn = PREV_INSN (x); + rtx_sequence sequence = 0; int seq_size = 0; int i; /* If we are part of a delay slot sequence, point at the SEQUENCE. */ if (NEXT_INSN (insn) != x) { - sequence = PATTERN (NEXT_INSN (insn)); - seq_size = XVECLEN (sequence, 0); + sequence = PATTERN (NEXT_INSN (insn))->as_an_rtx_sequence (); + seq_size = sequence->len (); gcc_assert (GET_CODE (sequence) == SEQUENCE); } @@ -356,7 +356,7 @@ mark_referenced_resources (rtx x, struct resources *res, { for (i = 1; i < seq_size; i++) { - rtx slot_pat = PATTERN (XVECEXP (sequence, 0, i)); + rtx slot_pat = PATTERN (sequence->element (i)); if (GET_CODE (slot_pat) == SET && rtx_equal_p (SET_DEST (slot_pat), XEXP (XEXP (link, 0), 0))) @@ -473,13 +473,13 @@ find_dead_or_set_registers (rtx target, struct resources *res, } else if (GET_CODE (PATTERN (insn)) == CLOBBER) continue; - else if (GET_CODE (PATTERN (insn)) == SEQUENCE) + else if (rtx_sequence seq = PATTERN (insn)->dyn_cast_rtx_sequence ()) { /* An unconditional jump can be used to fill the delay slot of a call, so search for a JUMP_INSN in any position. */ - for (i = 0; i < XVECLEN (PATTERN (insn), 0); i++) + for (i = 0; i < seq->len (); i++) { - this_jump_insn = XVECEXP (PATTERN (insn), 0, i); + this_jump_insn = seq->element (i); if (JUMP_P (this_jump_insn)) break; } @@ -536,17 +536,18 @@ find_dead_or_set_registers (rtx target, struct resources *res, if (GET_CODE (PATTERN (insn)) == SEQUENCE && INSN_ANNULLED_BRANCH_P (this_jump_insn)) { - for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++) - INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)) - = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)); + rtx_sequence seq = PATTERN (insn)->as_an_rtx_sequence (); + for (i = 1; i < seq->len (); i++) + INSN_FROM_TARGET_P (seq->element (i)) + = ! INSN_FROM_TARGET_P (seq->element (i)); target_set = set; mark_set_resources (insn, &target_set, 0, MARK_SRC_DEST_CALL); - for (i = 1; i < XVECLEN (PATTERN (insn), 0); i++) - INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)) - = ! INSN_FROM_TARGET_P (XVECEXP (PATTERN (insn), 0, i)); + for (i = 1; i < seq->len (); i++) + INSN_FROM_TARGET_P (seq->element (i)) + = ! INSN_FROM_TARGET_P (seq->element (i)); mark_set_resources (insn, &set, 0, MARK_SRC_DEST_CALL); } @@ -710,13 +711,14 @@ mark_set_resources (rtx x, struct resources *res, int in_dest, case SEQUENCE: { - rtx control = XVECEXP (x, 0, 0); + rtx_sequence seq = x->as_an_rtx_sequence (); + rtx control = seq->element (0); bool annul_p = JUMP_P (control) && INSN_ANNULLED_BRANCH_P (control); mark_set_resources (control, res, 0, mark_type); - for (i = XVECLEN (x, 0) - 1; i >= 0; --i) + for (i = seq->len () - 1; i >= 0; --i) { - rtx elt = XVECEXP (x, 0, i); + rtx elt = seq->element (i); if (!annul_p && INSN_FROM_TARGET_P (elt)) mark_set_resources (elt, res, 0, mark_type); } -- 1.7.11.7