aboutsummaryrefslogtreecommitdiff
path: root/gcc/gencodes.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gencodes.c')
-rw-r--r--gcc/gencodes.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/gencodes.c b/gcc/gencodes.c
index 3c9bf9c..04d6b45 100644
--- a/gcc/gencodes.c
+++ b/gcc/gencodes.c
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
static int insn_code_number;
static void gen_insn PARAMS ((rtx));
+static int print_md_constant PARAMS ((void **, void *));
static void
gen_insn (insn)
@@ -86,9 +87,11 @@ from the machine description file `md'. */\n\n");
printf (" CODE_FOR_nothing = %d };\n", insn_code_number + 1);
- printf ("\n#define MAX_INSN_CODE ((int) CODE_FOR_nothing)\n");
+ printf ("\n#define MAX_INSN_CODE ((int) CODE_FOR_nothing)\n\n");
- printf ("#endif /* MAX_INSN_CODE */\n");
+ traverse_md_constants (print_md_constant, stdout);
+
+ printf ("\n#endif /* MAX_INSN_CODE */\n");
fflush (stdout);
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
@@ -101,3 +104,17 @@ get_insn_name (code)
{
return NULL;
}
+
+/* Called via traverse_md_constants; emit a #define for
+ the current constant definition. */
+static int
+print_md_constant (slot, info)
+ void **slot;
+ void *info;
+{
+ struct md_constant *def = *slot;
+ FILE *file = info;
+
+ fprintf (file, "#define %s %s\n", def->name, def->value);
+ return 1;
+}