From: Andrew Cagney Date: Mon, 27 Oct 1997 06:30:35 +0000 (+0000) Subject: Add include-file support to igen. X-Git-Tag: gdb-4_18~4380 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e2880fadf387be9b6206a6fa174f069cd64a8a38;p=external%2Fbinutils.git Add include-file support to igen. --- diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog index aba94cb..b535133 100644 --- a/sim/igen/ChangeLog +++ b/sim/igen/ChangeLog @@ -1,3 +1,24 @@ +Mon Oct 27 15:14:26 1997 Andrew Cagney + + * igen.c (main): Change -I option to -I. Add optional + size to -Ggen-icache option. Add -Gno-... support. + + * igen.h (struct _igen_options): Add include field. + + * ld-insn.c (enum insn_record_type, insn_type_map): Add + include_record. + (load_insn_table): Call table_push when include record. + + * table.c (struct _open table, struct table): Make table object an + indirect ptr to the current table file. + (current_line, new_table_entry, next_line): Make file arg type + open_table. + (table_open): Use table_push. + (table_read): Point variable file at current table, at eof, pop + last open table. + + * table.h, table.c (table_push): New function. + Thu Oct 16 11:03:27 1997 Andrew Cagney * gen-semantics.c (print_semantic_body): Use CIA not diff --git a/sim/igen/igen.c b/sim/igen/igen.c index 0fbe8e5..afd2904 100644 --- a/sim/igen/igen.c +++ b/sim/igen/igen.c @@ -979,15 +979,13 @@ main (int argc, printf ("\t Set the number of the high (most significant) instruction bit (depreciated).\n"); printf ("\t This option can now be set directly in the instruction table.\n"); printf ("\n"); - printf (" -I \n"); - printf ("\t Specify size of the cracking instruction cache (default %d instructions).\n", - options.gen.icache_size); - printf ("\t Implies -G icache.\n"); + printf (" -I \n"); + printf ("\t Add to the list of directories searched when opening a file\n"); printf ("\n"); printf (" -M \n"); printf ("\t Filter out any instructions that do not support at least one of the listed\n"); printf ("\t models (An instructions with no model information is considered to support\n"); - printf ("\n all models.).\n"); + printf ("\t all models.).\n"); printf ("\n"); printf (" -N \n"); printf ("\t Generate a simulator supporting \n"); @@ -1020,7 +1018,8 @@ main (int argc, printf ("\t gen-delayed-branch - need both cia and nia passed around\n"); printf ("\t gen-direct-access - use #defines to directly access values\n"); printf ("\t gen-zero-r - arch assumes GPR() == 0, keep it that way\n"); - printf ("\t gen-icache - generate an instruction cracking cache\n"); + printf ("\t gen-icache[= - generate an instruction cracking cache of size \n"); + printf ("\t Default size is %d\n", options.gen.icache_size); printf ("\t gen-insn-in-icache - save original instruction when cracking\n"); printf ("\t gen-multi-sim - generate multiple simulators - one per model\n"); printf ("\t By default, a single simulator that will\n"); @@ -1099,8 +1098,13 @@ main (int argc, break; case 'I': - options.gen.icache_size = a2i (optarg); - options.gen.icache = 1; + { + table_include **dir = &options.include; + while ((*dir) != NULL) + dir = &(*dir)->next; + (*dir) = ZALLOC (table_include); + (*dir)->dir = strdup (optarg); + } break; case 'B': @@ -1213,131 +1217,162 @@ main (int argc, case 'G': - if (strcmp (optarg, "decode-duplicate") == 0) - { - options.decode.duplicate = 1; - } - else if (strcmp (optarg, "decode-combine") == 0) - { - options.decode.combine = 1; - } - else if (strcmp (optarg, "decode-zero-reserved") == 0) - { - options.decode.zero_reserved = 1; - } - - else if (strcmp (optarg, "gen-conditional-issue") == 0) - { - options.gen.conditional_issue = 1; - } - else if (strcmp (optarg, "conditional-issue") == 0) - { - options.gen.conditional_issue = 1; - options.warning (NULL, "Option conditional-issue replaced by gen-conditional-issue\n"); - } - else if (strcmp (optarg, "gen-delayed-branch") == 0) - { - options.gen.delayed_branch = 1; - } - else if (strcmp (optarg, "delayed-branch") == 0) - { - options.gen.delayed_branch = 1; - options.warning (NULL, "Option delayed-branch replaced by gen-delayed-branch\n"); - } - else if (strcmp (optarg, "gen-direct-access") == 0) - { - options.gen.direct_access = 1; - } - else if (strcmp (optarg, "direct-access") == 0) - { - options.gen.direct_access = 1; - options.warning (NULL, "Option direct-access replaced by gen-direct-access\n"); - } - else if (strncmp (optarg, "gen-zero-r", strlen ("gen-zero-r")) == 0) - { - options.gen.zero_reg = 1; - options.gen.zero_reg_nr = atoi (optarg + strlen ("gen-zero-r")); - } - else if (strncmp (optarg, "zero-r", strlen ("zero-r")) == 0) - { - options.gen.zero_reg = 1; - options.gen.zero_reg_nr = atoi (optarg + strlen ("zero-r")); - options.warning (NULL, "Option zero-r replaced by gen-zero-r\n"); - } - else if (strcmp (optarg, "gen-icache") == 0) - { - options.gen.icache = 1; - } - else if (strcmp (optarg, "gen-insn-in-icache") == 0) - { - options.gen.insn_in_icache = 1; - } - else if (strcmp (optarg, "gen-multi-sim") == 0) - { - options.gen.multi_sim = 1; - } - else if (strcmp (optarg, "gen-multi-word") == 0) - { - options.gen.multi_word = 1; - } - else if (strcmp (optarg, "gen-semantic-icache") == 0) - { - options.gen.semantic_icache = 1; - } - else if (strcmp (optarg, "gen-slot-verification") == 0) - { - options.gen.slot_verification = 1; - } - else if (strcmp (optarg, "verify-slot") == 0) - { - options.gen.slot_verification = 1; - options.warning (NULL, "Option verify-slot replaced by gen-slot-verification\n"); - } - else if (strcmp (optarg, "gen-nia-invalid") == 0) - { - options.gen.nia = nia_is_invalid; - } - else if (strcmp (optarg, "default-nia-minus-one") == 0) - { - options.gen.nia = nia_is_invalid; - options.warning (NULL, "Option default-nia-minus-one replaced by gen-nia-invalid\n"); - } - else if (strcmp (optarg, "gen-nia-void") == 0) - { - options.gen.nia = nia_is_void; - } - else if (strcmp (optarg, "trace-combine") == 0) - { - options.trace.combine = 1; - } - else if (strcmp (optarg, "trace-entries") == 0) - { - options.trace.entries = 1; - } - else if (strcmp (optarg, "trace-rule-rejection") == 0) - { - options.trace.rule_rejection = 1; - } - else if (strcmp (optarg, "trace-rule-selection") == 0) - { - options.trace.rule_selection = 1; - } - else if (strcmp (optarg, "jumps") == 0) - { - options.gen.code = generate_jumps; - } - else if (strcmp (optarg, "field-widths") == 0) - { - options.insn_specifying_widths = 1; - } - else if (strcmp (optarg, "omit-line-numbers") == 0) - { - file_references = lf_omit_references; - } - else - error (NULL, "Unknown option %s\n", optarg); - break; - + { + int enable_p; + char *argp; + if (strncmp (optarg, "no-", strlen ("no-")) == 0) + { + argp = optarg + strlen ("no-"); + enable_p = 0; + } + else if (strncmp (optarg, "!", strlen ("!")) == 0) + { + argp = optarg + strlen ("no-"); + enable_p = 0; + } + else + { + argp = optarg; + enable_p = 1; + } + if (strcmp (argp, "decode-duplicate") == 0) + { + options.decode.duplicate = enable_p; + } + else if (strcmp (argp, "decode-combine") == 0) + { + options.decode.combine = enable_p; + } + else if (strcmp (argp, "decode-zero-reserved") == 0) + { + options.decode.zero_reserved = enable_p; + } + + else if (strcmp (argp, "gen-conditional-issue") == 0) + { + options.gen.conditional_issue = enable_p; + } + else if (strcmp (argp, "conditional-issue") == 0) + { + options.gen.conditional_issue = enable_p; + options.warning (NULL, "Option conditional-issue replaced by gen-conditional-issue\n"); + } + else if (strcmp (argp, "gen-delayed-branch") == 0) + { + options.gen.delayed_branch = enable_p; + } + else if (strcmp (argp, "delayed-branch") == 0) + { + options.gen.delayed_branch = enable_p; + options.warning (NULL, "Option delayed-branch replaced by gen-delayed-branch\n"); + } + else if (strcmp (argp, "gen-direct-access") == 0) + { + options.gen.direct_access = enable_p; + } + else if (strcmp (argp, "direct-access") == 0) + { + options.gen.direct_access = enable_p; + options.warning (NULL, "Option direct-access replaced by gen-direct-access\n"); + } + else if (strncmp (argp, "gen-zero-r", strlen ("gen-zero-r")) == 0) + { + options.gen.zero_reg = enable_p; + options.gen.zero_reg_nr = atoi (argp + strlen ("gen-zero-r")); + } + else if (strncmp (argp, "zero-r", strlen ("zero-r")) == 0) + { + options.gen.zero_reg = enable_p; + options.gen.zero_reg_nr = atoi (argp + strlen ("zero-r")); + options.warning (NULL, "Option zero-r replaced by gen-zero-r\n"); + } + else if (strncmp (argp, "gen-icache", strlen ("gen-icache")) == 0) + { + switch (argp[strlen ("gen-icache")]) + { + case '=': + options.gen.icache_size = atoi (argp + strlen ("gen-icache") + 1); + /* fall through */ + case '\0': + options.gen.icache = enable_p; + break; + default: + error (NULL, "Expecting -Ggen-icache or -Ggen-icache=\n"); + } + } + else if (strcmp (argp, "gen-insn-in-icache") == 0) + { + options.gen.insn_in_icache = enable_p; + } + else if (strcmp (argp, "gen-multi-sim") == 0) + { + options.gen.multi_sim = enable_p; + } + else if (strcmp (argp, "gen-multi-word") == 0) + { + options.gen.multi_word = enable_p; + } + else if (strcmp (argp, "gen-semantic-icache") == 0) + { + options.gen.semantic_icache = enable_p; + } + else if (strcmp (argp, "gen-slot-verification") == 0) + { + options.gen.slot_verification = enable_p; + } + else if (strcmp (argp, "verify-slot") == 0) + { + options.gen.slot_verification = enable_p; + options.warning (NULL, "Option verify-slot replaced by gen-slot-verification\n"); + } + else if (strcmp (argp, "gen-nia-invalid") == 0) + { + options.gen.nia = nia_is_invalid; + } + else if (strcmp (argp, "default-nia-minus-one") == 0) + { + options.gen.nia = nia_is_invalid; + options.warning (NULL, "Option default-nia-minus-one replaced by gen-nia-invalid\n"); + } + else if (strcmp (argp, "gen-nia-void") == 0) + { + options.gen.nia = nia_is_void; + } + else if (strcmp (argp, "trace-combine") == 0) + { + options.trace.combine = enable_p; + } + else if (strcmp (argp, "trace-entries") == 0) + { + options.trace.entries = enable_p; + } + else if (strcmp (argp, "trace-rule-rejection") == 0) + { + options.trace.rule_rejection = enable_p; + } + else if (strcmp (argp, "trace-rule-selection") == 0) + { + options.trace.rule_selection = enable_p; + } + else if (strcmp (argp, "jumps") == 0) + { + options.gen.code = generate_jumps; + } + else if (strcmp (argp, "field-widths") == 0) + { + options.insn_specifying_widths = enable_p; + } + else if (strcmp (argp, "omit-line-numbers") == 0) + { + file_references = lf_omit_references; + } + else + { + error (NULL, "Unknown option %s\n", optarg); + } + break; + } + case 'i': isa = load_insn_table (optarg, cache_rules); if (isa->illegal_insn == NULL) diff --git a/sim/igen/ld-insn.c b/sim/igen/ld-insn.c index eaa7eca..c5c3679 100644 --- a/sim/igen/ld-insn.c +++ b/sim/igen/ld-insn.c @@ -374,6 +374,7 @@ typedef enum { function_record, internal_record, define_record, + include_record, model_processor_record, model_macro_record, model_data_record, @@ -388,6 +389,7 @@ static const name_map insn_type_map[] = { { "compute", compute_record }, { "scratch", scratch_record }, { "define", define_record }, + { "include", include_record }, { "%s", string_function_record }, { "function", function_record }, { "internal", internal_record }, @@ -744,6 +746,17 @@ load_insn_table (char *file_name, switch (record_type (record)) { + case include_record: + { + if (record->nr_fields < nr_include_record_fields) + error (record->line, + "Incorrect nr of fields for include record\n"); + table_push (file, record->line, options.include, + record->field[include_record_filename_field]); + record = table_read (file); + break; + } + case option_record: { if (isa->insns != NULL) @@ -757,7 +770,7 @@ load_insn_table (char *file_name, /* convert a string function field into an internal function field */ char *name; if (record->nr_fields < nr_function_fields) - error (record->line, "Incorrect nr of fields for %s record\n"); + error (record->line, "Incorrect nr of fields for %%s record\n"); name = NZALLOC (char, (strlen ("str_") + strlen (record->field[function_name_field]) @@ -1017,8 +1030,12 @@ load_insn_table (char *file_name, break; } - default: - error (record->line, "Unknown entry\n"); + case unknown_record: + case define_record: + case code_record: + error (record->line, "Unknown or unexpected entry\n"); + + } } return isa; diff --git a/sim/igen/ld-insn.h b/sim/igen/ld-insn.h new file mode 100644 index 0000000..be6f4be --- /dev/null +++ b/sim/igen/ld-insn.h @@ -0,0 +1,608 @@ +/* This file is part of the program psim. + + Copyright (C) 1994,1995,1996,1997 Andrew Cagney + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + */ + + + +typedef unsigned64 insn_uint; + + +/* Common among most entries: + + */ + +enum { + record_type_field = 1, + old_record_type_field = 2, + record_filter_flags_field = 2, +}; + + +/* Include: + + Include the specified file. + + ::= + ":" "include" + ":" + ":" + + ; + + */ + +enum { + include_record_filename_field = 3, + nr_include_record_fields = 4, +}; + + + +/* Options: + + Valid options are: hi-bit-nr (default 0), insn-bit-size (default + 32), insn-specifying-widths (default true), multi-sim (default false). + +