Mercurial > hg > CbC > GCC_original
comparison gcc/genconstants.c @ 16:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | f6334be47118 |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
15:561a7518be6b | 16:04ced10e8804 |
---|---|
1 /* Generate from machine description: | 1 /* Generate from machine description: |
2 a series of #define statements, one for each constant named in | 2 a series of #define statements, one for each constant named in |
3 a (define_constants ...) pattern. | 3 a (define_constants ...) pattern. |
4 | 4 |
5 Copyright (C) 1987, 1991, 1995, 1998, 1999, 2000, 2001, 2003, 2004, | 5 Copyright (C) 1987-2017 Free Software Foundation, Inc. |
6 2007, 2010 Free Software Foundation, Inc. | |
7 | 6 |
8 This file is part of GCC. | 7 This file is part of GCC. |
9 | 8 |
10 GCC is free software; you can redistribute it and/or modify | 9 GCC is free software; you can redistribute it and/or modify |
11 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
27 | 26 |
28 #include "bconfig.h" | 27 #include "bconfig.h" |
29 #include "system.h" | 28 #include "system.h" |
30 #include "coretypes.h" | 29 #include "coretypes.h" |
31 #include "errors.h" | 30 #include "errors.h" |
31 #include "statistics.h" | |
32 #include "vec.h" | |
32 #include "read-md.h" | 33 #include "read-md.h" |
33 | 34 |
34 /* Called via traverse_md_constants; emit a #define for | 35 /* Called via traverse_md_constants; emit a #define for |
35 the current constant definition. */ | 36 the current constant definition. */ |
36 | 37 |
74 | 75 |
75 return 1; | 76 return 1; |
76 } | 77 } |
77 | 78 |
78 int | 79 int |
79 main (int argc, char **argv) | 80 main (int argc, const char **argv) |
80 { | 81 { |
81 progname = "genconstants"; | 82 progname = "genconstants"; |
82 | 83 |
83 if (!read_md_files (argc, argv, NULL, NULL)) | 84 noop_reader reader; |
85 if (!reader.read_md_files (argc, argv, NULL)) | |
84 return (FATAL_EXIT_CODE); | 86 return (FATAL_EXIT_CODE); |
85 | 87 |
86 /* Initializing the MD reader has the side effect of loading up | 88 /* Initializing the MD reader has the side effect of loading up |
87 the constants table that we wish to scan. */ | 89 the constants table that we wish to scan. */ |
88 | 90 |
89 puts ("/* Generated automatically by the program `genconstants'"); | 91 puts ("/* Generated automatically by the program `genconstants'"); |
90 puts (" from the machine description file `md'. */\n"); | 92 puts (" from the machine description file `md'. */\n"); |
91 puts ("#ifndef GCC_INSN_CONSTANTS_H"); | 93 puts ("#ifndef GCC_INSN_CONSTANTS_H"); |
92 puts ("#define GCC_INSN_CONSTANTS_H\n"); | 94 puts ("#define GCC_INSN_CONSTANTS_H\n"); |
93 | 95 |
94 traverse_md_constants (print_md_constant, 0); | 96 reader.traverse_md_constants (print_md_constant, 0); |
95 traverse_enum_types (print_enum_type, 0); | 97 reader.traverse_enum_types (print_enum_type, 0); |
96 | 98 |
97 puts ("\n#endif /* GCC_INSN_CONSTANTS_H */"); | 99 puts ("\n#endif /* GCC_INSN_CONSTANTS_H */"); |
98 | 100 |
99 if (ferror (stdout) || fflush (stdout) || fclose (stdout)) | 101 if (ferror (stdout) || fflush (stdout) || fclose (stdout)) |
100 return FATAL_EXIT_CODE; | 102 return FATAL_EXIT_CODE; |