Don't add a space before `/*' when processing comments.
[deliverable/binutils-gdb.git] / opcodes / arc-dis.c
index 9868ae73756ad82d063ddb444b7e8b60220aa13f..03f13795275e66ecf1605933b6d54716499c0ae9 100644 (file)
@@ -1,5 +1,5 @@
 /* Instruction printing code for the ARC.
-   Copyright (C) 1994, 1995 Free Software Foundation, Inc. 
+   Copyright (C) 1994, 1995, 1997, 1998 Free Software Foundation, Inc. 
    Contributed by Doug Evans (dje@cygnus.com).
 
 This program is free software; you can redistribute it and/or modify
@@ -14,21 +14,17 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
+#include "sysdep.h"
 #include "dis-asm.h"
 #include "opcode/arc.h"
-#include "libelf.h"
+#include "elf-bfd.h"
 #include "elf/arc.h"
+#include "opintl.h"
 
 static int print_insn_arc_base_little PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_arc_host_little PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_arc_graphics_little PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_arc_audio_little PARAMS ((bfd_vma, disassemble_info *));
 static int print_insn_arc_base_big PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_arc_host_big PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_arc_graphics_big PARAMS ((bfd_vma, disassemble_info *));
-static int print_insn_arc_audio_big PARAMS ((bfd_vma, disassemble_info *));
 
 static int print_insn PARAMS ((bfd_vma, disassemble_info *, int, int));
 
@@ -42,7 +38,7 @@ print_insn (pc, info, mach, big_p)
      int mach;
      int big_p;
 {
-  const struct arc_opcode *opcode,*opcode_end;
+  const struct arc_opcode *opcode;
   bfd_byte buffer[4];
   void *stream = info->stream;
   fprintf_ftype func = info->fprintf_func;
@@ -73,8 +69,11 @@ print_insn (pc, info, mach, big_p)
 
   (*func) (stream, "%08lx\t", insn[0]);
 
-  opcode_end = arc_opcodes + arc_opcodes_count;
-  for (opcode = arc_opcodes; opcode < opcode_end; opcode++)
+  /* The instructions are stored in lists hashed by the insn code
+     (though we needn't care how they're hashed).  */
+
+  opcode = arc_opcode_lookup_dis (insn[0]);
+  for ( ; opcode != NULL; opcode = ARC_OPCODE_NEXT_DIS (opcode))
     {
       char *syn;
       int mods,invalid;
@@ -106,15 +105,19 @@ print_insn (pc, info, mach, big_p)
 
       for (syn = opcode->syntax; *syn; ++syn)
        {
+         int c;
+
          if (*syn != '%' || *++syn == '%')
            continue;
          mods = 0;
-         while (ARC_MOD_P (arc_operands[arc_operand_map[*syn]].flags))
+         c = *syn;
+         while (ARC_MOD_P (arc_operands[arc_operand_map[c]].flags))
            {
-             mods |= arc_operands[arc_operand_map[*syn]].flags & ARC_MOD_BITS;
+             mods |= arc_operands[arc_operand_map[c]].flags & ARC_MOD_BITS;
              ++syn;
+             c = *syn;
            }
-         operand = arc_operands + arc_operand_map[*syn];
+         operand = arc_operands + arc_operand_map[c];
          if (operand->extract)
            (*operand->extract) (insn, operand, mods,
                                 (const struct arc_operand_value **) NULL,
@@ -144,6 +147,8 @@ print_insn (pc, info, mach, big_p)
 
       for (syn = opcode->syntax; *syn; ++syn)
        {
+         int c;
+
          if (*syn != '%' || *++syn == '%')
            {
              (*func) (stream, "%c", *syn);
@@ -152,12 +157,14 @@ print_insn (pc, info, mach, big_p)
 
          /* We have an operand.  Fetch any special modifiers.  */
          mods = 0;
-         while (ARC_MOD_P (arc_operands[arc_operand_map[*syn]].flags))
+         c = *syn;
+         while (ARC_MOD_P (arc_operands[arc_operand_map[c]].flags))
            {
-             mods |= arc_operands[arc_operand_map[*syn]].flags & ARC_MOD_BITS;
+             mods |= arc_operands[arc_operand_map[c]].flags & ARC_MOD_BITS;
              ++syn;
+             c = *syn;
            }
-         operand = arc_operands + arc_operand_map[*syn];
+         operand = arc_operands + arc_operand_map[c];
 
          /* Extract the value from the instruction.  */
          opval = NULL;
@@ -222,7 +229,7 @@ print_insn (pc, info, mach, big_p)
       return got_limm_p ? 8 : 4;
     }
 
-  (*func) (stream, "*unknown*");
+  (*func) (stream, _("*unknown*"));
   return 4;
 }
 
@@ -240,12 +247,6 @@ arc_get_disassembler (mach, big_p)
     {
     case bfd_mach_arc_base:
       return big_p ? print_insn_arc_base_big : print_insn_arc_base_little;
-    case bfd_mach_arc_host:
-      return big_p ? print_insn_arc_host_big : print_insn_arc_host_little;
-    case bfd_mach_arc_graphics:
-      return big_p ? print_insn_arc_graphics_big : print_insn_arc_graphics_little;
-    case bfd_mach_arc_audio:
-      return big_p ? print_insn_arc_audio_big : print_insn_arc_audio_little;
     }
   return print_insn_arc_base_little;
 }
@@ -258,30 +259,6 @@ print_insn_arc_base_little (pc, info)
   return print_insn (pc, info, bfd_mach_arc_base, 0);
 }
 
-static int
-print_insn_arc_host_little (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  return print_insn (pc, info, bfd_mach_arc_host, 0);
-}
-
-static int
-print_insn_arc_graphics_little (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  return print_insn (pc, info, bfd_mach_arc_graphics, 0);
-}
-
-static int
-print_insn_arc_audio_little (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  return print_insn (pc, info, bfd_mach_arc_audio, 0);
-}
-
 static int
 print_insn_arc_base_big (pc, info)
      bfd_vma pc;
@@ -289,27 +266,3 @@ print_insn_arc_base_big (pc, info)
 {
   return print_insn (pc, info, bfd_mach_arc_base, 1);
 }
-
-static int
-print_insn_arc_host_big (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  return print_insn (pc, info, bfd_mach_arc_host, 1);
-}
-
-static int
-print_insn_arc_graphics_big (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  return print_insn (pc, info, bfd_mach_arc_graphics, 1);
-}
-
-static int
-print_insn_arc_audio_big (pc, info)
-     bfd_vma pc;
-     disassemble_info *info;
-{
-  return print_insn (pc, info, bfd_mach_arc_audio, 1);
-}
This page took 0.025553 seconds and 4 git commands to generate.