Commit 10914065 by Tom Wood

(contains): Return the number of insns.

        (reposition_prologue_and_epilogue_notes): Count all the prologue and
        epilogue insns.

From-SVN: r1814
parent e5ed2155
...@@ -4278,9 +4278,9 @@ record_insns (insns) ...@@ -4278,9 +4278,9 @@ record_insns (insns)
return vec; return vec;
} }
/* Determine whether INSN is in the array of INSN_UIDs VEC. */ /* Determine how many INSN_UIDs in VEC are part of INSN. */
static rtx static int
contains (insn, vec) contains (insn, vec)
rtx insn; rtx insn;
int *vec; int *vec;
...@@ -4290,16 +4290,18 @@ contains (insn, vec) ...@@ -4290,16 +4290,18 @@ contains (insn, vec)
if (GET_CODE (insn) == INSN if (GET_CODE (insn) == INSN
&& GET_CODE (PATTERN (insn)) == SEQUENCE) && GET_CODE (PATTERN (insn)) == SEQUENCE)
{ {
int count = 0;
for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--) for (i = XVECLEN (PATTERN (insn), 0) - 1; i >= 0; i--)
for (j = 0; vec[j]; j++) for (j = 0; vec[j]; j++)
if (INSN_UID (XVECEXP (PATTERN (insn), 0, i)) == vec[j]) if (INSN_UID (XVECEXP (PATTERN (insn), 0, i)) == vec[j])
return XVECEXP (PATTERN (insn), 0, i); count++;
return count;
} }
else else
{ {
for (j = 0; vec[j]; j++) for (j = 0; vec[j]; j++)
if (INSN_UID (insn) == vec[j]) if (INSN_UID (insn) == vec[j])
return insn; return 1;
} }
return 0; return 0;
} }
...@@ -4411,7 +4413,7 @@ reposition_prologue_and_epilogue_notes (f) ...@@ -4411,7 +4413,7 @@ reposition_prologue_and_epilogue_notes (f)
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END) if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_PROLOGUE_END)
note = insn; note = insn;
} }
else if (contains (insn, prologue) && --len == 0) else if ((len -= contains (insn, prologue)) == 0)
{ {
/* Find the prologue-end note if we haven't already, and /* Find the prologue-end note if we haven't already, and
move it to just after the last prologue insn. */ move it to just after the last prologue insn. */
...@@ -4446,7 +4448,7 @@ reposition_prologue_and_epilogue_notes (f) ...@@ -4446,7 +4448,7 @@ reposition_prologue_and_epilogue_notes (f)
if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG) if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EPILOGUE_BEG)
note = insn; note = insn;
} }
else if (contains (insn, epilogue) && --len == 0) else if ((len -= contains (insn, epilogue)) == 0)
{ {
/* Find the epilogue-begin note if we haven't already, and /* Find the epilogue-begin note if we haven't already, and
move it to just before the first epilogue insn. */ move it to just before the first epilogue insn. */
......
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