]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - sim/igen/gen-itable.c
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / sim / igen / gen-itable.c
index c3e90535683527178f3714f32017c1fcf4549848..56dd06c1231b4faeb574960a50f0e21cf5f93d3a 100644 (file)
@@ -1,22 +1,23 @@
-/*  This file is part of the program psim.
+/* The IGEN simulator generator for GDB, the GNU Debugger.
 
-    Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
+   Copyright 2002-2013 Free Software Foundation, Inc.
 
-    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
-    (at your option) any later version.
+   Contributed by Andrew Cagney.
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    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.
-    */
+   This file is part of GDB.
+
+   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 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   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, see <http://www.gnu.org/licenses/>.  */
 
 
 
 
 
 
-typedef struct _itable_info {
+typedef struct _itable_info
+{
   int sizeof_form;
   int sizeof_name;
   int sizeof_file;
-} itable_info;
+}
+itable_info;
 
 
 static void
 itable_h_insn (lf *file,
-              insn_table *entry,
-              insn_entry *instruction,
-              void *data)
+              insn_table *entry, insn_entry * instruction, void *data)
 {
   int len;
   itable_info *info = data;
@@ -59,9 +60,7 @@ itable_h_insn (lf *file,
   print_function_name (file,
                       instruction->name,
                       instruction->format_name,
-                      NULL,
-                      NULL,
-                      function_name_prefix_itable);
+                      NULL, NULL, function_name_prefix_itable);
   lf_printf (file, ",\n");
   /* update summary info */
   len = strlen (instruction->format_name);
@@ -79,16 +78,13 @@ itable_h_insn (lf *file,
 /* print the list of all the different options */
 
 static void
-itable_print_enum (lf *file,
-                  filter *set,
-                  char *name)
+itable_print_enum (lf *file, filter *set, char *name)
 {
   char *elem;
   lf_printf (file, "typedef enum {\n");
   lf_indent (file, +2);
   for (elem = filter_next (set, "");
-       elem != NULL;
-       elem = filter_next (set, elem))
+       elem != NULL; elem = filter_next (set, elem))
     {
       lf_printf (file, "%sitable_%s_%s,\n",
                 options.module.itable.prefix.l, name, elem);
@@ -99,8 +95,9 @@ itable_print_enum (lf *file,
                     name, elem, options.module.itable.prefix.l, name, elem);
        }
     }
-  lf_printf (file, "nr_%sitable_%ss,\n", options.module.itable.prefix.l, name);
-  
+  lf_printf (file, "nr_%sitable_%ss,\n", options.module.itable.prefix.l,
+            name);
+
   lf_indent (file, -2);
   lf_printf (file, "} %sitable_%ss;\n", options.module.itable.prefix.l, name);
   if (strlen (options.module.itable.prefix.l) > 0)
@@ -117,9 +114,7 @@ itable_print_enum (lf *file,
 /* print an array of the option names as strings */
 
 static void
-itable_print_names (lf *file,
-                   filter *set,
-                   char *name)
+itable_print_names (lf *file, filter *set, char *name)
 {
   char *elem;
   lf_printf (file, "const char *%sitable_%s_names[nr_%sitable_%ss + 1] = {\n",
@@ -127,8 +122,7 @@ itable_print_names (lf *file,
             options.module.itable.prefix.l, name);
   lf_indent (file, +2);
   for (elem = filter_next (set, "");
-       elem != NULL;
-       elem = filter_next (set, elem))
+       elem != NULL; elem = filter_next (set, elem))
     {
       lf_printf (file, "\"%s\",\n", elem);
     }
@@ -137,16 +131,16 @@ itable_print_names (lf *file,
   lf_printf (file, "};\n");
 }
 
-extern void 
-gen_itable_h (lf *file,
-             insn_table *isa)
+extern void
+gen_itable_h (lf *file, insn_table *isa)
 {
   itable_info *info = ZALLOC (itable_info);
 
   /* output an enumerated type for each instruction */
   lf_printf (file, "typedef enum {\n");
   insn_table_traverse_insn (file, isa, itable_h_insn, info);
-  lf_printf (file, "  nr_%sitable_entries,\n", options.module.itable.prefix.l);
+  lf_printf (file, "  nr_%sitable_entries,\n",
+            options.module.itable.prefix.l);
   lf_printf (file, "} %sitable_index;\n", options.module.itable.prefix.l);
   lf_printf (file, "\n");
 
@@ -155,7 +149,7 @@ gen_itable_h (lf *file,
   lf_printf (file, "extern const char *%sitable_flag_names[];\n",
             options.module.itable.prefix.l);
   lf_printf (file, "\n");
-    
+
   /* output an enumeration of all the possible options */
   itable_print_enum (file, isa->options, "option");
   lf_printf (file, "extern const char *%sitable_option_names[];\n",
@@ -217,9 +211,7 @@ gen_itable_h (lf *file,
 /****************************************************************/
 
 static void
-itable_print_set (lf *file,
-                 filter *set,
-                 filter *members)
+itable_print_set (lf *file, filter *set, filter *members)
 {
   char *elem;
   lf_printf (file, "\"");
@@ -237,10 +229,9 @@ itable_print_set (lf *file,
     }
   lf_printf (file, "\",\n");
 
-  lf_printf(file, "{");
+  lf_printf (file, "{");
   for (elem = filter_next (set, "");
-       elem != NULL;
-       elem = filter_next (set, elem))
+       elem != NULL; elem = filter_next (set, elem))
     {
       if (filter_is_member (members, elem))
        {
@@ -250,27 +241,23 @@ itable_print_set (lf *file,
        {
          lf_printf (file, " 0,");
        }
-      
+
     }
   /* always print a dummy element, to avoid empty initializers. */
-  lf_printf(file, " 99 },\n");
+  lf_printf (file, " 99 },\n");
 }
 
 
 static void
 itable_c_insn (lf *file,
-              insn_table *isa,
-              insn_entry *instruction,
-              void *data)
+              insn_table *isa, insn_entry * instruction, void *data)
 {
   lf_printf (file, "{ ");
   lf_indent (file, +2);
   print_function_name (file,
                       instruction->name,
                       instruction->format_name,
-                      NULL,
-                      NULL,
-                      function_name_prefix_itable);
+                      NULL, NULL, function_name_prefix_itable);
   lf_printf (file, ",\n");
   lf_printf (file, "\"");
   print_insn_words (file, instruction);
@@ -281,22 +268,22 @@ itable_c_insn (lf *file,
   itable_print_set (file, isa->options, instruction->options);
   itable_print_set (file, isa->model->processors, instruction->processors);
 
-  lf_printf(file, "\"%s\",\n", instruction->name);
-  lf_printf(file, "\"%s\",\n",
-           filter_filename (instruction->line->file_name));
-  lf_printf(file, "%d,\n", instruction->line->line_nr);
-  lf_printf(file, "},\n");
+  lf_printf (file, "\"%s\",\n", instruction->name);
+  lf_printf (file, "\"%s\",\n",
+            filter_filename (instruction->line->file_name));
+  lf_printf (file, "%d,\n", instruction->line->line_nr);
+  lf_printf (file, "},\n");
   lf_indent (file, -2);
 }
 
 
-extern void 
-gen_itable_c (lf *file,
-             insn_table *isa)
+extern void
+gen_itable_c (lf *file, insn_table *isa)
 {
   /* leader */
-  lf_printf(file, "#include \"%sitable.h\"\n", options.module.itable.prefix.l);
-  lf_printf(file, "\n");
+  lf_printf (file, "#include \"%sitable.h\"\n",
+            options.module.itable.prefix.l);
+  lf_printf (file, "\n");
 
   /* FIXME - output model data??? */
   /* FIXME - output assembler data??? */
@@ -309,9 +296,8 @@ gen_itable_c (lf *file,
   /* output the table that contains the actual instruction info */
   lf_printf (file, "%sitable_info %sitable[nr_%sitable_entries] = {\n",
             options.module.itable.prefix.l,
-            options.module.itable.prefix.l,
-            options.module.itable.prefix.l);
+            options.module.itable.prefix.l, options.module.itable.prefix.l);
   insn_table_traverse_insn (file, isa, itable_c_insn, NULL);
 
-  lf_printf(file, "};\n");
+  lf_printf (file, "};\n");
 }