diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-11-22 04:20:49 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-11-22 04:20:49 +0000 |
commit | 4e0bf4c4d00096ac436378edaf7718dafec9ff82 (patch) | |
tree | 9a80850d7051a761dee6c6dd1aed8df337a1f92c /sim/igen/gen-itable.c | |
parent | feaee4bdbb06466822e886f5d1d30b9f1e04d985 (diff) | |
download | gdb-4e0bf4c4d00096ac436378edaf7718dafec9ff82.zip gdb-4e0bf4c4d00096ac436378edaf7718dafec9ff82.tar.gz gdb-4e0bf4c4d00096ac436378edaf7718dafec9ff82.tar.bz2 |
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
Diffstat (limited to 'sim/igen/gen-itable.c')
-rw-r--r-- | sim/igen/gen-itable.c | 89 |
1 files changed, 37 insertions, 52 deletions
diff --git a/sim/igen/gen-itable.c b/sim/igen/gen-itable.c index dea71a2..7b94d37 100644 --- a/sim/igen/gen-itable.c +++ b/sim/igen/gen-itable.c @@ -42,18 +42,18 @@ -typedef struct _itable_info { +typedef struct _itable_info +{ int sizeof_form; int sizeof_name; int sizeof_file; -} itable_info; +} +itable_info; static void itable_h_insn (lf *file, - insn_table *entry, - insn_entry *instruction, - void *data) + insn_table *entry, insn_entry * instruction, void *data) { int len; itable_info *info = data; @@ -62,9 +62,7 @@ itable_h_insn (lf *file, print_function_name (file, instruction->name, instruction->format_name, - NULL, - NULL, - function_name_prefix_itable); + NULL, NULL, function_name_prefix_itable); lf_printf (file, ",\n"); /* update summary info */ len = strlen (instruction->format_name); @@ -82,16 +80,13 @@ itable_h_insn (lf *file, /* print the list of all the different options */ static void -itable_print_enum (lf *file, - filter *set, - char *name) +itable_print_enum (lf *file, filter *set, char *name) { char *elem; lf_printf (file, "typedef enum {\n"); lf_indent (file, +2); for (elem = filter_next (set, ""); - elem != NULL; - elem = filter_next (set, elem)) + elem != NULL; elem = filter_next (set, elem)) { lf_printf (file, "%sitable_%s_%s,\n", options.module.itable.prefix.l, name, elem); @@ -102,8 +97,9 @@ itable_print_enum (lf *file, name, elem, options.module.itable.prefix.l, name, elem); } } - lf_printf (file, "nr_%sitable_%ss,\n", options.module.itable.prefix.l, name); - + lf_printf (file, "nr_%sitable_%ss,\n", options.module.itable.prefix.l, + name); + lf_indent (file, -2); lf_printf (file, "} %sitable_%ss;\n", options.module.itable.prefix.l, name); if (strlen (options.module.itable.prefix.l) > 0) @@ -120,9 +116,7 @@ itable_print_enum (lf *file, /* print an array of the option names as strings */ static void -itable_print_names (lf *file, - filter *set, - char *name) +itable_print_names (lf *file, filter *set, char *name) { char *elem; lf_printf (file, "const char *%sitable_%s_names[nr_%sitable_%ss + 1] = {\n", @@ -130,8 +124,7 @@ itable_print_names (lf *file, options.module.itable.prefix.l, name); lf_indent (file, +2); for (elem = filter_next (set, ""); - elem != NULL; - elem = filter_next (set, elem)) + elem != NULL; elem = filter_next (set, elem)) { lf_printf (file, "\"%s\",\n", elem); } @@ -140,16 +133,16 @@ itable_print_names (lf *file, lf_printf (file, "};\n"); } -extern void -gen_itable_h (lf *file, - insn_table *isa) +extern void +gen_itable_h (lf *file, insn_table *isa) { itable_info *info = ZALLOC (itable_info); /* output an enumerated type for each instruction */ lf_printf (file, "typedef enum {\n"); insn_table_traverse_insn (file, isa, itable_h_insn, info); - lf_printf (file, " nr_%sitable_entries,\n", options.module.itable.prefix.l); + lf_printf (file, " nr_%sitable_entries,\n", + options.module.itable.prefix.l); lf_printf (file, "} %sitable_index;\n", options.module.itable.prefix.l); lf_printf (file, "\n"); @@ -158,7 +151,7 @@ gen_itable_h (lf *file, lf_printf (file, "extern const char *%sitable_flag_names[];\n", options.module.itable.prefix.l); lf_printf (file, "\n"); - + /* output an enumeration of all the possible options */ itable_print_enum (file, isa->options, "option"); lf_printf (file, "extern const char *%sitable_option_names[];\n", @@ -220,9 +213,7 @@ gen_itable_h (lf *file, /****************************************************************/ static void -itable_print_set (lf *file, - filter *set, - filter *members) +itable_print_set (lf *file, filter *set, filter *members) { char *elem; lf_printf (file, "\""); @@ -240,10 +231,9 @@ itable_print_set (lf *file, } lf_printf (file, "\",\n"); - lf_printf(file, "{"); + lf_printf (file, "{"); for (elem = filter_next (set, ""); - elem != NULL; - elem = filter_next (set, elem)) + elem != NULL; elem = filter_next (set, elem)) { if (filter_is_member (members, elem)) { @@ -253,27 +243,23 @@ itable_print_set (lf *file, { lf_printf (file, " 0,"); } - + } /* always print a dummy element, to avoid empty initializers. */ - lf_printf(file, " 99 },\n"); + lf_printf (file, " 99 },\n"); } static void itable_c_insn (lf *file, - insn_table *isa, - insn_entry *instruction, - void *data) + insn_table *isa, insn_entry * instruction, void *data) { lf_printf (file, "{ "); lf_indent (file, +2); print_function_name (file, instruction->name, instruction->format_name, - NULL, - NULL, - function_name_prefix_itable); + NULL, NULL, function_name_prefix_itable); lf_printf (file, ",\n"); lf_printf (file, "\""); print_insn_words (file, instruction); @@ -284,22 +270,22 @@ itable_c_insn (lf *file, itable_print_set (file, isa->options, instruction->options); itable_print_set (file, isa->model->processors, instruction->processors); - lf_printf(file, "\"%s\",\n", instruction->name); - lf_printf(file, "\"%s\",\n", - filter_filename (instruction->line->file_name)); - lf_printf(file, "%d,\n", instruction->line->line_nr); - lf_printf(file, "},\n"); + lf_printf (file, "\"%s\",\n", instruction->name); + lf_printf (file, "\"%s\",\n", + filter_filename (instruction->line->file_name)); + lf_printf (file, "%d,\n", instruction->line->line_nr); + lf_printf (file, "},\n"); lf_indent (file, -2); } -extern void -gen_itable_c (lf *file, - insn_table *isa) +extern void +gen_itable_c (lf *file, insn_table *isa) { /* leader */ - lf_printf(file, "#include \"%sitable.h\"\n", options.module.itable.prefix.l); - lf_printf(file, "\n"); + lf_printf (file, "#include \"%sitable.h\"\n", + options.module.itable.prefix.l); + lf_printf (file, "\n"); /* FIXME - output model data??? */ /* FIXME - output assembler data??? */ @@ -312,9 +298,8 @@ gen_itable_c (lf *file, /* output the table that contains the actual instruction info */ lf_printf (file, "%sitable_info %sitable[nr_%sitable_entries] = {\n", options.module.itable.prefix.l, - options.module.itable.prefix.l, - options.module.itable.prefix.l); + options.module.itable.prefix.l, options.module.itable.prefix.l); insn_table_traverse_insn (file, isa, itable_c_insn, NULL); - lf_printf(file, "};\n"); + lf_printf (file, "};\n"); } |