aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/ld-insn.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/ld-insn.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/ld-insn.c')
-rw-r--r--sim/ppc/ld-insn.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sim/ppc/ld-insn.c b/sim/ppc/ld-insn.c
index a190d85..28b6b55 100644
--- a/sim/ppc/ld-insn.c
+++ b/sim/ppc/ld-insn.c
@@ -191,6 +191,24 @@ parse_insn_format(table_entry *entry,
}
+void
+parse_include_entry (table *file,
+ table_entry *file_entry,
+ filter *filters,
+ table_include *includes)
+{
+ /* parse the include file_entry */
+ if (file_entry->nr_fields < 4)
+ error ("Incorrect nr fields for include record\n");
+ /* process it */
+ if (!is_filtered_out(file_entry->fields[include_flags], filters))
+ {
+ table_push (file, includes,
+ file_entry->fields[include_path],
+ file_entry->nr_fields, file_entry->nr_fields);
+ }
+}
+
static void
model_table_insert(insn_table *table,
table_entry *file_entry)
@@ -313,7 +331,8 @@ insn_table_insert_insn(insn_table *table,
insn_table *
load_insn_table(const char *file_name,
decode_table *decode_rules,
- filter *filters)
+ filter *filters,
+ table_include *includes)
{
table *file = table_open(file_name, nr_insn_table_fields, nr_insn_model_table_fields);
insn_table *table = ZALLOC(insn_table);
@@ -343,6 +362,10 @@ load_insn_table(const char *file_name,
else if (it_is("model-data", file_entry->fields[insn_flags])) {
model_table_insert_specific(table, file_entry, &model_data, &last_model_data);
}
+ else if (it_is("include", file_entry->fields[insn_form])
+ && !is_filtered_out(file_entry->fields[insn_flags], filters)) {
+ parse_include_entry (file, file_entry, filters, includes);
+ }
else {
insn_fields *fields;
/* skip instructions that aren't relevant to the mode */
@@ -915,7 +938,7 @@ main(int argc, char **argv)
hi_bit_nr = a2i(argv[2]);
ASSERT(hi_bit_nr < insn_bit_size);
decode_rules = load_decode_table(argv[3], hi_bit_nr);
- instructions = load_insn_table(argv[4], decode_rules, filters);
+ instructions = load_insn_table(argv[4], decode_rules, filters, NULL);
insn_table_expand_insns(instructions);
dump_insn_table(instructions, 0, -1);