summaryrefslogtreecommitdiff
path: root/gcc/genconfig.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-27 20:23:15 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-27 20:23:15 +0000
commit3e9f123748453342eae2fa9a1bcf63730429b38d (patch)
tree2a3db5cb69837af35662b42fa3a1b95b877158ed /gcc/genconfig.c
parent5496faf1f5e781229d4ea5cfb2d3a9295845f661 (diff)
downloadgcc-3e9f123748453342eae2fa9a1bcf63730429b38d.tar.gz
* Makefile.in (recog.o): Don't depend on resource.h.
* recog.c: Don't include resource.h. (recog_last_allowed_insn): Remove. (recog_next_insn): Remove. (struct peep2_insn_data): New. (peep2_insn_data, peep2_current): New. (peep2_next_insn): New. (peep2_regno_dead_p, peep2_reg_dead_p): New. (peep2_find_free_register): New. (peephole2_optimize): Track life information by insn as we go. * recog.h: Update declarations. * resource.c (find_free_register, reg_dead_p): Remove. * resource.h: Remove their declarations. * toplev.c: Include hard-reg-set.h before recog.h. * genconfig.c (max_insns_per_peep2): New. (gen_peephole2): New. (main): Call it. * genemit.c (output_peephole2_scratches): Generate calls to peep2_find_free_register; adjust surrounding code. (main): Have insn-emit.c include hard-reg-set.h before recog.h. * genrecog.c (change_state): Don't track last_insn. (write_action): Write into *_pmatch_len before accepting. (write_tree): Adjust peephole2_insns and subroutines to match. * config/i386/i386.md (all peepholes): Use peep2_regno_dead_p. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34208 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genconfig.c')
-rw-r--r--gcc/genconfig.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/gcc/genconfig.c b/gcc/genconfig.c
index 6508c39d906..e7964aba680 100644
--- a/gcc/genconfig.c
+++ b/gcc/genconfig.c
@@ -42,6 +42,9 @@ static int have_peephole2_flag;
/* Maximum number of insns seen in a split. */
static int max_insns_per_split = 1;
+/* Maximum number of input insns for peephole2. */
+static int max_insns_per_peep2;
+
static int clobbers_seen_this_insn;
static int dup_operands_seen_this_insn;
@@ -239,6 +242,26 @@ gen_peephole (peep)
walk_insn_part (XVECEXP (peep, 0, i), 1, 0);
}
+static void
+gen_peephole2 (peep)
+ rtx peep;
+{
+ int i, n;
+
+ /* Look through the patterns that are matched
+ to compute the maximum operand number. */
+ for (i = XVECLEN (peep, 0) - 1; i >= 0; --i)
+ walk_insn_part (XVECEXP (peep, 0, i), 1, 0);
+
+ /* Look at the number of insns this insn can be matched from. */
+ for (i = XVECLEN (peep, 0) - 1, n = 0; i >= 0; --i)
+ if (GET_CODE (XVECEXP (peep, 0, i)) != MATCH_DUP
+ && GET_CODE (XVECEXP (peep, 0, i)) != MATCH_SCRATCH)
+ n++;
+ if (n > max_insns_per_peep2)
+ max_insns_per_peep2 = n;
+}
+
extern int main PARAMS ((int, char **));
int
@@ -289,7 +312,7 @@ from the machine description file `md'. */\n\n");
case DEFINE_PEEPHOLE2:
have_peephole2_flag = 1;
- gen_split (desc);
+ gen_peephole2 (desc);
break;
case DEFINE_PEEPHOLE:
@@ -302,9 +325,8 @@ from the machine description file `md'. */\n\n");
}
}
- printf ("\n#define MAX_RECOG_OPERANDS %d\n", max_recog_operands + 1);
-
- printf ("\n#define MAX_DUP_OPERANDS %d\n", max_dup_operands);
+ printf ("#define MAX_RECOG_OPERANDS %d\n", max_recog_operands + 1);
+ printf ("#define MAX_DUP_OPERANDS %d\n", max_dup_operands);
/* This is conditionally defined, in case the user writes code which emits
more splits than we can readily see (and knows s/he does it). */
@@ -328,7 +350,10 @@ from the machine description file `md'. */\n\n");
printf ("#define HAVE_peephole 1\n");
if (have_peephole2_flag)
- printf ("#define HAVE_peephole2 1\n");
+ {
+ printf ("#define HAVE_peephole2 1\n");
+ printf ("#define MAX_INSNS_PER_PEEP2 %d\n", max_insns_per_peep2);
+ }
fflush (stdout);
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);