diff options
author | obrien <obrien@FreeBSD.org> | 1999-08-26 09:30:50 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-08-26 09:30:50 +0000 |
commit | 0bedf4fb30066e5e1d4342a1d3914dae7d37cba7 (patch) | |
tree | 68d8110b41afd0ebbf39167b1a4918eea667a7c5 /contrib/gcc/genopinit.c | |
parent | d4db5fb866b7ad5216abd5047774a3973b9901a9 (diff) | |
download | FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.zip FreeBSD-src-0bedf4fb30066e5e1d4342a1d3914dae7d37cba7.tar.gz |
Virgin import of gcc from EGCS 1.1.2
Diffstat (limited to 'contrib/gcc/genopinit.c')
-rw-r--r-- | contrib/gcc/genopinit.c | 59 |
1 files changed, 37 insertions, 22 deletions
diff --git a/contrib/gcc/genopinit.c b/contrib/gcc/genopinit.c index 3939126..a31a444 100644 --- a/contrib/gcc/genopinit.c +++ b/contrib/gcc/genopinit.c @@ -1,5 +1,5 @@ /* Generate code to initialize optabs from machine description. - Copyright (C) 1993, 1994 Free Software Foundation, Inc. + Copyright (C) 1993, 94-97, 1998 Free Software Foundation, Inc. This file is part of GNU CC. @@ -19,11 +19,15 @@ the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <stdio.h> #include "hconfig.h" +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif +#include "system.h" #include "rtl.h" #include "obstack.h" -#include <ctype.h> static struct obstack obstack; struct obstack *rtl_obstack = &obstack; @@ -31,12 +35,9 @@ struct obstack *rtl_obstack = &obstack; #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free -extern void free (); -extern rtx read_rtx (); - -char *xmalloc (); -static void fatal (); -void fancy_abort (); +char *xmalloc PROTO((unsigned)); +static void fatal PVPROTO ((char *, ...)) ATTRIBUTE_PRINTF_1; +void fancy_abort PROTO((void)); /* Many parts of GCC use arrays that are indexed by machine mode and contain the insn codes for pattern in the MD file that perform a given @@ -122,21 +123,23 @@ char *optabs[] = "movcc_gen_code[(int) %A] = CODE_FOR_%(mov%acc%)", "reload_in_optab[(int) %A] = CODE_FOR_%(reload_in%a%)", "reload_out_optab[(int) %A] = CODE_FOR_%(reload_out%a%)", - "movstr_optab[(int) %A] = CODE_FOR_%(movstr%a%)" }; + "movstr_optab[(int) %A] = CODE_FOR_%(movstr%a%)", + "clrstr_optab[(int) %A] = CODE_FOR_%(clrstr%a%)" }; /* Allow linking with print-rtl.c. */ char **insn_name_ptr; +static void gen_insn PROTO((rtx)); + static void gen_insn (insn) rtx insn; { char *name = XSTR (insn, 0); int m1, m2, op; - int pindex; + size_t pindex; int i; char *np, *pp, *p, *q; - struct obstack *obstack_ptr; /* Don't mention instructions whose names are the null string. They are in the machine description just to be recognized. */ @@ -184,9 +187,7 @@ gen_insn (insn) /* We have to be concerned about matching "gt" and missing "gtu", e.g., so verify we have reached the - end of thing we are to match. We do not have this - problem with modes since no mode is a prefix of - another. */ + end of thing we are to match. */ if (*p == 0 && *q == 0 && rtx_class[op] == '<') break; } @@ -198,7 +199,11 @@ gen_insn (insn) break; case 'a': case 'b': - for (i = 0; i < (int) MAX_MACHINE_MODE; i++) + /* This loop will stop at the first prefix match, so + look through the modes in reverse order, in case + EXTRA_CC_MODES was used and CC is a prefix of the + CC modes (as it should be). */ + for (i = ((int) MAX_MACHINE_MODE) - 1; i >= 0; i--) { for (p = mode_name[i], q = np; *p; p++, q++) if (tolower (*p) != *q) @@ -210,7 +215,7 @@ gen_insn (insn) break; } - if (i == (int) MAX_MACHINE_MODE) + if (i < 0) matches = 0; else if (*pp == 'a') m1 = i, np += strlen (mode_name[i]); @@ -304,11 +309,22 @@ xrealloc (ptr, size) } static void -fatal (s, a1, a2) - char *s; +fatal VPROTO ((char *format, ...)) { +#ifndef __STDC__ + char *format; +#endif + va_list ap; + + VA_START (ap, format); + +#ifndef __STDC__ + format = va_arg (ap, char *); +#endif + fprintf (stderr, "genopinit: "); - fprintf (stderr, s, a1, a2); + vfprintf (stderr, format, ap); + va_end (ap); fprintf (stderr, "\n"); exit (FATAL_EXIT_CODE); } @@ -328,8 +344,6 @@ main (argc, argv) char **argv; { rtx desc; - rtx dummy; - rtx *insn_ptr; FILE *infile; register int c; @@ -351,6 +365,7 @@ main (argc, argv) from the machine description file `md'. */\n\n"); printf ("#include \"config.h\"\n"); + printf ("#include \"system.h\"\n"); printf ("#include \"rtl.h\"\n"); printf ("#include \"flags.h\"\n"); printf ("#include \"insn-flags.h\"\n"); |