* arm-tdep.c (arm_make_stub_cache, arm_stub_this_id)
[deliverable/binutils-gdb.git] / opcodes / ia64-opc.c
index 84e38377ab75aeed419a3aa0a207b4df6e420f2a..03170fd8d95239249bf96e24ad8cf1ac745b0c4d 100644 (file)
@@ -1,5 +1,5 @@
 /* ia64-opc.c -- Functions to access the compacted opcode table
-   Copyright 1999, 2000 Free Software Foundation, Inc.
+   Copyright 1999, 2000, 2001, 2003, 2005 Free Software Foundation, Inc.
    Written by Bob Manson of Cygnus Solutions, <manson@cygnus.com>
 
    This file is part of GDB, GAS, and the GNU binutils.
 #include "ia64-asmtab.h"
 #include "ia64-asmtab.c"
 
+static void get_opc_prefix (const char **, char *);
+static short int find_string_ent (const char *);
+static short int find_main_ent (short int);
+static short int find_completer (short int, short int, const char *);
+static ia64_insn apply_completer (ia64_insn, int);
+static int extract_op_bits (int, int, int);
+static int extract_op (int, int *, unsigned int *);
+static int opcode_verify (ia64_insn, int, enum ia64_insn_type);
+static int locate_opcode_ent (ia64_insn, enum ia64_insn_type);
+static struct ia64_opcode *make_ia64_opcode
+  (ia64_insn, const char *, int, int);
+static struct ia64_opcode *ia64_find_matching_opcode
+  (const char *, short int);
+
 const struct ia64_templ_desc ia64_templ_desc[16] =
   {
     { 0, { IA64_UNIT_M, IA64_UNIT_I, IA64_UNIT_I }, "MII" },   /* 0 */
@@ -51,9 +65,7 @@ const struct ia64_templ_desc ia64_templ_desc[16] =
    of the opcode, or at the NUL character. */
 
 static void
-get_opc_prefix (ptr, dest)
-     const char **ptr;
-     char *dest;
+get_opc_prefix (const char **ptr, char *dest)
 {
   char *c = strchr (*ptr, '.');
   if (c != NULL)
@@ -75,8 +87,7 @@ get_opc_prefix (ptr, dest)
    STR; return -1 if one does not exist. */
 
 static short
-find_string_ent (str)
-     const char *str;
+find_string_ent (const char *str)
 {
   short start = 0;
   short end = sizeof (ia64_strings) / sizeof (const char *);
@@ -110,8 +121,7 @@ find_string_ent (str)
    return -1 if one does not exist. */
 
 static short
-find_main_ent (nameindex)
-     short nameindex;
+find_main_ent (short nameindex)
 {
   short start = 0;
   short end = sizeof (main_table) / sizeof (struct ia64_main_table);
@@ -149,11 +159,8 @@ find_main_ent (nameindex)
    MAIN_ENT (starting from PREV_COMPLETER) that matches NAME, or
    return -1 if one does not exist. */
 
-static short 
-find_completer (main_ent, prev_completer, name)
-     short main_ent;
-     short prev_completer;
-     const char *name;
+static short
+find_completer (short main_ent, short prev_completer, const char *name)
 {
   short name_index = find_string_ent (name);
 
@@ -186,9 +193,7 @@ find_completer (main_ent, prev_completer, name)
    return the result. */
 
 static ia64_insn
-apply_completer (opcode, completer_index)
-     ia64_insn opcode;
-     int completer_index;
+apply_completer (ia64_insn opcode, int completer_index)
 {
   ia64_insn mask = completer_table[completer_index].mask;
   ia64_insn bits = completer_table[completer_index].bits;
@@ -206,10 +211,7 @@ apply_completer (opcode, completer_index)
    first byte in OP_POINTER.) */
 
 static int
-extract_op_bits (op_pointer, bitoffset, bits)
-     int op_pointer;
-     int bitoffset;
-     int bits;
+extract_op_bits (int op_pointer, int bitoffset, int bits)
 {
   int res = 0;
 
@@ -245,10 +247,7 @@ extract_op_bits (op_pointer, bitoffset, bits)
    state entry in bits is returned. */
 
 static int
-extract_op (op_pointer, opval, op)
-     int op_pointer;
-     int *opval;
-     unsigned int *op;
+extract_op (int op_pointer, int *opval, unsigned int *op)
 {
   int oplen = 5;
 
@@ -303,16 +302,13 @@ extract_op (op_pointer, opval, op)
    PLACE matches OPCODE and is of type TYPE. */
 
 static int
-opcode_verify (opcode, place, type)
-     ia64_insn opcode;
-     int place;
-     enum ia64_insn_type type;
+opcode_verify (ia64_insn opcode, int place, enum ia64_insn_type type)
 {
   if (main_table[place].opcode_type != type)
     {
       return 0;
     }
-  if (main_table[place].flags 
+  if (main_table[place].flags
       & (IA64_OPCODE_F2_EQ_F3 | IA64_OPCODE_LEN_EQ_64MCNT))
     {
       const struct ia64_operand *o1, *o2;
@@ -350,9 +346,7 @@ opcode_verify (opcode, place, type)
    priority. */
 
 static int
-locate_opcode_ent (opcode, type)
-     ia64_insn opcode;
-     enum ia64_insn_type type;
+locate_opcode_ent (ia64_insn opcode, enum ia64_insn_type type)
 {
   int currtest[41];
   int bitpos[41];
@@ -371,7 +365,7 @@ locate_opcode_ent (opcode, type)
       unsigned int op;
       int currbitnum = bitpos[currstatenum];
       int oplen;
-      int opval[3];
+      int opval[3] = {0};
       int next_op;
       int currbit;
 
@@ -481,7 +475,7 @@ locate_opcode_ent (opcode, type)
 
               priority = ia64_dis_names[disent].priority;
 
-             if (opcode_verify (opcode, place, type) 
+             if (opcode_verify (opcode, place, type)
                   && priority > found_priority)
                {
                  break;
@@ -531,11 +525,7 @@ locate_opcode_ent (opcode, type)
 /* Construct an ia64_opcode entry based on OPCODE, NAME and PLACE. */
 
 static struct ia64_opcode *
-make_ia64_opcode (opcode, name, place, depind)
-     ia64_insn opcode;
-     const char *name;
-     int place;
-     int depind;
+make_ia64_opcode (ia64_insn opcode, const char *name, int place, int depind)
 {
   struct ia64_opcode *res =
     (struct ia64_opcode *) xmalloc (sizeof (struct ia64_opcode));
@@ -558,9 +548,7 @@ make_ia64_opcode (opcode, name, place, depind)
 /* Determine the ia64_opcode entry for the opcode specified by INSN
    and TYPE.  If a valid entry is not found, return NULL. */
 struct ia64_opcode *
-ia64_dis_opcode (insn, type)
-     ia64_insn insn;
-     enum ia64_insn_type type;
+ia64_dis_opcode (ia64_insn insn, enum ia64_insn_type type)
 {
   int disent = locate_opcode_ent (insn, type);
 
@@ -610,7 +598,7 @@ ia64_dis_opcode (insn, type)
        {
          abort ();
        }
-      return make_ia64_opcode (insn, name, place, 
+      return make_ia64_opcode (insn, name, place,
                                completer_table[ci].dependencies);
     }
 }
@@ -619,9 +607,7 @@ ia64_dis_opcode (insn, type)
    matches NAME.  Return NULL if one is not found. */
 
 static struct ia64_opcode *
-ia64_find_matching_opcode (name, place)
-     const char *name;
-     short place;
+ia64_find_matching_opcode (const char *name, short place)
 {
   char op[129];
   const char *suffix;
@@ -646,7 +632,7 @@ ia64_find_matching_opcode (name, place)
       short completer = -1;
 
       do {
-       if (suffix[0] == '\0')
+       if (suffix[0] == '\0')
          {
            completer = find_completer (place, completer, suffix);
          }
@@ -682,8 +668,7 @@ ia64_find_matching_opcode (name, place)
    release any resources used by the returned entry. */
 
 struct ia64_opcode *
-ia64_find_next_opcode (prev_ent)
-     struct ia64_opcode *prev_ent;
+ia64_find_next_opcode (struct ia64_opcode *prev_ent)
 {
   return ia64_find_matching_opcode (prev_ent->name,
                                    prev_ent->ent_index + 1);
@@ -696,8 +681,7 @@ ia64_find_next_opcode (prev_ent)
    release any resources used by the returned entry. */
 
 struct ia64_opcode *
-ia64_find_opcode (name)
-     const char *name;
+ia64_find_opcode (const char *name)
 {
   char op[129];
   const char *suffix;
@@ -727,16 +711,14 @@ ia64_find_opcode (name)
 
 /* Free any resources used by ENT. */
 void
-ia64_free_opcode (ent)
-     struct ia64_opcode *ent;
+ia64_free_opcode (struct ia64_opcode *ent)
 {
   free ((void *)ent->name);
   free (ent);
 }
 
 const struct ia64_dependency *
-ia64_find_dependency (index)
-  int index;
+ia64_find_dependency (int index)
 {
   index = DEP(index);
 
This page took 0.027168 seconds and 4 git commands to generate.