aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/igen.c
diff options
context:
space:
mode:
authorMatthew Green <mrg@redhat.com>2002-01-12 10:21:12 +0000
committerMatthew Green <mrg@redhat.com>2002-01-12 10:21:12 +0000
commit43c4bab0554541b32ec8c32dc58e2022e627dae5 (patch)
treeafabd0c0757b91cf8c5650db95135ef7ebe6e109 /sim/ppc/igen.c
parent3abd2e019d61de733dc82d1a2cab72d843d04b73 (diff)
downloadgdb-43c4bab0554541b32ec8c32dc58e2022e627dae5.zip
gdb-43c4bab0554541b32ec8c32dc58e2022e627dae5.tar.gz
gdb-43c4bab0554541b32ec8c32dc58e2022e627dae5.tar.bz2
* Makefile.in (tmp-igen): Pass -I $(srcdir) to igen.
* igen.c (main): Change -I to add include paths for :include: files. Implement -G as per sim/igen, with just gen-icache=N support. Call load_insn_table() with the built include path. * ld-insn.c (parse_include_entry): New. Load an :include: file. (load_insn_table): New `includes' argument. Look for :include: entries and call parse_include_entry() for them. (main): Adjust load_insn_table() call. * ld-insn.h (model_include_fields): New enum. (load_insn_table): Update prototype. * table.c (struct _open_table, struct _table): Rework structures to handle included files. (table_push): Move the guts of table_open() here. * 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_entry_read): Point variable file at current table, at eof, pop last open table. * misc.h (NZALLOC): New macro. From sim/igen. * table.h, table.c (table_push): New function.
Diffstat (limited to 'sim/ppc/igen.c')
-rw-r--r--sim/ppc/igen.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/sim/ppc/igen.c b/sim/ppc/igen.c
index ae81142..7008e96 100644
--- a/sim/ppc/igen.c
+++ b/sim/ppc/igen.c
@@ -347,6 +347,7 @@ main(int argc,
decode_table *decode_rules = NULL;
filter *filters = NULL;
insn_table *instructions = NULL;
+ table_include *includes = NULL;
char *real_file_name = NULL;
int is_header = 0;
int ch;
@@ -405,9 +406,49 @@ main(int argc,
case 'E':
generate_expanded_instructions = 1;
break;
+ case 'G':
+ {
+ 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 (strncmp (argp, "gen-icache", strlen ("gen-icache")) == 0)
+ {
+ switch (argp[strlen ("gen-icache")])
+ {
+ case '=':
+ icache_size = atoi (argp + strlen ("gen-icache") + 1);
+ code |= generate_with_icache;
+ break;
+ case '\0':
+ code |= generate_with_icache;
+ break;
+ default:
+ error (NULL, "Expecting -Ggen-icache or -Ggen-icache=<N>\n");
+ }
+ }
+ }
case 'I':
- icache_size = a2i(optarg);
- code |= generate_with_icache;
+ {
+ table_include **dir = &includes;
+ while ((*dir) != NULL)
+ dir = &(*dir)->next;
+ (*dir) = ZALLOC (table_include);
+ (*dir)->dir = strdup (optarg);
+ }
break;
case 'N':
generate_smp = a2i(optarg);
@@ -439,7 +480,7 @@ main(int argc,
fprintf(stderr, "Must specify decode and cache tables\n");
exit (1);
}
- instructions = load_insn_table(optarg, decode_rules, filters);
+ instructions = load_insn_table(optarg, decode_rules, filters, includes);
fprintf(stderr, "\texpanding ...\n");
insn_table_expand_insns(instructions);
break;