summaryrefslogtreecommitdiff
path: root/sim/ppc/ld-cache.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
commit6b25af753a12a65add6a8bc3a55a774b597efd62 (patch)
treeed9b606fa30f87b47a6ab4ebc62948396339aba8 /sim/ppc/ld-cache.c
parenta3962e8784ea9dedb5d666cfc24c42d741b4d545 (diff)
downloadgdb-6b25af753a12a65add6a8bc3a55a774b597efd62.tar.gz
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-cache.c')
-rw-r--r--sim/ppc/ld-cache.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/sim/ppc/ld-cache.c b/sim/ppc/ld-cache.c
index 135013e5f23..ef16c675437 100644
--- a/sim/ppc/ld-cache.c
+++ b/sim/ppc/ld-cache.c
@@ -1,6 +1,6 @@
/* This file is part of the program psim.
- Copyright (C) 1994-1997, Andrew Cagney <cagney@highland.com.au>
+ Copyright 1994, 1995, 1996, 1997, 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
@@ -46,6 +46,24 @@ static const name_map cache_type_map[] = {
};
+void
+append_cache_rule (cache_table **table, char *type, char *field_name,
+ char *derived_name, char *type_def,
+ char *expression, table_entry *file_entry)
+{
+ while ((*table) != NULL)
+ table = &(*table)->next;
+ (*table) = ZALLOC(cache_table);
+ (*table)->type = name2i(type, cache_type_map);
+ (*table)->field_name = field_name;
+ (*table)->derived_name = derived_name;
+ (*table)->type_def = (strlen(type_def) > 0 ? type_def : NULL);
+ (*table)->expression = (strlen(expression) > 0 ? expression : NULL);
+ (*table)->file_entry = file_entry;
+ (*table)->next = NULL;
+}
+
+
cache_table *
load_cache_table(char *file_name,
int hi_bit_nr)
@@ -55,19 +73,13 @@ load_cache_table(char *file_name,
cache_table *table = NULL;
cache_table **curr_rule = &table;
while ((entry = table_entry_read(file)) != NULL) {
- cache_table *new_rule = ZALLOC(cache_table);
- new_rule->type = name2i(entry->fields[ca_type], cache_type_map);
- new_rule->field_name = entry->fields[ca_field_name];
- new_rule->derived_name = entry->fields[ca_derived_name];
- new_rule->type_def = (strlen(entry->fields[ca_type_def])
- ? entry->fields[ca_type_def]
- : NULL);
- new_rule->expression = (strlen(entry->fields[ca_expression]) > 0
- ? entry->fields[ca_expression]
- : NULL);
- new_rule->file_entry = entry;
- *curr_rule = new_rule;
- curr_rule = &new_rule->next;
+ append_cache_rule (curr_rule, entry->fields[ca_type],
+ entry->fields[ca_field_name],
+ entry->fields[ca_derived_name],
+ entry->fields[ca_type_def],
+ entry->fields[ca_expression],
+ entry);
+ curr_rule = &(*curr_rule)->next;
}
return table;
}