]> Shamusworld >> Repos - rmac/blobdiff - riscasm.c
.equr overhaul part 5: enabled .equr for all registers for all architectures
[rmac] / riscasm.c
index 5681f354e5a1d480d7a97783a9f9f138e663d058..706cac8f10ae3bc80a99ecf3e6eb7369d3cf8e7d 100644 (file)
--- a/riscasm.c
+++ b/riscasm.c
@@ -201,9 +201,10 @@ static int EvaluateRegisterFromTokenStream(uint32_t fixup)
 {
        // Firstly, check to see if it's a register token and return that.  No
        // need to invoke expr() for easy cases like this.
-       if (*tok >= KW_R0 && *tok <= KW_R31)
+       int reg = *tok & 255;
+       if (reg >= KW_R0 && reg <= KW_R31)
        {
-               int reg = *tok - KW_R0;
+               reg -= KW_R0;
                tok++;
                return reg;
        }
@@ -230,12 +231,8 @@ static int EvaluateRegisterFromTokenStream(uint32_t fixup)
                return 0;
        }
 
-       // If we got a register in range (0-31), return it
-       if (eval <= 31)
-               return (int)eval;
-
-       // Otherwise, it's out of range & we flag an error
-       return error(reg_err);
+       // We shouldn't get here, that should not be legal
+       interror(9);
 }
 
 //
@@ -460,30 +457,6 @@ int GenerateRISCCode(int state)
                                return IllegalIndexedRegister(*tok);
                }
 
-               if (*tok == SYMBOL)
-               {
-                       sy = lookup(string[tok[1]], LABEL, 0);
-
-                       if (!sy)
-                       {
-                               error(reg_err);
-                               return ERROR;
-                       }
-
-                       if (sy->sattre & EQUATEDREG)
-                       {
-                               if ((tok[2] == '+') || (tok[2] == '-'))
-                               {
-                                       if ((sy->svalue & 0x1F) == 14 || (sy->svalue & 0x1F) == 15) {
-                                               indexed = (sy->svalue & 0x1F);
-                                               tok++;
-                                       }
-                                       else
-                                               return IllegalIndexedRegisterEqur(sy);
-                               }
-                       }
-               }
-
                if (!indexed)
                {
                        EVAL_REG_RETURN_IF_ERROR(reg1, FU_REGONE);
@@ -578,27 +551,6 @@ int GenerateRISCCode(int state)
                if (((*tok == KW_R14) || (*tok == KW_R15)) && (tok[1] != ')'))
                        indexed = *tok - KW_R0;
 
-               if (*tok == SYMBOL)
-               {
-                       sy = lookup(string[tok[1]], LABEL, 0);
-
-                       if (!sy)
-                       {
-                               error(reg_err);
-                               return ERROR;
-                       }
-
-                       if (sy->sattre & EQUATEDREG)
-                       {
-                               if (((sy->svalue & 0x1F) == 14 || (sy->svalue & 0x1F) == 15)
-                                       && (tok[2] != ')'))
-                               {
-                                       indexed = (sy->svalue & 0x1F);
-                                       tok++;
-                               }
-                       }
-               }
-
                if (!indexed)
                {
                        EVAL_REG_RETURN_IF_ERROR(reg2, FU_REGTWO);