sim: bfin: se_all32bitopcodes: skip debug insns under the sim
[deliverable/binutils-gdb.git] / sim / ppc / ld-insn.c
index a190d85a83f3cc0bb8431f59c1d5350d0f8b213d..e39131ca1334e91cee1ccee44fec6f8f5acd243c 100644 (file)
@@ -1,10 +1,10 @@
 /*  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
-    the Free Software Foundation; either version 2 of the License, or
+    the Free Software Foundation; either version 3 of the License, or
     (at your option) any later version.
 
     This program is distributed in the hope that it will be useful,
@@ -13,8 +13,7 @@
     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.
+    along with this program; if not, see <http://www.gnu.org/licenses/>.
  
     */
 
@@ -191,6 +190,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 +330,9 @@ 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,
+               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);
@@ -325,6 +344,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);
     }
@@ -343,6 +389,22 @@ 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 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 */
@@ -907,6 +969,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");
@@ -915,7 +978,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);
+  instructions = load_insn_table(argv[4], decode_rules, filters, NULL,
+                                &cache_rules);
   insn_table_expand_insns(instructions);
 
   dump_insn_table(instructions, 0, -1);
This page took 0.026299 seconds and 4 git commands to generate.