]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove all #if 0'd code.
authorHans-Peter Nilsson <hp@axis.com>
Fri, 8 Jul 2011 02:27:18 +0000 (02:27 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Fri, 8 Jul 2011 02:27:18 +0000 (02:27 +0000)
* filter.c: Remove #if 0'd function it_is.
(main): Remove #if 0'd code.
* gen-engine.c: Remove #if 0'd functions print_jump,
print_jump_insn, print_jump_definition,
print_jump_internal_function, print_jump_body.
(gen_engine_c): Remove #if 0'd code.
* gen-idecode.c: Remove #if 0'd functions print_jump print_jump,
print_jump_insn, print_jump_definition,
print_jump_internal_function, print_jump_until_stop_body.
* gen-model.c: Remove #if 0'd functions model_c_or_h_data,
model_c_or_h_function, gen_model_h, model_c_insn,
model_c_function, gen_model_c and types model_c_passed_data
and struct _model_c_passed_data.
* gen.c: Remove #if 0'd type constant_field_types and function
insn_field_is_constant.
(gen_entry_find_opcode_field): Remove #if 0'd code.
* ld-insn.c (parse_insn_model_record): Remove #if 0'd code.
* misc.h (STRDUP, STRNDUP): Remove #if 0'd macros.

sim/igen/ChangeLog
sim/igen/filter.c
sim/igen/gen-engine.c
sim/igen/gen-idecode.c
sim/igen/gen-model.c
sim/igen/gen.c
sim/igen/ld-insn.c
sim/igen/misc.h

index 7d1a9b4e411d9692e93d479b863090d8b9816498..576962e3d9083b4086f8340f2fd0ea583f0bdb7f 100644 (file)
@@ -1,3 +1,25 @@
+2011-07-08  Hans-Peter Nilsson  <hp@axis.com>
+
+       Remove all #if 0'd code.
+       * filter.c: Remove #if 0'd function it_is.
+       (main): Remove #if 0'd code.
+       * gen-engine.c: Remove #if 0'd functions print_jump,
+       print_jump_insn, print_jump_definition,
+       print_jump_internal_function, print_jump_body.
+       (gen_engine_c): Remove #if 0'd code.
+       * gen-idecode.c: Remove #if 0'd functions print_jump print_jump,
+       print_jump_insn, print_jump_definition,
+       print_jump_internal_function, print_jump_until_stop_body.
+       * gen-model.c: Remove #if 0'd functions model_c_or_h_data,
+       model_c_or_h_function, gen_model_h, model_c_insn,
+       model_c_function, gen_model_c and types model_c_passed_data
+       and struct _model_c_passed_data.
+       * gen.c: Remove #if 0'd type constant_field_types and function
+       insn_field_is_constant.
+       (gen_entry_find_opcode_field): Remove #if 0'd code.
+       * ld-insn.c (parse_insn_model_record): Remove #if 0'd code.
+       * misc.h (STRDUP, STRNDUP): Remove #if 0'd macros.
+
 2011-02-14  Mike Frysinger  <vapier@gentoo.org>
 
        * table.c (table_push): Change zfree to free.
index 52156952cec9931da01fea22e0176d59b8eae47b..3b36345577bf71b74966a959a5cef94cf5597156 100644 (file)
@@ -216,29 +216,6 @@ is_filtered_out (filter *filters, const char *flags)
 }
 
 
-#if 0
-int
-it_is (const char *flag, const char *flags)
-{
-  int flag_len = strlen (flag);
-  while (*flags != '\0')
-    {
-      if (!strncmp (flags, flag, flag_len)
-         && (flags[flag_len] == ',' || flags[flag_len] == '\0'))
-       return 1;
-      while (*flags != ',')
-       {
-         if (*flags == '\0')
-           return 0;
-         flags++;
-       }
-      flags++;
-    }
-  return 0;
-}
-#endif
-
-
 char *
 filter_next (filter *set, char *member)
 {
@@ -294,12 +271,7 @@ main (int argc, char **argv)
 
   /* dump various info */
   l = lf_open ("-", "stdout", lf_omit_references, lf_is_text, "tmp-filter");
-#if 0
-  if (is_filtered_out (argv[1], superset))
-    lf_printf (l, "excluded\n");
-  else
-    lf_printf (l, "included\n");
-#endif
+
   /* subset */
   {
     dump_filter (l, "{", subset, " }");
index dd3a46a55bc288d9698958b8d075d7f0246e812d..2e9ec7cbf2fbf2b27f1e528e08ba9a155e6e03c0 100644 (file)
@@ -333,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,
@@ -754,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;
        }
     }
index 1d4f6314dea76dc81c2f17fbe170ca4bd2b98d03..cb5ae54ece4a04631383915ae4ebd00d97320f8f 100644 (file)
@@ -706,327 +706,6 @@ print_idecode_body (lf *file, gen_entry *table, const char *result)
 
 /****************************************************************/
 
-#if 0
-static void
-print_jump (lf *file, int is_tail)
-{
-  if (is_tail)
-    {
-      lf_putstr (file, "if (keep_running != NULL && !*keep_running)\n");
-      lf_putstr (file, "  cpu_halt(cpu, nia, was_continuing, 0/*na*/);\n");
-    }
-
-  if (!options.generate_smp)
-    {
-      lf_putstr (file, "if (WITH_EVENTS) {\n");
-      lf_putstr (file, "  if (event_queue_tick(events)) {\n");
-      lf_putstr (file, "    cpu_set_program_counter(cpu, nia);\n");
-      lf_putstr (file, "    event_queue_process(events);\n");
-      lf_putstr (file, "    nia = cpu_get_program_counter(cpu);\n");
-      lf_putstr (file, "  }\n");
-      lf_putstr (file, "}\n");
-    }
-
-  if (options.generate_smp)
-    {
-      if (is_tail)
-       {
-         lf_putstr (file, "cpu_set_program_counter(cpu, nia);\n");
-       }
-      lf_putstr (file, "if (WITH_EVENTS) {\n");
-      lf_putstr (file, "  current_cpu += 1;\n");
-      lf_putstr (file, "  if (current_cpu >= nr_cpus) {\n");
-      lf_putstr (file, "    if (event_queue_tick(events)) {\n");
-      lf_putstr (file, "      event_queue_process(events);\n");
-      lf_putstr (file, "    }\n");
-      lf_putstr (file, "    current_cpu = 0;\n");
-      lf_putstr (file, "  }\n");
-      lf_putstr (file, "}\n");
-      lf_putstr (file, "else {\n");
-      lf_putstr (file, "  current_cpu = (current_cpu + 1) % nr_cpus;\n");
-      lf_putstr (file, "}\n");
-      lf_putstr (file, "cpu = cpus[current_cpu];\n");
-      lf_putstr (file, "nia = cpu_get_program_counter(cpu);\n");
-    }
-
-  if (options.gen.icache)
-    {
-      lf_putstr (file, "cache_entry = cpu_icache_entry(cpu, 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 idecode;\n");
-    }
-
-}
-#endif
-
-
-
-#if 0
-static void
-print_jump_insn (lf *file,
-                insn_entry * instruction,
-                insn_bits * expanded_bits,
-                opcode_field *opcodes, cache_entry *cache_rules)
-{
-
-  /* what we are for the moment */
-  lf_printf (file, "\n");
-  print_my_defines (file, expanded_bits, instruction->name);
-
-  /* output the icache entry */
-  if (options.gen.icache)
-    {
-      lf_printf (file, "\n");
-      lf_indent (file, -1);
-      print_function_name (file,
-                          instruction->name,
-                          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, opcodes);
-      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,
-                          expanded_bits, function_name_prefix_semantics);
-      lf_printf (file, ";\n");
-      if (options.gen.semantic_icache)
-       {
-         print_semantic_body (file, instruction, expanded_bits, opcodes);
-         print_jump (file, 1 /*is-tail */ );
-       }
-      else
-       {
-         lf_printf (file, "/* goto ");
-         print_function_name (file,
-                              instruction->name,
-                              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,
-                      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, opcodes);
-  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,
-                      insn_entry * insn, int depth, void *data)
-{
-  cache_entry *cache_rules = (cache_entry *) data;
-  if (options.generate_expanded_instructions)
-    {
-      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->words[0]->insn,
-                      entry->expanded_bits, entry->opcode, cache_rules);
-    }
-  else
-    {
-      print_jump_insn (file,
-                      instruction->words[0]->insn, NULL, NULL, cache_rules);
-    }
-}
-#endif
-
-#if 0
-static void
-print_jump_internal_function (lf *file,
-                             gen_entry *table,
-                             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,
-                          (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);
-      print_sim_engine_abort (file, "Internal function must longjump");
-      lf_indent (file, -2);
-      lf_printf (file, "}\n");
-    }
-}
-#endif
-
-
-
-#if 0
-static void
-print_jump_until_stop_body (lf *file,
-                           insn_table *table, cache_table * 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, "sim_cpu *cpu = NULL;\n");
-  lf_putstr (file, "unsigned_word nia = -1;\n");
-  lf_putstr (file, "instruction_word instruction = 0;\n");
-  if ((code & generate_with_icache))
-    {
-      lf_putstr (file, "idecode_cache *cache_entry = NULL;\n");
-    }
-  if (generate_smp)
-    {
-      lf_putstr (file, "int current_cpu = -1;\n");
-    }
-
-  /* all the switches and tables - they know about jumping */
-  print_idecode_lookups (file, table, cache_rules);
-
-  /* start the simulation up */
-  if ((code & generate_with_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(cpus[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 (!generate_smp)
-    {
-      lf_putstr (file, "cpu = cpus[0];\n");
-      lf_putstr (file, "nia = cpu_get_program_counter(cpu);\n");
-    }
-  else
-    {
-      lf_putstr (file, "current_cpu = psim_last_cpu(system);\n");
-    }
-
-  if (!(code & generate_with_icache))
-    {
-      lf_printf (file, "\n");
-      lf_indent (file, -1);
-      lf_printf (file, "idecode:\n");
-      lf_indent (file, +1);
-    }
-
-  print_jump (file, 0 /*is_tail */ );
-
-  if ((code & generate_with_icache))
-    {
-      lf_indent (file, -1);
-      lf_printf (file, "cache_miss:\n");
-      lf_indent (file, +1);
-    }
-
-  lf_putstr (file, "instruction\n");
-  lf_putstr (file, "  = vm_instruction_map_read(cpu_instruction_map(cpu),\n");
-  lf_putstr (file, "                            cpu, nia);\n");
-  print_idecode_body (file, table, "/*IGORE*/");
-
-  /* print out a table of all the internals functions */
-  insn_table_traverse_function (table,
-                               file, NULL, print_jump_internal_function);
-
-  /* print out a table of all the instructions */
-  if (generate_expanded_instructions)
-    insn_table_traverse_tree (table, file, cache_rules, 1, NULL,       /* start */
-                             print_jump_definition,    /* leaf */
-                             NULL,     /* end */
-                             NULL);    /* padding */
-  else
-    insn_table_traverse_insn (table,
-                             file, cache_rules, print_jump_definition);
-  lf_indent (file, -2);
-  lf_printf (file, "}\n");
-}
-#endif
-
-/****************************************************************/
-
-
-
 /* Output code to do any final checks on the decoded instruction.
    This includes things like verifying any on decoded fields have the
    correct value and checking that (for floating point) floating point
index fae1ebb3f6d6aefd74fa80370730a95cd0a5a530..e5e6570a70716a6c4d4d6de3aa82226d6f4d5ac4 100644 (file)
 #endif
 
 
-#if 0
-static void
-model_c_or_h_data (insn_table *table, lf *file, table_entry *data)
-{
-  if (data->annex)
-    {
-      table_entry_print_cpp_line_nr (file, data->annex_line);
-      lf_print__c_code (file, data->annex);
-      lf_print__internal_reference (file);
-      lf_printf (file, "\n");
-    }
-}
-
-static void
-model_c_or_h_function (insn_table *entry,
-                      lf *file, table_entry *function, char *prefix)
-{
-  if (function->fields[function_type] == NULL
-      || function->fields[function_type][0] == '\0')
-    {
-      error ("Model function type not specified for %s",
-            function->fields[function_name]);
-    }
-  lf_printf (file, "\n");
-  lf_print_function_type (file, function->fields[function_type], prefix, " ");
-  lf_printf (file, "%s\n(%s);\n",
-            function->fields[function_name],
-            function->fields[function_param]);
-  lf_printf (file, "\n");
-}
-
-void
-gen_model_h (insn_table *table, lf *file)
-{
-  insn *insn_ptr;
-  model *model_ptr;
-  insn *macro;
-  char *name;
-  int model_create_p = 0;
-  int model_init_p = 0;
-  int model_halt_p = 0;
-  int model_mon_info_p = 0;
-  int model_mon_info_free_p = 0;
-
-  for (macro = model_macros; macro; macro = macro->next)
-    {
-      model_c_or_h_data (table, file, macro->file_entry);
-    }
-
-  lf_printf (file, "typedef enum _model_enum {\n");
-  lf_printf (file, "  MODEL_NONE,\n");
-  for (model_ptr = models; model_ptr; model_ptr = model_ptr->next)
-    {
-      lf_printf (file, "  MODEL_%s,\n", model_ptr->name);
-    }
-  lf_printf (file, "  nr_models\n");
-  lf_printf (file, "} model_enum;\n");
-  lf_printf (file, "\n");
-
-  lf_printf (file, "#define DEFAULT_MODEL MODEL_%s\n",
-            (models) ? models->name : "NONE");
-  lf_printf (file, "\n");
-
-  lf_printf (file, "typedef struct _model_data model_data;\n");
-  lf_printf (file, "typedef struct _model_time model_time;\n");
-  lf_printf (file, "\n");
-
-  lf_printf (file, "extern model_enum current_model;\n");
-  lf_printf (file, "extern const char *model_name[ (int)nr_models ];\n");
-  lf_printf (file,
-            "extern const char *const *const model_func_unit_name[ (int)nr_models ];\n");
-  lf_printf (file,
-            "extern const model_time *const model_time_mapping[ (int)nr_models ];\n");
-  lf_printf (file, "\n");
-
-  for (insn_ptr = model_functions; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_or_h_function (table, file, insn_ptr->file_entry,
-                            "INLINE_MODEL");
-      name = insn_ptr->file_entry->fields[function_name];
-      if (strcmp (name, "model_create") == 0)
-       model_create_p = 1;
-      else if (strcmp (name, "model_init") == 0)
-       model_init_p = 1;
-      else if (strcmp (name, "model_halt") == 0)
-       model_halt_p = 1;
-      else if (strcmp (name, "model_mon_info") == 0)
-       model_mon_info_p = 1;
-      else if (strcmp (name, "model_mon_info_free") == 0)
-       model_mon_info_free_p = 1;
-    }
-
-  if (!model_create_p)
-    {
-      lf_print_function_type (file, "model_data *", "INLINE_MODEL", " ");
-      lf_printf (file, "model_create\n");
-      lf_printf (file, "(sim_cpu *cpu);\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_init_p)
-    {
-      lf_print_function_type (file, "void", "INLINE_MODEL", " ");
-      lf_printf (file, "model_init\n");
-      lf_printf (file, "(model_data *model_ptr);\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_halt_p)
-    {
-      lf_print_function_type (file, "void", "INLINE_MODEL", " ");
-      lf_printf (file, "model_halt\n");
-      lf_printf (file, "(model_data *model_ptr);\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_mon_info_p)
-    {
-      lf_print_function_type (file, "model_print *", "INLINE_MODEL", " ");
-      lf_printf (file, "model_mon_info\n");
-      lf_printf (file, "(model_data *model_ptr);\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_mon_info_free_p)
-    {
-      lf_print_function_type (file, "void", "INLINE_MODEL", " ");
-      lf_printf (file, "model_mon_info_free\n");
-      lf_printf (file, "(model_data *model_ptr,\n");
-      lf_printf (file, " model_print *info_ptr);\n");
-      lf_printf (file, "\n");
-    }
-
-  lf_print_function_type (file, "void", "INLINE_MODEL", " ");
-  lf_printf (file, "model_set\n");
-  lf_printf (file, "(const char *name);\n");
-}
-
-/****************************************************************/
-
-typedef struct _model_c_passed_data model_c_passed_data;
-struct _model_c_passed_data
-{
-  lf *file;
-  model *model_ptr;
-};
-
-static void
-model_c_insn (insn_table *entry,
-             lf *phony_file, void *data, insn * instruction, int depth)
-{
-  model_c_passed_data *data_ptr = (model_c_passed_data *) data;
-  lf *file = data_ptr->file;
-  char *current_name = data_ptr->model_ptr->printable_name;
-  table_model_entry *model_ptr = instruction->file_entry->model_first;
-
-  while (model_ptr)
-    {
-      if (model_ptr->fields[insn_model_name] == current_name)
-       {
-         lf_printf (file, "  { %-*s },  /* %s */\n",
-                    max_model_fields_len,
-                    model_ptr->fields[insn_model_fields],
-                    instruction->file_entry->fields[insn_name]);
-         return;
-       }
-
-      model_ptr = model_ptr->next;
-    }
-
-  lf_printf (file, "  { %-*s },  /* %s */\n",
-            max_model_fields_len,
-            data_ptr->model_ptr->insn_default,
-            instruction->file_entry->fields[insn_name]);
-}
-
-static void
-model_c_function (insn_table *table,
-                 lf *file, table_entry *function, const char *prefix)
-{
-  if (function->fields[function_type] == NULL
-      || function->fields[function_type][0] == '\0')
-    {
-      error ("Model function return type not specified for %s",
-            function->fields[function_name]);
-    }
-  else
-    {
-      lf_printf (file, "\n");
-      lf_print_function_type (file, function->fields[function_type], prefix,
-                             "\n");
-      lf_printf (file, "%s(%s)\n", function->fields[function_name],
-                function->fields[function_param]);
-    }
-  lf_printf (file, "{\n");
-  if (function->annex)
-    {
-      lf_indent (file, +2);
-      table_entry_print_cpp_line_nr (file, function->annex_line);
-      lf_print__c_code (file, function->annex);
-      lf_indent (file, -2);
-    }
-  lf_printf (file, "}\n");
-  lf_print__internal_reference (file);
-  lf_printf (file, "\n");
-}
-
-void
-gen_model_c (insn_table *table, lf *file)
-{
-  insn *insn_ptr;
-  model *model_ptr;
-  char *name;
-  int model_create_p = 0;
-  int model_init_p = 0;
-  int model_halt_p = 0;
-  int model_mon_info_p = 0;
-  int model_mon_info_free_p = 0;
-
-  lf_printf (file, "\n");
-  lf_printf (file, "#include \"cpu.h\"\n");
-  lf_printf (file, "#include \"mon.h\"\n");
-  lf_printf (file, "\n");
-  lf_printf (file, "#ifdef HAVE_STDLIB_H\n");
-  lf_printf (file, "#include <stdlib.h>\n");
-  lf_printf (file, "#endif\n");
-  lf_printf (file, "\n");
-
-  for (insn_ptr = model_data; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_or_h_data (table, file, insn_ptr->file_entry);
-    }
-
-  for (insn_ptr = model_static; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_or_h_function (table, file, insn_ptr->file_entry,
-                            "/*h*/STATIC");
-    }
-
-  for (insn_ptr = model_internal; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_or_h_function (table, file, insn_ptr->file_entry,
-                            "STATIC_INLINE_MODEL");
-    }
-
-  for (insn_ptr = model_static; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_function (table, file, insn_ptr->file_entry, "/*c*/STATIC");
-    }
-
-  for (insn_ptr = model_internal; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_function (table, file, insn_ptr->file_entry,
-                       "STATIC_INLINE_MODEL");
-    }
-
-  for (insn_ptr = model_functions; insn_ptr; insn_ptr = insn_ptr->next)
-    {
-      model_c_function (table, file, insn_ptr->file_entry, "INLINE_MODEL");
-      name = insn_ptr->file_entry->fields[function_name];
-      if (strcmp (name, "model_create") == 0)
-       model_create_p = 1;
-      else if (strcmp (name, "model_init") == 0)
-       model_init_p = 1;
-      else if (strcmp (name, "model_halt") == 0)
-       model_halt_p = 1;
-      else if (strcmp (name, "model_mon_info") == 0)
-       model_mon_info_p = 1;
-      else if (strcmp (name, "model_mon_info_free") == 0)
-       model_mon_info_free_p = 1;
-    }
-
-  if (!model_create_p)
-    {
-      lf_print_function_type (file, "model_data *", "INLINE_MODEL", "\n");
-      lf_printf (file, "model_create(sim_cpu *cpu)\n");
-      lf_printf (file, "{\n");
-      lf_printf (file, "  return (model_data *)0;\n");
-      lf_printf (file, "}\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_init_p)
-    {
-      lf_print_function_type (file, "void", "INLINE_MODEL", "\n");
-      lf_printf (file, "model_init(model_data *model_ptr)\n");
-      lf_printf (file, "{\n");
-      lf_printf (file, "}\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_halt_p)
-    {
-      lf_print_function_type (file, "void", "INLINE_MODEL", "\n");
-      lf_printf (file, "model_halt(model_data *model_ptr)\n");
-      lf_printf (file, "{\n");
-      lf_printf (file, "}\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_mon_info_p)
-    {
-      lf_print_function_type (file, "model_print *", "INLINE_MODEL", "\n");
-      lf_printf (file, "model_mon_info(model_data *model_ptr)\n");
-      lf_printf (file, "{\n");
-      lf_printf (file, "  return (model_print *)0;\n");
-      lf_printf (file, "}\n");
-      lf_printf (file, "\n");
-    }
-
-  if (!model_mon_info_free_p)
-    {
-      lf_print_function_type (file, "void", "INLINE_MODEL", "\n");
-      lf_printf (file, "model_mon_info_free(model_data *model_ptr,\n");
-      lf_printf (file, "                    model_print *info_ptr)\n");
-      lf_printf (file, "{\n");
-      lf_printf (file, "}\n");
-      lf_printf (file, "\n");
-    }
-
-  lf_printf (file, "/* Insn functional unit info */\n");
-  for (model_ptr = models; model_ptr; model_ptr = model_ptr->next)
-    {
-      model_c_passed_data data;
-
-      lf_printf (file, "static const model_time model_time_%s[] = {\n",
-                model_ptr->name);
-      data.file = file;
-      data.model_ptr = model_ptr;
-      insn_table_traverse_insn (table, NULL, (void *) &data, model_c_insn);
-
-      lf_printf (file, "};\n");
-      lf_printf (file, "\n");
-      lf_printf (file, "\f\n");
-    }
-
-  lf_printf (file, "#ifndef _INLINE_C_\n");
-  lf_printf (file,
-            "const model_time *const model_time_mapping[ (int)nr_models ] = {\n");
-  lf_printf (file, "  (const model_time *const)0,\n");
-  for (model_ptr = models; model_ptr; model_ptr = model_ptr->next)
-    {
-      lf_printf (file, "  model_time_%s,\n", model_ptr->name);
-    }
-  lf_printf (file, "};\n");
-  lf_printf (file, "#endif\n");
-  lf_printf (file, "\n");
-
-  lf_printf (file, "\f\n");
-  lf_printf (file, "/* map model enumeration into printable string */\n");
-  lf_printf (file, "#ifndef _INLINE_C_\n");
-  lf_printf (file, "const char *model_name[ (int)nr_models ] = {\n");
-  lf_printf (file, "  \"NONE\",\n");
-  for (model_ptr = models; model_ptr; model_ptr = model_ptr->next)
-    {
-      lf_printf (file, "  \"%s\",\n", model_ptr->printable_name);
-    }
-  lf_printf (file, "};\n");
-  lf_printf (file, "#endif\n");
-  lf_printf (file, "\n");
-
-  lf_print_function_type (file, "void", "INLINE_MODEL", "\n");
-  lf_printf (file, "model_set(const char *name)\n");
-  lf_printf (file, "{\n");
-  if (models)
-    {
-      lf_printf (file, "  model_enum model;\n");
-      lf_printf (file,
-                "  for(model = MODEL_%s; model < nr_models; model++) {\n",
-                models->name);
-      lf_printf (file, "    if(strcmp(name, model_name[model]) == 0) {\n");
-      lf_printf (file, "      current_model = model;\n");
-      lf_printf (file, "      return;\n");
-      lf_printf (file, "    }\n");
-      lf_printf (file, "  }\n");
-      lf_printf (file, "\n");
-      lf_printf (file,
-                "  error(\"Unknown model '%%s', Models which are known are:%%s\n\",\n");
-      lf_printf (file, "        name,\n");
-      lf_printf (file, "        \"");
-      for (model_ptr = models; model_ptr; model_ptr = model_ptr->next)
-       {
-         lf_printf (file, "\\n\\t%s", model_ptr->printable_name);
-       }
-      lf_printf (file, "\");\n");
-    }
-  else
-    {
-      lf_printf (file, "  error(\"No models are currently known about\");\n");
-    }
-
-  lf_printf (file, "}\n");
-}
-
-#endif
-
-
-
 void
 gen_model_h (lf *file, insn_table *table)
 {
index 3db694e39ef493df30cabc5610abf604df9d3daa..5c1b4be52d09c215565bf37879da0c64fa2aa32b 100644 (file)
@@ -555,48 +555,6 @@ make_gen_tables (insn_table *isa, decode_table *rules)
 
 /****************************************************************/
 
-#if 0
-typedef enum
-{
-  field_is_not_constant = 0,
-  field_constant_int = 1,
-  field_constant_reserved = 2,
-  field_constant_string = 3
-}
-constant_field_types;
-
-static constant_field_types
-insn_field_is_constant (insn_field * field, decode_table *rule)
-{
-  switch (field->type)
-    {
-    case insn_field_int:
-      /* field is an integer */
-      return field_constant_int;
-    case insn_field_reserved:
-      /* field is `/' and treating that as a constant */
-      if (rule->with_zero_reserved)
-       return field_constant_reserved;
-      else
-       return field_is_not_constant;
-    case insn_field_wild:
-      return field_is_not_constant;    /* never constant */
-    case insn_field_string:
-      /* field, though variable, is on the list of forced constants */
-      if (filter_is_member (rule->constant_field_names, field->val_string))
-       return field_constant_string;
-      else
-       return field_is_not_constant;
-    }
-  ERROR ("Internal error");
-  return field_is_not_constant;
-}
-#endif
-
-
-/****************************************************************/
-
-
 /* Is the bit, according to the decode rule, identical across all the
    instructions? */
 static int
@@ -766,75 +724,6 @@ gen_entry_find_opcode_field (insn_list *insns,
        break;
     }
 
-
-#if 0
-  for (entry = insns; entry != NULL; entry = entry->next)
-    {
-      insn_word_entry *fields = entry->insn->word[rule->word_nr];
-      opcode_field new_opcode;
-
-      ASSERT (fields != NULL);
-
-      /* find a start point for the opcode field */
-      new_opcode.first = rule->first;
-      while (new_opcode.first <= rule->last
-            && (!string_only
-                ||
-                (insn_field_is_constant (fields->bit[new_opcode.first], rule)
-                 != field_constant_string)) && (string_only
-                                                ||
-                                                (insn_field_is_constant
-                                                 (fields->
-                                                  bit[new_opcode.first],
-                                                  rule) ==
-                                                 field_is_not_constant)))
-       {
-         int new_first = fields->bit[new_opcode.first]->last + 1;
-         ASSERT (new_first > new_opcode.first);
-         new_opcode.first = new_first;
-       }
-      ASSERT (new_opcode.first > rule->last
-             || (string_only
-                 && insn_field_is_constant (fields->bit[new_opcode.first],
-                                            rule) == field_constant_string)
-             || (!string_only
-                 && insn_field_is_constant (fields->bit[new_opcode.first],
-                                            rule)));
-
-      /* find the end point for the opcode field */
-      new_opcode.last = rule->last;
-      while (new_opcode.last >= rule->first
-            && (!string_only
-                || insn_field_is_constant (fields->bit[new_opcode.last],
-                                           rule) != field_constant_string)
-            && (string_only
-                || !insn_field_is_constant (fields->bit[new_opcode.last],
-                                            rule)))
-       {
-         int new_last = fields->bit[new_opcode.last]->first - 1;
-         ASSERT (new_last < new_opcode.last);
-         new_opcode.last = new_last;
-       }
-      ASSERT (new_opcode.last < rule->first
-             || (string_only
-                 && insn_field_is_constant (fields->bit[new_opcode.last],
-                                            rule) == field_constant_string)
-             || (!string_only
-                 && insn_field_is_constant (fields->bit[new_opcode.last],
-                                            rule)));
-
-      /* now see if our current opcode needs expanding to include the
-         interesting fields within this instruction */
-      if (new_opcode.first <= rule->last
-         && curr_opcode.first > new_opcode.first)
-       curr_opcode.first = new_opcode.first;
-      if (new_opcode.last >= rule->first
-         && curr_opcode.last < new_opcode.last)
-       curr_opcode.last = new_opcode.last;
-
-    }
-#endif
-
   /* did the final opcode field end up being empty? */
   if (curr_opcode.first > curr_opcode.last)
     {
index 6c1d49609e983f1c0fc5105784e7ebb23e205b23..86506eabedc2f4c8de20d90ba02e1de520c6976a 100644 (file)
@@ -874,13 +874,6 @@ parse_insn_model_record (table *file,
          filter_parse (&insn->processors, name);
        }
     }
-#if 0
-  /* for some reason record the max length of any
-     function unit field */
-  int len = strlen (insn_model_ptr->field[insn_model_fields]);
-  if (model->max_model_fields_len < len)
-    model->max_model_fields_len = len;
-#endif
   /* link it in */
   last_insn_model = &insn->models;
   while ((*last_insn_model) != NULL)
index 808570a349de342fde94d685c03564fe97fbcbeb..76a29b6ce6dd338b913cb6d4f11d968342910961 100644 (file)
@@ -110,10 +110,6 @@ do { \
 
 #define ZALLOC(TYPE) ((TYPE*) zalloc (sizeof(TYPE)))
 #define NZALLOC(TYPE,N) ((TYPE*) zalloc (sizeof(TYPE) * (N)))
-#if 0
-#define STRDUP(STRING) (strcpy (zalloc (strlen (STRING) + 1), (STRING)))
-#define STRNDUP(STRING,LEN) (strncpy (zalloc ((LEN) + 1), (STRING), (LEN)))
-#endif
 
 extern void *zalloc (long size);