]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* tic80-opc.c (tic80_symbol_to_value): Changed to accept
authorFred Fish <fnf@specifix.com>
Mon, 10 Feb 1997 17:16:28 +0000 (17:16 +0000)
committerFred Fish <fnf@specifix.com>
Mon, 10 Feb 1997 17:16:28 +0000 (17:16 +0000)
a symbol class that restricts translation to just that
class (general register, condition code, etc).

opcodes/ChangeLog
opcodes/tic80-opc.c

index 771a9964bf576d5d17eadf7fd929cdd2c3982ae7..3aa9b2d8756accdbe03d6622952ba393dce2c72c 100644 (file)
@@ -1,4 +1,10 @@
 start-sanitize-tic80
+Mon Feb 10 10:12:41 1997  Fred Fish  <fnf@cygnus.com>
+
+       * tic80-opc.c (tic80_symbol_to_value): Changed to accept
+       a symbol class that restricts translation to just that
+       class (general register, condition code, etc).
+
 Thu Feb  6 17:34:09 1997  Fred Fish  <fnf@cygnus.com>
 
        * tic80-opc.c (tic80_operands): Add REG_0_E, REG_22_E,
index 25a03f3e4aa4268bc63e06eeecbd9dfe03d64bf1..cc27b87d218a7e86eaaa4c6e056208e6356c8f06 100644 (file)
@@ -202,16 +202,29 @@ const struct predefined_symbol tic80_predefined_symbols[] =
 
 const int tic80_num_predefined_symbols = sizeof (tic80_predefined_symbols) / sizeof (struct predefined_symbol);
 
-/* This function takes a predefined symbol name in NAME and translates
-   it to a numeric value, which it returns.  If no translation is
-   possible, it returns -1, a value not used by any predefined
-   symbol. Note that the predefined symbol array is presorted case
-   independently by name. */
+/* This function takes a predefined symbol name in NAME, symbol class
+   in CLASS, and translates it to a numeric value, which it returns.
+
+   If CLASS is zero, any symbol that matches NAME is translated.  If
+   CLASS is non-zero, then only a symbol that has class CLASS is
+   matched.
+
+   If no translation is possible, it returns -1, a value not used by
+   any predefined symbol. Note that the predefined symbol array is
+   presorted case independently by name.
+
+   This function is implemented with the assumption that there are no
+   duplicate names in the predefined symbol array, which happens to be
+   true at the moment.
+
+ */
 
 int
-tic80_symbol_to_value (name)
+tic80_symbol_to_value (name, class)
      char *name;
+     int class;
 {
+  const struct predefined_symbol *pdsp;
   int low = 0;
   int middle;
   int high = tic80_num_predefined_symbols - 1;
@@ -232,7 +245,12 @@ tic80_symbol_to_value (name)
        }
       else 
        {
-         rtnval = tic80_predefined_symbols[middle].value;
+         pdsp = &tic80_predefined_symbols[middle];
+         if ((class == 0) || (class & pdsp -> value))
+           {
+             rtnval = pdsp -> value;
+           }
+         /* For now we assume that there are no duplicate names */
          break;
        }
     }