aboutsummaryrefslogtreecommitdiff
path: root/gcc/genpeep.c
diff options
context:
space:
mode:
authorSteven Bosscher <steven@gcc.gnu.org>2012-07-09 08:45:12 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2012-07-09 08:45:12 +0000
commite714561a2fab73a2592aed0418a00b0c906c0711 (patch)
tree8171a7fe230372ff8186c6f2b999f0d7b358565c /gcc/genpeep.c
parent701649fa8939e9a3b6328afc9fca2abe4b55c312 (diff)
downloadgcc-e714561a2fab73a2592aed0418a00b0c906c0711.zip
gcc-e714561a2fab73a2592aed0418a00b0c906c0711.tar.gz
gcc-e714561a2fab73a2592aed0418a00b0c906c0711.tar.bz2
gensupport.c (init_rtx_reader_args_cb): Start counting code generating patterns from 1 to free up 0 for CODE_FOR_nothing.
* gensupport.c (init_rtx_reader_args_cb): Start counting code generating patterns from 1 to free up 0 for CODE_FOR_nothing. * gencodes.c (main): Give CODE_FOR_nothing the value 0. Add the LAST_INSN_CODE marker at the end. * genoutput.c (nothing): New static struct data. (idata): Initialize to &nothing. (idata_end): Initialize to &nothing.next. (init_insn_for_nothing): New function to create dummy 'nothing' insn. (main): Use it. * genpeep.c (insn_code_number): Remove global variable. (gen_peephole): Take it as an argument instead. (main): Take insn_code_number from read_md_rtx. * optabs.h: Revert r161809: (optab_handlers): Change type of insn_code back to insn_code. (optab_handler, widening_optab_handler, set_optab_handler, set_widening_optab_handler, convert_optab_handler, set_convert_optab_handler, direct_optab_handler, set_direct_optab_handler): Remove int casts. Revert to treating the insn_code field as "insn_code". From-SVN: r189366
Diffstat (limited to 'gcc/genpeep.c')
-rw-r--r--gcc/genpeep.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/gcc/genpeep.c b/gcc/genpeep.c
index a6f1033..dfbf037 100644
--- a/gcc/genpeep.c
+++ b/gcc/genpeep.c
@@ -1,6 +1,6 @@
/* Generate code from machine description to perform peephole optimizations.
Copyright (C) 1987, 1989, 1992, 1997, 1998, 1999, 2000, 2003, 2004,
- 2007, 2010 Free Software Foundation, Inc.
+ 2007, 2010, 2012 Free Software Foundation, Inc.
This file is part of GCC.
@@ -47,18 +47,13 @@ static int max_opno;
static int n_operands;
-/* Peephole optimizations get insn codes just like insn patterns.
- Count them so we know the code of the define_peephole we are handling. */
-
-static int insn_code_number = 0;
-
-static void gen_peephole (rtx);
+static void gen_peephole (rtx, int);
static void match_rtx (rtx, struct link *, int);
static void print_path (struct link *);
static void print_code (RTX_CODE);
static void
-gen_peephole (rtx peep)
+gen_peephole (rtx peep, int insn_code_number)
{
int ninsns = XVECLEN (peep, 0);
int i;
@@ -392,24 +387,15 @@ from the machine description file `md'. */\n\n");
while (1)
{
- int line_no, rtx_number = 0;
+ int line_no;
+ int insn_code_number;
- desc = read_md_rtx (&line_no, &rtx_number);
+ desc = read_md_rtx (&line_no, &insn_code_number);
if (desc == NULL)
break;
- if (GET_CODE (desc) == DEFINE_PEEPHOLE)
- {
- gen_peephole (desc);
- insn_code_number++;
- }
- if (GET_CODE (desc) == DEFINE_INSN
- || GET_CODE (desc) == DEFINE_EXPAND
- || GET_CODE (desc) == DEFINE_SPLIT
- || GET_CODE (desc) == DEFINE_PEEPHOLE2)
- {
- insn_code_number++;
- }
+ if (GET_CODE (desc) == DEFINE_PEEPHOLE)
+ gen_peephole (desc, insn_code_number);
}
printf (" return 0;\n}\n\n");