diff options
author | Paul Brook <paul@codesourcery.com> | 2005-08-27 02:08:29 +0000 |
---|---|---|
committer | Paul Brook <pbrook@gcc.gnu.org> | 2005-08-27 02:08:29 +0000 |
commit | 0cd6c85a310f2e2a597a0ee4ef03173806d766f5 (patch) | |
tree | 3a2df6c503cb4c254dadef63be62a4db37318490 /gcc/recog.c | |
parent | e0af6cb7203510afbdabbe4aee515d616e8a0bda (diff) | |
download | gcc-0cd6c85a310f2e2a597a0ee4ef03173806d766f5.zip gcc-0cd6c85a310f2e2a597a0ee4ef03173806d766f5.tar.gz gcc-0cd6c85a310f2e2a597a0ee4ef03173806d766f5.tar.bz2 |
genrecog.c (enum decision_type): Add DT_num_insns.
2005-08-27 Paul Brook <paul@codesourcery.com>
* genrecog.c (enum decision_type): Add DT_num_insns.
(struct decision_test): Add u.num_insns.
(add_to_sequence): Add DT_num_insns test.
(maybe_both_true_2, nodes_identical_1): Handle DT_num_insns.
(write_cond, debug_decision_2): Ditto.
(change_state): Assume peep2_next_insn never fails.
Remove "afterward" argument.
(write afterward, write_tree): Update to match.
* recog.c (peep2_current_count): New variable.
(peep2_next_insn): Check it.
(peephole2_optimize): Set peep2_current_count.
* recog.h (peep2_current_count): Declare.
From-SVN: r103553
Diffstat (limited to 'gcc/recog.c')
-rw-r--r-- | gcc/recog.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/recog.c b/gcc/recog.c index 23012dc..1b8394c 100644 --- a/gcc/recog.c +++ b/gcc/recog.c @@ -2853,6 +2853,8 @@ struct peep2_insn_data static struct peep2_insn_data peep2_insn_data[MAX_INSNS_PER_PEEP2 + 1]; static int peep2_current; +/* The number of instructions available to match a peep2. */ +int peep2_current_count; /* A non-insn marker indicating the last insn of the block. The live_before regset for this element is correct, indicating @@ -2866,14 +2868,12 @@ static int peep2_current; rtx peep2_next_insn (int n) { - gcc_assert (n < MAX_INSNS_PER_PEEP2 + 1); + gcc_assert (n <= peep2_current_count); n += peep2_current; if (n >= MAX_INSNS_PER_PEEP2 + 1) n -= MAX_INSNS_PER_PEEP2 + 1; - if (peep2_insn_data[n].insn == PEEP2_EOB) - return NULL_RTX; return peep2_insn_data[n].insn; } @@ -3062,6 +3062,7 @@ peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) /* Indicate that all slots except the last holds invalid data. */ for (i = 0; i < MAX_INSNS_PER_PEEP2; ++i) peep2_insn_data[i].insn = NULL_RTX; + peep2_current_count = 0; /* Indicate that the last slot contains live_after data. */ peep2_insn_data[MAX_INSNS_PER_PEEP2].insn = PEEP2_EOB; @@ -3090,6 +3091,8 @@ peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) /* Record this insn. */ if (--peep2_current < 0) peep2_current = MAX_INSNS_PER_PEEP2; + if (peep2_current_count < MAX_INSNS_PER_PEEP2) + peep2_current_count++; peep2_insn_data[peep2_current].insn = insn; propagate_one_insn (pbi, insn); COPY_REG_SET (peep2_insn_data[peep2_current].live_before, live); @@ -3234,6 +3237,7 @@ peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) for (i = 0; i < MAX_INSNS_PER_PEEP2 + 1; ++i) peep2_insn_data[i].insn = NULL_RTX; peep2_insn_data[peep2_current].insn = PEEP2_EOB; + peep2_current_count = 0; #else /* Back up lifetime information past the end of the newly created sequence. */ @@ -3249,6 +3253,8 @@ peephole2_optimize (FILE *dump_file ATTRIBUTE_UNUSED) { if (--i < 0) i = MAX_INSNS_PER_PEEP2; + if (peep2_current_count < MAX_INSNS_PER_PEEP2) + peep2_current_count++; peep2_insn_data[i].insn = x; propagate_one_insn (pbi, x); COPY_REG_SET (peep2_insn_data[i].live_before, live); |