1 /* Generate from machine description:
2 - some macros CODE_FOR_... giving the insn_code_number value
3 for each of the defined standard insn names.
4 Copyright (C) 1987, 1991, 1995, 1998,
5 1999, 2000, 2001 Free Software Foundation, Inc.
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
14 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 You should have received a copy of the GNU General Public License
20 along with GCC; see the file COPYING. If not, write to the Free
21 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
29 #include "gensupport.h"
31 static void gen_insn
PARAMS ((const char *, int));
38 /* Don't mention instructions whose names are the null string
39 or begin with '*'. They are in the machine description just
41 if (name
[0] != 0 && name
[0] != '*')
42 printf (" CODE_FOR_%s = %d,\n", name
, code
);
45 extern int main
PARAMS ((int, char **));
54 progname
= "gencodes";
57 fatal ("No input file name.");
59 if (init_md_reader (argv
[1]) != SUCCESS_EXIT_CODE
)
60 return (FATAL_EXIT_CODE
);
63 /* Generated automatically by the program `gencodes'\n\
64 from the machine description file `md'. */\n\
66 #ifndef GCC_INSN_CODES_H\n\
67 #define GCC_INSN_CODES_H\n\
71 /* Read the machine description. */
78 desc
= read_md_rtx (&line_no
, &insn_code_number
);
82 if (GET_CODE (desc
) == DEFINE_INSN
|| GET_CODE (desc
) == DEFINE_EXPAND
)
83 gen_insn (XSTR (desc
, 0), insn_code_number
);
86 puts ("CODE_FOR_nothing\n\
89 #endif /* GCC_INSN_CODES_H */");
91 if (ferror (stdout
) || fflush (stdout
) || fclose (stdout
))
92 return FATAL_EXIT_CODE
;
94 return SUCCESS_EXIT_CODE
;
97 /* Define this so we can link with print-rtl.o to get debug_rtx function. */
101 int code ATTRIBUTE_UNUSED
;