aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/ld-insn.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-06-20 03:59:33 +0000
committerAndrew Cagney <cagney@redhat.com>2003-06-20 03:59:33 +0000
commitd81bb16ac041a24abb0d108dfd6491d6b097aa03 (patch)
treef97122948970f89bcfdbe0af29467b28dfe75247 /sim/ppc/ld-insn.c
parentcd0f588e1993fef286900f566beb83434c8ed7c1 (diff)
downloadfsf-binutils-gdb-d81bb16ac041a24abb0d108dfd6491d6b097aa03.zip
fsf-binutils-gdb-d81bb16ac041a24abb0d108dfd6491d6b097aa03.tar.gz
fsf-binutils-gdb-d81bb16ac041a24abb0d108dfd6491d6b097aa03.tar.bz2
2003-06-19 Andrew Cagney <cagney@redhat.com>
* ld-insn.h: Update copyright. (cache_fields): Define. (insn_table_fields): Add insn_field_6 and insn_field_7. (load_insn_table): Pass in the "cache_rules". * ld-insn.c: Update copyright. (load_insn_table): Add parameter "cache_rules". Handle "cache", "computed" and "scratch" fields. (main): Pass "cache_rules" to load_insn_table. * ld-cache.h: Update copyright. (append_cache_table): Declare. * ld-cache.c: Update copyright. (append_cache_table): New function. (load_cache_table): Call. * gen-model.c: Include "ld-cache.h". * gen-itable.c: Include "ld-cache.h". * igen.c: Move #include "ld-cache.h" to earlier. Update copyright. (main): Permit a NULL "cache_rules". Pass address of "cache_rules" to load_insn_table. * Makefile.in (tmp-ld-insn): Add "ld-cache.o". (tmp-igen): Do not include ppc-cache-rules. (gen-itable.o, gen-model.o): Add "ld-cache.h". * ppc-cache-rules: Delete file. * ppc-instructions: Add cache rules.
Diffstat (limited to 'sim/ppc/ld-insn.c')
-rw-r--r--sim/ppc/ld-insn.c48
1 files changed, 45 insertions, 3 deletions
diff --git a/sim/ppc/ld-insn.c b/sim/ppc/ld-insn.c
index 28b6b55..e3b1ba5 100644
--- a/sim/ppc/ld-insn.c
+++ b/sim/ppc/ld-insn.c
@@ -1,6 +1,6 @@
/* This file is part of the program psim.
- Copyright (C) 1994,1995,1996, Andrew Cagney <cagney@highland.com.au>
+ Copyright 1994, 1995, 1996, 2003 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
@@ -332,7 +332,8 @@ insn_table *
load_insn_table(const char *file_name,
decode_table *decode_rules,
filter *filters,
- table_include *includes)
+ table_include *includes,
+ cache_table **cache_rules)
{
table *file = table_open(file_name, nr_insn_table_fields, nr_insn_model_table_fields);
insn_table *table = ZALLOC(insn_table);
@@ -344,6 +345,33 @@ load_insn_table(const char *file_name,
|| it_is("internal", file_entry->fields[insn_flags])) {
insn_table_insert_function(table, file_entry);
}
+ else if ((it_is("function", file_entry->fields[insn_form])
+ || it_is("internal", file_entry->fields[insn_form]))
+ && !is_filtered_out(file_entry->fields[insn_flags], filters)) {
+ /* Ok, this is evil. Need to convert a new style function into
+ an old style function. Construct an old style table and then
+ copy it back. */
+ char *fields[nr_insn_table_fields];
+ memset (fields, 0, sizeof fields);
+ fields[insn_flags] = file_entry->fields[insn_form];
+ fields[function_type] = file_entry->fields[insn_name];
+ fields[function_name] = file_entry->fields[insn_comment];
+ fields[function_param] = file_entry->fields[insn_field_6];
+ memcpy (file_entry->fields, fields,
+ sizeof (fields[0]) * file_entry->nr_fields);
+ insn_table_insert_function(table, file_entry);
+#if 0
+ ":" "..."
+ ":" <filter-flags>
+ ":" <filter-models>
+ ":" <typedef>
+ ":" <name>
+ [ ":" <parameter-list> ]
+ <nl>
+ [ <function-model> ]
+ <code-block>
+#endif
+ }
else if (it_is("model", file_entry->fields[insn_flags])) {
model_table_insert(table, file_entry);
}
@@ -366,6 +394,18 @@ load_insn_table(const char *file_name,
&& !is_filtered_out(file_entry->fields[insn_flags], filters)) {
parse_include_entry (file, file_entry, filters, includes);
}
+ else if ((it_is("cache", file_entry->fields[insn_form])
+ || it_is("compute", file_entry->fields[insn_form])
+ || it_is("scratch", file_entry->fields[insn_form]))
+ && !is_filtered_out(file_entry->fields[insn_flags], filters)) {
+ append_cache_rule (cache_rules,
+ file_entry->fields[insn_form], /* type */
+ file_entry->fields[cache_name],
+ file_entry->fields[cache_derived_name],
+ file_entry->fields[cache_type_def],
+ file_entry->fields[cache_expression],
+ file_entry);
+ }
else {
insn_fields *fields;
/* skip instructions that aren't relevant to the mode */
@@ -930,6 +970,7 @@ main(int argc, char **argv)
filter *filters = NULL;
decode_table *decode_rules = NULL;
insn_table *instructions = NULL;
+ cache_table *cache_rules = NULL;
if (argc != 5)
error("Usage: insn <filter> <hi-bit-nr> <decode-table> <insn-table>\n");
@@ -938,7 +979,8 @@ 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, NULL);
+ instructions = load_insn_table(argv[4], decode_rules, filters, NULL,
+ &cache_rules);
insn_table_expand_insns(instructions);
dump_insn_table(instructions, 0, -1);