diff options
author | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-22 01:22:02 +0000 |
---|---|---|
committer | amylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-11-22 01:22:02 +0000 |
commit | 4333d9215b332c58eebc4e4b8e143f24fa2f29a1 (patch) | |
tree | 2c6657d3d97f9c62e1acbc3a2c7ea186a70e237e /gcc/gencodes.c | |
parent | 2267ca842b3577b3bd9ffdb2acfdff5e1498b39e (diff) | |
download | gcc-4333d9215b332c58eebc4e4b8e143f24fa2f29a1.tar.gz |
* rtl.h (traverse_md_constants): Declare.
(struct md_constant): Define.
* Makefile.in (HOST_RTL): Add hashtab.o .
(OBJS): Add hashtab.o .
(hashtab.o): New rule.
(rtl.o): Depends on HASHTAB_H.
* rtl.c (hashtab.h): #include.
(md_constants): New static variable.
(def_hash, def_name_eq_p, read_constants): New static functions.
(traverse_md_constants): New function.
(read_name): Do constant expansion.
(read_rtx): Recognize define_constants.
* gencodes.c (print_md_constant): New function.
(main): Emit #defines for all constant definitions encountered.
* md.texi (Constant Definitions): New node.
* gensupport.c (xcalloc): New function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37635 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gencodes.c')
-rw-r--r-- | gcc/gencodes.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/gencodes.c b/gcc/gencodes.c index 3c9bf9cc20c..04d6b45961c 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; +} |