gas: run the hwcaps-bump tests with 64-bit sparc objects only.
[deliverable/binutils-gdb.git] / sim / igen / gen-engine.c
index d0f5c30ce71a5ba6821691e6ffaaad666921271b..829d6b0ddc9e76c7e00f8757c8249be071ea6a54 100644 (file)
@@ -1,6 +1,6 @@
 /* The IGEN simulator generator for GDB, the GNU Debugger.
 
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002-2016 Free Software Foundation, Inc.
 
    Contributed by Andrew Cagney.
 
@@ -8,7 +8,7 @@
 
    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,
@@ -17,9 +17,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/>.  */
 
 #include "misc.h"
 #include "lf.h"
@@ -118,7 +116,7 @@ cache. */\n\
       lf_putstr (file, "/* prime the main loop */\n");
       lf_putstr (file, "SIM_ASSERT (current_cpu == 0);\n");
       lf_putstr (file, "SIM_ASSERT (nr_cpus == 1);\n");
-      lf_putstr (file, "cia = CIA_GET (CPU);\n");
+      lf_putstr (file, "cia = CPU_PC_GET (CPU);\n");
 
       lf_putstr (file, "\n");
       lf_putstr (file, "while (1)\n");
@@ -204,9 +202,9 @@ cache. */\n\
       lf_putstr (file, "/* process any events */\n");
       lf_putstr (file, "if (sim_events_tick (sd))\n");
       lf_putstr (file, "  {\n");
-      lf_putstr (file, "    CIA_SET (CPU, cia);\n");
+      lf_putstr (file, "    CPU_PC_SET (CPU, cia);\n");
       lf_putstr (file, "    sim_events_process (sd);\n");
-      lf_putstr (file, "    cia = CIA_GET (CPU);\n");
+      lf_putstr (file, "    cia = CPU_PC_GET (CPU);\n");
       lf_putstr (file, "  }\n");
 
       lf_indent (file, -4);
@@ -238,7 +236,7 @@ after all the other CPU's and the event queue have been processed */\n\
       lf_putstr (file, "  {\n");
       lf_indent (file, +4);
       lf_putstr (file, "sim_cpu *cpu = STATE_CPU (sd, current_cpu);\n");
-      lf_putstr (file, "instruction_address cia = CIA_GET (cpu);\n");
+      lf_putstr (file, "instruction_address cia = CPU_PC_GET (cpu);\n");
       lf_putstr (file, "\n");
 
       if (!options.gen.icache)
@@ -247,7 +245,7 @@ after all the other CPU's and the event queue have been processed */\n\
                     options.insn_bit_size);
          print_engine_issue_prefix_hook (file);
          print_idecode_body (file, table, "cia =");
-         lf_putstr (file, "CIA_SET (cpu, cia);\n");
+         lf_putstr (file, "CPU_PC_SET (cpu, cia);\n");
          print_engine_issue_postfix_hook (file);
        }
 
@@ -335,325 +333,6 @@ after all the other CPU's and the event queue have been processed */\n\
 
 /****************************************************************/
 
-#if 0
-static void
-print_jump (lf *file, int is_tail)
-{
-  if (!options.gen.smp)
-    {
-      lf_putstr (file, "if (event_queue_tick (sd))\n");
-      lf_putstr (file, "  {\n");
-      lf_putstr (file, "    CPU_CIA (processor) = nia;\n");
-      lf_putstr (file, "    sim_events_process (sd);\n");
-      lf_putstr (file, "  }\n");
-      lf_putstr (file, "}\n");
-    }
-
-  if (options.gen.smp)
-    {
-      if (is_tail)
-       lf_putstr (file, "cpu_set_program_counter(processor, nia);\n");
-      lf_putstr (file, "current_cpu += 1;\n");
-      lf_putstr (file, "if (current_cpu >= nr_cpus)\n");
-      lf_putstr (file, "  {\n");
-      lf_putstr (file, "    if (sim_events_tick (sd))\n");
-      lf_putstr (file, "      {\n");
-      lf_putstr (file, "        sim_events_process (sd);\n");
-      lf_putstr (file, "      }\n");
-      lf_putstr (file, "    current_cpu = 0;\n");
-      lf_putstr (file, "  }\n");
-      lf_putstr (file, "processor = processors[current_cpu];\n");
-      lf_putstr (file, "nia = cpu_get_program_counter(processor);\n");
-    }
-
-  if (options.gen.icache)
-    {
-      lf_putstr (file, "cache_entry = cpu_icache_entry(processor, nia);\n");
-      lf_putstr (file, "if (cache_entry->address == nia) {\n");
-      lf_putstr (file, "  /* cache hit */\n");
-      lf_putstr (file, "  goto *cache_entry->semantic;\n");
-      lf_putstr (file, "}\n");
-      if (is_tail)
-       {
-         lf_putstr (file, "goto cache_miss;\n");
-       }
-    }
-
-  if (!options.gen.icache && is_tail)
-    {
-      lf_printf (file, "goto engine;\n");
-    }
-
-}
-#endif
-
-
-#if 0
-static void
-print_jump_insn (lf *file,
-                insn_entry * instruction,
-                opcode_bits *expanded_bits,
-                opcode_field *opcodes, cache_entry *cache_rules)
-{
-  insn_opcodes opcode_path;
-
-  memset (&opcode_path, 0, sizeof (opcode_path));
-  opcode_path.opcode = opcodes;
-
-  /* what we are for the moment */
-  lf_printf (file, "\n");
-  print_my_defines (file,
-                   instruction->name,
-                   instruction->format_name, expanded_bits);
-
-  /* output the icache entry */
-  if (options.gen.icache)
-    {
-      lf_printf (file, "\n");
-      lf_indent (file, -1);
-      print_function_name (file,
-                          instruction->name,
-                          instruction->format_name,
-                          NULL, expanded_bits, function_name_prefix_icache);
-      lf_printf (file, ":\n");
-      lf_indent (file, +1);
-      lf_printf (file, "{\n");
-      lf_indent (file, +2);
-      lf_putstr (file, "const unsigned_word cia = nia;\n");
-      print_itrace (file, instruction, 1 /*putting-value-in-cache */ );
-      print_idecode_validate (file, instruction, &opcode_path);
-      lf_printf (file, "\n");
-      lf_printf (file, "{\n");
-      lf_indent (file, +2);
-      print_icache_body (file, instruction, expanded_bits, cache_rules, 0,     /*use_defines */
-                        put_values_in_icache);
-      lf_printf (file, "cache_entry->address = nia;\n");
-      lf_printf (file, "cache_entry->semantic = &&");
-      print_function_name (file,
-                          instruction->name,
-                          instruction->format_name,
-                          NULL,
-                          expanded_bits, function_name_prefix_semantics);
-      lf_printf (file, ";\n");
-      if (options.gen.semantic_icache)
-       {
-         print_semantic_body (file,
-                              instruction, expanded_bits, &opcode_path);
-         print_jump (file, 1 /*is-tail */ );
-       }
-      else
-       {
-         lf_printf (file, "/* goto ");
-         print_function_name (file,
-                              instruction->name,
-                              instruction->format_name,
-                              NULL,
-                              expanded_bits, function_name_prefix_semantics);
-         lf_printf (file, "; */\n");
-       }
-      lf_indent (file, -2);
-      lf_putstr (file, "}\n");
-      lf_indent (file, -2);
-      lf_printf (file, "}\n");
-    }
-
-  /* print the semantics */
-  lf_printf (file, "\n");
-  lf_indent (file, -1);
-  print_function_name (file,
-                      instruction->name,
-                      instruction->format_name,
-                      NULL, expanded_bits, function_name_prefix_semantics);
-  lf_printf (file, ":\n");
-  lf_indent (file, +1);
-  lf_printf (file, "{\n");
-  lf_indent (file, +2);
-  lf_putstr (file, "const unsigned_word cia = nia;\n");
-  print_icache_body (file,
-                    instruction,
-                    expanded_bits,
-                    cache_rules,
-                    (options.gen.direct_access
-                     ? define_variables
-                     : declare_variables),
-                    (options.gen.icache
-                     ? get_values_from_icache : do_not_use_icache));
-  print_semantic_body (file, instruction, expanded_bits, &opcode_path);
-  if (options.gen.direct_access)
-    print_icache_body (file,
-                      instruction,
-                      expanded_bits,
-                      cache_rules,
-                      undef_variables,
-                      (options.gen.icache
-                       ? get_values_from_icache : do_not_use_icache));
-  print_jump (file, 1 /*is tail */ );
-  lf_indent (file, -2);
-  lf_printf (file, "}\n");
-}
-#endif
-
-
-#if 0
-static void
-print_jump_definition (lf *file, gen_entry *entry, int depth, void *data)
-{
-  cache_entry *cache_rules = (cache_entry *) data;
-  if (entry->opcode_rule->with_duplicates)
-    {
-      ASSERT (entry->nr_insns == 1
-             && entry->opcode == NULL
-             && entry->parent != NULL && entry->parent->opcode != NULL);
-      ASSERT (entry->nr_insns == 1
-             && entry->opcode == NULL
-             && entry->parent != NULL
-             && entry->parent->opcode != NULL
-             && entry->parent->opcode_rule != NULL);
-      print_jump_insn (file,
-                      entry->insns->insn,
-                      entry->expanded_bits, entry->opcode, cache_rules);
-    }
-  else
-    {
-      print_jump_insn (file, entry->insns->insn, NULL, NULL, cache_rules);
-    }
-}
-#endif
-
-
-#if 0
-static void
-print_jump_internal_function (lf *file, function_entry * function, void *data)
-{
-  if (function->is_internal)
-    {
-      lf_printf (file, "\n");
-      lf_print__line_ref (file, function->line);
-      lf_indent (file, -1);
-      print_function_name (file,
-                          function->name,
-                          NULL,
-                          NULL,
-                          NULL,
-                          (options.gen.icache
-                           ? function_name_prefix_icache
-                           : function_name_prefix_semantics));
-      lf_printf (file, ":\n");
-      lf_indent (file, +1);
-      lf_printf (file, "{\n");
-      lf_indent (file, +2);
-      lf_printf (file, "const unsigned_word cia = nia;\n");
-      table_print_code (file, function->code);
-      lf_print__internal_ref (file);
-      lf_printf (file, "error(\"Internal function must longjump\\n\");\n");
-      lf_indent (file, -2);
-      lf_printf (file, "}\n");
-    }
-}
-#endif
-
-
-#if 0
-static void
-print_jump_body (lf *file,
-                gen_entry *entry, insn_table *isa, cache_entry *cache_rules)
-{
-  lf_printf (file, "{\n");
-  lf_indent (file, +2);
-  lf_putstr (file, "jmp_buf halt;\n");
-  lf_putstr (file, "jmp_buf restart;\n");
-  lf_putstr (file, "cpu *processor = NULL;\n");
-  lf_putstr (file, "unsigned_word nia = -1;\n");
-  lf_putstr (file, "instruction_word instruction = 0;\n");
-  if (options.gen.icache)
-    {
-      lf_putstr (file, "engine_cache *cache_entry = NULL;\n");
-    }
-  if (options.gen.smp)
-    {
-      lf_putstr (file, "int current_cpu = -1;\n");
-    }
-
-  /* all the switches and tables - they know about jumping */
-  print_idecode_lookups (file, entry, cache_rules);
-
-  /* start the simulation up */
-  if (options.gen.icache)
-    {
-      lf_putstr (file, "\n");
-      lf_putstr (file, "{\n");
-      lf_putstr (file, "  int cpu_nr;\n");
-      lf_putstr (file, "  for (cpu_nr = 0; cpu_nr < nr_cpus; cpu_nr++)\n");
-      lf_putstr (file, "    cpu_flush_icache(processors[cpu_nr]);\n");
-      lf_putstr (file, "}\n");
-    }
-
-  lf_putstr (file, "\n");
-  lf_putstr (file, "psim_set_halt_and_restart(system, &halt, &restart);\n");
-
-  lf_putstr (file, "\n");
-  lf_putstr (file, "if (setjmp(halt))\n");
-  lf_putstr (file, "  return;\n");
-
-  lf_putstr (file, "\n");
-  lf_putstr (file, "setjmp(restart);\n");
-
-  lf_putstr (file, "\n");
-  if (!options.gen.smp)
-    {
-      lf_putstr (file, "processor = processors[0];\n");
-      lf_putstr (file, "nia = cpu_get_program_counter(processor);\n");
-    }
-  else
-    {
-      lf_putstr (file, "current_cpu = psim_last_cpu(system);\n");
-    }
-
-  if (!options.gen.icache)
-    {
-      lf_printf (file, "\n");
-      lf_indent (file, -1);
-      lf_printf (file, "engine:\n");
-      lf_indent (file, +1);
-    }
-
-  print_jump (file, 0 /*is_tail */ );
-
-  if (options.gen.icache)
-    {
-      lf_indent (file, -1);
-      lf_printf (file, "cache_miss:\n");
-      lf_indent (file, +1);
-    }
-
-  print_engine_issue_prefix_hook (file);
-  lf_putstr (file, "instruction\n");
-  lf_putstr (file,
-            "  = vm_instruction_map_read(cpu_instruction_map(processor),\n");
-  lf_putstr (file, "                            processor, nia);\n");
-  print_engine_issue_prefix_hook (file);
-  print_idecode_body (file, entry, "/*IGORE*/");
-  print_engine_issue_postfix_hook (file);
-
-  /* print out a table of all the internals functions */
-  function_entry_traverse (file, isa->functions,
-                          print_jump_internal_function, NULL);
-
-  /* print out a table of all the instructions */
-  ERROR ("Use the list of semantic functions, not travere_tree");
-  gen_entry_traverse_tree (file, entry, 1, NULL,       /* start */
-                          print_jump_definition,       /* leaf */
-                          NULL,        /* end */
-                          cache_rules);
-  lf_indent (file, -2);
-  lf_printf (file, "}\n");
-}
-#endif
-
-
-/****************************************************************/
-
-
 void
 print_engine_run_function_header (lf *file,
                                  char *processor,
@@ -756,12 +435,6 @@ gen_engine_c (lf *file,
 
        case generate_jumps:
          ERROR ("Jumps currently unimplemented");
-#if 0
-         print_engine_run_function_header (file,
-                                           entry->processor,
-                                           is_function_definition);
-         print_jump_body (file, entry->table, isa, cache_rules);
-#endif
          break;
        }
     }
This page took 0.028266 seconds and 4 git commands to generate.