00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #include "hconfig.h"
00030 #include "system.h"
00031 #include "rtl.h"
00032 #include "errors.h"
00033 #include "gensupport.h"
00034
00035 static int print_md_constant PARAMS ((void **, void *));
00036 extern int main PARAMS ((int, char **));
00037
00038
00039
00040
00041 static int
00042 print_md_constant (slot, info)
00043 void **slot;
00044 void *info;
00045 {
00046 struct md_constant *def = *slot;
00047 FILE *file = info;
00048
00049 fprintf (file, "#define %s %s\n", def->name, def->value);
00050 return 1;
00051 }
00052
00053 int
00054 main (argc, argv)
00055 int argc;
00056 char **argv;
00057 {
00058 int dummy1, dummy2;
00059 rtx desc;
00060
00061 progname = "genconstants";
00062
00063 if (argc <= 1)
00064 fatal ("no input file name");
00065
00066 if (init_md_reader (argv[1]) != SUCCESS_EXIT_CODE)
00067 return (FATAL_EXIT_CODE);
00068
00069
00070
00071 do
00072 desc = read_md_rtx (&dummy1, &dummy2);
00073 while (desc);
00074
00075 puts ("/* Generated automatically by the program `genconstants'");
00076 puts (" from the machine description file `md'. */\n");
00077 puts ("#ifndef GCC_INSN_CONSTANTS_H");
00078 puts ("#define GCC_INSN_CONSTANTS_H\n");
00079
00080 traverse_md_constants (print_md_constant, stdout);
00081
00082 puts ("\n#endif /* GCC_INSN_CONSTANTS_H */");
00083
00084 if (ferror (stdout) || fflush (stdout) || fclose (stdout))
00085 return FATAL_EXIT_CODE;
00086
00087 return SUCCESS_EXIT_CODE;
00088 }
00089