|
|
1.1 ! root 1: /* Generate from machine description: ! 2: ! 3: - some flags HAVE_... saying which simple standard instructions are ! 4: available for this machine. ! 5: Copyright (C) 1987 Free Software Foundation, Inc. ! 6: ! 7: This file is part of GNU CC. ! 8: ! 9: GNU CC is distributed in the hope that it will be useful, ! 10: but WITHOUT ANY WARRANTY. No author or distributor ! 11: accepts responsibility to anyone for the consequences of using it ! 12: or for whether it serves any particular purpose or works at all, ! 13: unless he says so in writing. Refer to the GNU CC General Public ! 14: License for full details. ! 15: ! 16: Everyone is granted permission to copy, modify and redistribute ! 17: GNU CC, but only under the conditions described in the ! 18: GNU CC General Public License. A copy of this license is ! 19: supposed to have been given to you along with GNU CC so you ! 20: can know your rights and responsibilities. It should be in a ! 21: file named COPYING. Among other things, the copyright notice ! 22: and this notice must be preserved on all copies. */ ! 23: ! 24: ! 25: #include <stdio.h> ! 26: #include "config.h" ! 27: #include "rtl.h" ! 28: #include "obstack.h" ! 29: ! 30: struct obstack obstack; ! 31: struct obstack *rtl_obstack = &obstack; ! 32: ! 33: #define obstack_chunk_alloc xmalloc ! 34: #define obstack_chunk_free free ! 35: extern int xmalloc (); ! 36: extern void free (); ! 37: ! 38: void fatal (); ! 39: ! 40: void ! 41: gen_insn (insn) ! 42: rtx insn; ! 43: { ! 44: /* Don't mention instructions whose names are the null string. ! 45: They are in the machine description just to be recognized. */ ! 46: if (strlen (XSTR (insn, 0)) == 0) ! 47: return; ! 48: ! 49: printf ("#define HAVE_%s %s\n", XSTR (insn, 0), ! 50: strlen (XSTR (insn, 2)) ? XSTR (insn, 2) : "1"); ! 51: printf ("extern rtx gen_%s ();\n", XSTR (insn, 0)); ! 52: } ! 53: ! 54: int ! 55: xmalloc (size) ! 56: { ! 57: register int val = malloc (size); ! 58: ! 59: if (val == 0) ! 60: fatal ("virtual memory exhausted"); ! 61: ! 62: return val; ! 63: } ! 64: ! 65: int ! 66: xrealloc (ptr, size) ! 67: char *ptr; ! 68: int size; ! 69: { ! 70: int result = realloc (ptr, size); ! 71: if (!result) ! 72: fatal ("virtual memory exhausted"); ! 73: return result; ! 74: } ! 75: ! 76: void ! 77: fatal (s, a1, a2) ! 78: { ! 79: fprintf (stderr, "genflags: "); ! 80: fprintf (stderr, s, a1, a2); ! 81: fprintf (stderr, "\n"); ! 82: exit (FATAL_EXIT_CODE); ! 83: } ! 84: ! 85: int ! 86: main (argc, argv) ! 87: int argc; ! 88: char **argv; ! 89: { ! 90: rtx desc; ! 91: FILE *infile; ! 92: extern rtx read_rtx (); ! 93: register int c; ! 94: ! 95: obstack_init (rtl_obstack); ! 96: ! 97: if (argc <= 1) ! 98: fatal ("No input file name."); ! 99: ! 100: infile = fopen (argv[1], "r"); ! 101: if (infile == 0) ! 102: { ! 103: perror (argv[1]); ! 104: exit (FATAL_EXIT_CODE); ! 105: } ! 106: ! 107: init_rtl (); ! 108: ! 109: printf ("/* Generated automatically by the program `genflags'\n\ ! 110: from the machine description file `md'. */\n\n"); ! 111: ! 112: /* Read the machine description. */ ! 113: ! 114: while (1) ! 115: { ! 116: c = read_skip_spaces (infile); ! 117: if (c == EOF) ! 118: break; ! 119: ungetc (c, infile); ! 120: ! 121: desc = read_rtx (infile); ! 122: if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND) ! 123: gen_insn (desc); ! 124: } ! 125: ! 126: fflush (stdout); ! 127: exit (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE); ! 128: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.