/* The following are errors. */
ERROR_CREG_ILLEGAL = 0,
ERROR_REG_OVER_RANGE,
+ ERROR_FREG_OVER_RANGE,
+ ERROR_VREG_OVER_RANGE,
ERROR_GREG_ILLEGAL,
ERROR_802J_REG_OVER_RANGE,
ERROR_REG_FORMAT,
{
enum error_number err_num;
int opnum;
+ int arg_int;
const void *arg1;
const void *arg2;
} error_state;
/* This macro is used to set error number and arg1 in the global state. */
-#define SET_ERROR_NUMBER(err, msg) \
+#define SET_ERROR_STRING(err, msg) \
do { \
if (error_state.err_num > err) \
{ \
} \
} while (0)
+#define SET_ERROR_INTEGER(err, integer) \
+ do { \
+ if (error_state.err_num > err) \
+ { \
+ error_state.err_num = err; \
+ error_state.arg_int = integer; \
+ } \
+ } while (0)
/* Map error identifiers onto a format string, which will use
arg1 and arg2 from the global error state. */
{
{ERROR_CREG_ILLEGAL, "Operand %d error: control register is illegal."},
{ERROR_REG_OVER_RANGE, "Operand %d error: r%d register is over range."},
+ {ERROR_FREG_OVER_RANGE, "Operand %d error: vr%d register is over range."},
+ {ERROR_VREG_OVER_RANGE, "Operand %d error: vr%d register is out of range."},
{ERROR_GREG_ILLEGAL, "Operand %d error: general register is illegal."},
{ERROR_802J_REG_OVER_RANGE, "Operand %d register %s out of range (802j only has registers:0-15,23,24,25,30)"},
{ERROR_REG_FORMAT, "Operand %d error: %s."},
break;
case ERROR_OPERANDS_NUMBER:
case ERROR_IMM_POWER:
- as_bad (_(err_formats[err].fmt), (long)arg1);
+ as_bad (_(err_formats[err].fmt), error_state.arg_int);
break;
case ERROR_OFFSET_UNALIGNED:
- as_bad (_(err_formats[err].fmt), idx, (long)arg1);
+ as_bad (_(err_formats[err].fmt), idx, error_state.arg_int);
break;
case ERROR_RELOC_ILLEGAL:
case ERROR_BAD_END:
as_bad (_(err_formats[err].fmt), (char *)arg1);
break;
case ERROR_REG_OVER_RANGE:
- as_bad (_(err_formats[err].fmt), idx, (long) arg1);
+ case ERROR_FREG_OVER_RANGE:
+ case ERROR_VREG_OVER_RANGE:
+ as_bad (_(err_formats[err].fmt), idx, error_state.arg_int);
break;
case ERROR_802J_REG_OVER_RANGE:
case ERROR_REG_FORMAT:
lex_got (&insn_reloc, NULL);
if (e->X_op == O_absent)
- SET_ERROR_NUMBER (ERROR_MISSING_OPERAND, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_OPERAND, NULL);
new = input_line_pointer;
input_line_pointer = save;
if (*s == ']')
s++;
else
- SET_ERROR_NUMBER (ERROR_MISSING_RSQUARE_BRACKETS, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_RSQUARE_BRACKETS, NULL);
if (ep)
*ep = e;
}
else
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, "control");
+ SET_ERROR_STRING (ERROR_REG_OVER_RANGE, "control");
return FALSE;
}
if (*s == ',')
s++;
else
{
- SET_ERROR_NUMBER (ERROR_CREG_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_CREG_ILLEGAL, NULL);
return FALSE;
}
char *pS = s;
else
{
/* Error. Missing '>'. */
- SET_ERROR_NUMBER (ERROR_MISSING_RANGLE_BRACKETS, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_RANGLE_BRACKETS, NULL);
return FALSE;
}
expressionS e;
else
{
/* Error. Missing '<'. */
- SET_ERROR_NUMBER (ERROR_MISSING_LANGLE_BRACKETS, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_LANGLE_BRACKETS, NULL);
return FALSE;
}
}
else
{
- SET_ERROR_NUMBER (ERROR_CREG_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_CREG_ILLEGAL, NULL);
return FALSE;
}
}
/* CK801 register range is r0-r8 & r13-r15. */
if ((reg > 8 && reg < 13) || reg > 15)
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, reg);
+ SET_ERROR_STRING (ERROR_REG_OVER_RANGE, reg);
return -1;
}
}
/* CK802 register range is r0-r15 & r23-r25 & r30. */
if ((reg > 15 && reg < 23) || (reg > 25 && reg != 30))
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, reg);
+ SET_ERROR_STRING (ERROR_REG_OVER_RANGE, reg);
return -1;
}
}
else if (reg > 31 || reg < 0)
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, reg);
+ SET_ERROR_STRING (ERROR_REG_OVER_RANGE, reg);
return -1;
}
if (reg1 == -1 || (IS_CSKY_V1 (mach_flag) && (reg1 == 0 || reg1 == 15)))
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The first reg must not be r0/r15");
return FALSE;
}
if (**oper != '-')
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The operand format must be rx-ry");
return FALSE;
}
if (reg2 == -1 || (IS_CSKY_V1 (mach_flag) && reg1 == 15))
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The operand format must be r15 in C-SKY V1");
return FALSE;
}
{
if (reg2 < reg1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The operand format must be rx-ry (rx < ry)");
return FALSE;
}
if (reg1 == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The fpu register format is not recognized.");
return FALSE;
}
if (**oper != '-')
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The operand format must be vrx-vry/frx-fry.");
return FALSE;
}
if (reg2 == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The fpu register format is not recognized.");
return FALSE;
}
if (reg2 < reg1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The operand format must be rx-ry(rx < ry)");
return FALSE;
}
+
reg2 = reg2 - reg1;
+ if (reg2 > (int)0x3)
+ {
+ SET_ERROR_STRING(ERROR_REG_FORMAT, (void *)"vry-vrx is over range");
+ return FALSE;
+ }
reg2 <<= 4;
reg1 |= reg2;
csky_insn.val[csky_insn.idx++] = reg1;
reg1 = csky_get_reg_val (*oper, &len);
if (reg1 == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_LIST, NULL);
+ SET_ERROR_STRING (ERROR_REG_LIST, NULL);
return FALSE;
}
flag |= (1 << reg1);
reg2 = csky_get_reg_val (*oper, &len);
if (reg2 == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_LIST, NULL);
+ SET_ERROR_STRING (ERROR_REG_LIST, NULL);
return FALSE;
}
*oper += len;
if (reg1 > reg2)
{
- SET_ERROR_NUMBER (ERROR_REG_LIST, NULL);
+ SET_ERROR_STRING (ERROR_REG_LIST, NULL);
return FALSE;
}
while (reg2 >= reg1)
#define REGLIST_BITS 0x10038ff0
if (flag & ~(REGLIST_BITS))
{
- SET_ERROR_NUMBER (ERROR_REG_LIST, NULL);
+ SET_ERROR_STRING (ERROR_REG_LIST, NULL);
return FALSE;
}
/* Check r4-r11. */
list |= (1 << 8);
if (oprnd->mask == OPRND_MASK_0_4 && (list & ~OPRND_MASK_0_4))
{
- SET_ERROR_NUMBER (ERROR_REG_LIST, NULL);
+ SET_ERROR_STRING (ERROR_REG_LIST, NULL);
return FALSE;
}
csky_insn.val[csky_insn.idx++] = list;
reg = csky_get_reg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT, "The register must be r0-r31.");
+ SET_ERROR_STRING (ERROR_REG_FORMAT, "The register must be r0-r31.");
return FALSE;
}
*oper += len;
if ((*oper)[0] != '<' || (*oper)[1] != '<')
{
- SET_ERROR_NUMBER (ERROR_UNDEFINE,
+ SET_ERROR_STRING (ERROR_UNDEFINE,
"Operand format error; should be (rx, ry << n)");
return FALSE;
}
/* The immediate must be in [0, 3]. */
if (e.X_add_number < 0 || e.X_add_number > 3)
{
- SET_ERROR_NUMBER (ERROR_IMM_OVERFLOW, NULL);
+ SET_ERROR_STRING (ERROR_IMM_OVERFLOW, NULL);
return FALSE;
}
}
else
{
- SET_ERROR_NUMBER (ERROR_EXP_CONSTANT, NULL);
+ SET_ERROR_STRING (ERROR_EXP_CONSTANT, NULL);
return FALSE;
}
if (is_float)
}
static bfd_boolean
-is_imm_over_range (char **oper, int min, int max, int ext)
+is_imm_within_range (char **oper, int min, int max)
+{
+ expressionS e;
+ bfd_boolean ret = FALSE;
+ char *new_oper = parse_exp (*oper, &e);
+ if (e.X_op == O_constant)
+ {
+ ret = TRUE;
+ *oper = new_oper;
+ if (e.X_add_number < min || e.X_add_number > max)
+ {
+ ret = FALSE;
+ SET_ERROR_STRING (ERROR_IMM_OVERFLOW, NULL);
+ }
+ csky_insn.val[csky_insn.idx++] = e.X_add_number;
+ }
+
+ else
+ SET_ERROR_STRING(ERROR_IMM_ILLEGAL, NULL);
+
+ return ret;
+}
+
+static bfd_boolean
+is_imm_within_range_ext (char **oper, int min, int max, int ext)
{
expressionS e;
bfd_boolean ret = FALSE;
&& (e.X_add_number < min || e.X_add_number > max))
{
ret = FALSE;
- SET_ERROR_NUMBER (ERROR_IMM_OVERFLOW, NULL);
+ SET_ERROR_STRING (ERROR_IMM_OVERFLOW, NULL);
}
csky_insn.val[csky_insn.idx++] = e.X_add_number;
}
+ else
+ SET_ERROR_STRING(ERROR_IMM_ILLEGAL, NULL);
+
return ret;
}
static bfd_boolean
-is_oimm_over_range (char **oper, int min, int max)
+is_oimm_within_range (char **oper, int min, int max)
{
expressionS e;
bfd_boolean ret = FALSE;
if (e.X_add_number < min || e.X_add_number > max)
{
ret = FALSE;
- SET_ERROR_NUMBER (ERROR_IMM_OVERFLOW, NULL);
+ SET_ERROR_STRING (ERROR_IMM_OVERFLOW, NULL);
}
csky_insn.val[csky_insn.idx++] = e.X_add_number - 1;
}
}
i++;
}
- SET_ERROR_NUMBER (ERROR_OPCODE_PSRBIT, NULL);
+ SET_ERROR_STRING (ERROR_OPCODE_PSRBIT, NULL);
return FALSE;
}
return TRUE;
}
}
- SET_ERROR_NUMBER (ERROR_CPREG_ILLEGAL, *oper);
+ SET_ERROR_STRING (ERROR_CPREG_ILLEGAL, *oper);
return FALSE;
}
return TRUE;
}
}
- SET_ERROR_NUMBER (ERROR_CPREG_ILLEGAL, *oper);
+ SET_ERROR_STRING (ERROR_CPREG_ILLEGAL, *oper);
return FALSE;
}
i = csky_get_reg_val (*oper, &len);
if (i == -1)
{
- SET_ERROR_NUMBER (ERROR_GREG_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_GREG_ILLEGAL, NULL);
return FALSE;
}
*oper += len;
reg = csky_get_freg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
- "The fpu register format is not recognized.");
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
+ (void *)"The fpu register format is not recognized.");
return FALSE;
}
*oper += len;
csky_insn.opcode_end = *oper;
if (even && reg & 0x1)
{
- SET_ERROR_NUMBER (ERROR_EXP_EVEN_FREG, NULL);
+ SET_ERROR_STRING (ERROR_EXP_EVEN_FREG, NULL);
return FALSE;
}
csky_insn.val[csky_insn.idx++] = reg;
expressionS e;
*oper = parse_exp (*oper, &e);
if (e.X_op != O_constant)
+ {
/* Not a constant. */
+ SET_ERROR_STRING(ERROR_UNDEFINE, (void *)"Operand format is error. eg. \"ld rz, (rx, n)\"");
return FALSE;
+ }
else if (e.X_add_number < 0 || e.X_add_number >= max)
{
/* Out of range. */
- SET_ERROR_NUMBER (ERROR_IMM_OVERFLOW, NULL);
+ SET_ERROR_STRING(ERROR_IMM_OVERFLOW, NULL);
return FALSE;
}
if ((e.X_add_number % (1 << shift)) != 0)
{
/* Not aligned. */
- SET_ERROR_NUMBER (ERROR_OFFSET_UNALIGNED,
- (void *)"Operand format is error. eg. \"ld rz, (rx, n)\"");
+ SET_ERROR_INTEGER (ERROR_OFFSET_UNALIGNED, ((unsigned long)1 << shift));
return FALSE;
}
}
else
{
- SET_ERROR_NUMBER ((oprnd->type == OPRND_TYPE_BRACKET
+ SET_ERROR_STRING ((oprnd->type == OPRND_TYPE_BRACKET
? ERROR_MISSING_LBRACKET
: ERROR_MISSING_LANGLE_BRACKETS), NULL);
return FALSE;
*s = '\0';
else
{
- SET_ERROR_NUMBER ((oprnd->type == OPRND_TYPE_BRACKET
+ SET_ERROR_STRING ((oprnd->type == OPRND_TYPE_BRACKET
? ERROR_MISSING_RBRACKET
: ERROR_MISSING_RANGLE_BRACKETS), NULL);
return FALSE;
}
if (**oper == ',')
*oper += 1;
+ else if (**oper != '\0')
+ {
+ SET_ERROR_STRING (ERROR_MISSING_COMMA, NULL);
+ return FALSE;
+ }
+
if (get_operand_value (op, oper, &soprnd->subs[1]) == FALSE)
{
*s = rc;
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_GREG_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_GREG_ILLEGAL, NULL);
return FALSE;
}
else if ((oprnd->type == OPRND_TYPE_GREG0_7 && reg > 7)
|| (oprnd->type == OPRND_TYPE_GREG0_15 && reg > 15))
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, reg);
+ SET_ERROR_INTEGER (ERROR_REG_OVER_RANGE, reg);
return FALSE;
}
*oper += len;
|| (IS_CSKY_V1 (mach_flag)
&& (reg == V1_REG_SP || reg == V1_REG_LR)))
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, reg);
+ SET_ERROR_STRING (ERROR_REG_OVER_RANGE, reg);
return FALSE;
}
csky_insn.val[csky_insn.idx++] = reg;
csky_insn.val[csky_insn.idx++] = 0;
return TRUE;
}
- SET_ERROR_NUMBER (ERROR_OPCODE_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_OPCODE_ILLEGAL, NULL);
return FALSE;
case OPRND_TYPE_IMM_LDST:
return parse_ldst_imm (oper, op, oprnd);
case OPRND_TYPE_IMM_FLDST:
return parse_ldst_imm (oper, op, oprnd);
case OPRND_TYPE_IMM1b:
- return is_imm_over_range (oper, 0, 1, -1);
+ return is_imm_within_range (oper, 0, 1);
case OPRND_TYPE_IMM2b:
- return is_imm_over_range (oper, 0, 3, -1);
+ return is_imm_within_range (oper, 0, 3);
case OPRND_TYPE_IMM2b_JMPIX:
/* ck802j support jmpix16, but not support jmpix32. */
if (IS_CSKY_ARCH_802 (mach_flag)
&& (op->opcode & 0xffff0000) != 0)
{
- SET_ERROR_NUMBER (ERROR_OPCODE_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_OPCODE_ILLEGAL, NULL);
return FALSE;
}
*oper = parse_exp (*oper, &csky_insn.e1);
csky_insn.opcode_end = *oper;
if (csky_insn.e1.X_add_number & 0x7)
{
- SET_ERROR_NUMBER (ERROR_JMPIX_OVER_RANGE, NULL);
+ SET_ERROR_STRING (ERROR_JMPIX_OVER_RANGE, NULL);
return FALSE;
}
csky_insn.val[csky_insn.idx++]
}
return TRUE;
case OPRND_TYPE_IMM4b:
- return is_imm_over_range (oper, 0, 15, -1);
- break;
+ return is_imm_within_range (oper, 0, 15);
case OPRND_TYPE_IMM5b:
- return is_imm_over_range (oper, 0, 31, -1);
+ return is_imm_within_range (oper, 0, 31);
/* This type for "bgeni" in csky v1 ISA. */
case OPRND_TYPE_IMM5b_7_31:
- if (is_imm_over_range (oper, 0, 31, -1))
+ if (is_imm_within_range (oper, 0, 31))
{
int val = csky_insn.val[csky_insn.idx - 1];
/* immediate values of 0 -> 6 translate to movi. */
return FALSE;
case OPRND_TYPE_IMM5b_1_31:
- return is_imm_over_range (oper, 1, 31, -1);
+ return is_imm_within_range (oper, 1, 31);
case OPRND_TYPE_IMM5b_POWER:
- if (is_imm_over_range (oper, 1, (1u << 31) - 1, 1u << 31))
+ if (is_imm_within_range_ext (oper, 1, (1u << 31) - 1, 1u << 31))
{
int log;
int val = csky_insn.val[csky_insn.idx - 1];
/* This type for "mgeni" in csky v1 ISA. */
case OPRND_TYPE_IMM5b_7_31_POWER:
- if (is_imm_over_range (oper, 1, (1u << 31) - 1, 1u << 31))
+ if (is_imm_within_range_ext (oper, 1, (1u << 31) - 1, 1u << 31))
{
int log;
int val = csky_insn.val[csky_insn.idx - 1];
{
unsigned max_shift = IS_CSKY_V1 (mach_flag) ? 31 : 32;
- if (is_imm_over_range (oper, 1, max_shift, -1))
+ if (is_imm_within_range (oper, 1, max_shift))
{
int i = csky_insn.idx - 1;
csky_insn.val[i] = 32 - csky_insn.val[i];
case OPRND_TYPE_IMM5b_BMASKI:
/* For csky v1 bmask inst. */
- if (!is_imm_over_range (oper, 8, 31, 0))
+ if (!is_imm_within_range_ext (oper, 8, 31, 0))
{
unsigned int mask_val = csky_insn.val[csky_insn.idx - 1];
if (mask_val > 0 && mask_val < 8)
case OPRND_TYPE_IMM8b_BMASKI:
/* For csky v2 bmask, which will transfer to 16bits movi. */
- if (is_imm_over_range (oper, 1, 8, -1))
+ if (is_imm_within_range (oper, 1, 8))
{
unsigned int mask_val = csky_insn.val[csky_insn.idx - 1];
csky_insn.val[csky_insn.idx - 1] = (1 << mask_val) - 1;
}
return FALSE;
case OPRND_TYPE_OIMM4b:
- return is_oimm_over_range (oper, 1, 16);
+ return is_oimm_within_range (oper, 1, 16);
case OPRND_TYPE_OIMM5b:
- return is_oimm_over_range (oper, 1, 32);
+ return is_oimm_within_range (oper, 1, 32);
case OPRND_TYPE_OIMM5b_IDLY:
- if (is_imm_over_range (oper, 0, 32, -1))
+ if (is_imm_within_range (oper, 0, 32))
{
/* imm5b for idly n: 0<=n<4, imm5b=3; 4<=n<=32, imm5b=n-1. */
unsigned long imm = csky_insn.val[csky_insn.idx - 1];
/* For csky v2 bmask inst. */
case OPRND_TYPE_OIMM5b_BMASKI:
- if (!is_oimm_over_range (oper, 17, 32))
+ if (!is_oimm_within_range (oper, 17, 32))
{
int mask_val = csky_insn.val[csky_insn.idx - 1];
if (mask_val + 1 == 0)
}
return TRUE;
case OPRND_TYPE_IMM7b:
- return is_imm_over_range (oper, 0, 127, -1);
+ return is_imm_within_range (oper, 0, 127);
case OPRND_TYPE_IMM8b:
- return is_imm_over_range (oper, 0, 255, -1);
+ return is_imm_within_range (oper, 0, 255);
case OPRND_TYPE_IMM12b:
- return is_imm_over_range (oper, 0, 4095, -1);
+ return is_imm_within_range (oper, 0, 4095);
case OPRND_TYPE_IMM15b:
- return is_imm_over_range (oper, 0, 0xfffff, -1);
+ return is_imm_within_range (oper, 0, 0xfffff);
case OPRND_TYPE_IMM16b:
- return is_imm_over_range (oper, 0, 65535, -1);
+ return is_imm_within_range (oper, 0, 65535);
case OPRND_TYPE_OIMM16b:
- return is_oimm_over_range (oper, 1, 65536);
+ return is_oimm_within_range (oper, 1, 65536);
case OPRND_TYPE_IMM32b:
{
expressionS e;
ret = FALSE;
}
if (!ret)
- SET_ERROR_NUMBER (ERROR_OPERANDS_ILLEGAL, csky_insn.opcode_end);
+ SET_ERROR_STRING (ERROR_OPERANDS_ILLEGAL, csky_insn.opcode_end);
return ret;
}
case OPRND_TYPE_RM:
int reg;
if (**oper != '(')
{
- SET_ERROR_NUMBER (ERROR_MISSING_LBRACKET, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_LBRACKET, NULL);
return FALSE;
}
*oper += 1;
reg = csky_get_reg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_EXP_GREG, NULL);
+ SET_ERROR_STRING (ERROR_EXP_GREG, NULL);
return FALSE;
}
*oper += len;
if (**oper != ')')
{
- SET_ERROR_NUMBER (ERROR_MISSING_RBRACKET, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_RBRACKET, NULL);
return FALSE;
}
*oper += 1;
reg = csky_get_reg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The first operand must be register r1.");
return FALSE;
}
reg = csky_get_reg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The second operand must be register r1.");
return FALSE;
}
reg = csky_get_reg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_GREG_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_GREG_ILLEGAL, NULL);
return FALSE;
}
if (reg != csky_insn.val[0])
{
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The second register must be the same as the first.");
return FALSE;
}
reg = csky_get_reg_val (*oper, &len);
if (reg == -1)
{
- SET_ERROR_NUMBER (ERROR_GREG_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_GREG_ILLEGAL, NULL);
return FALSE;
}
/* dummy reg's real type should be same with first operand. */
if (reg == -1)
{
if (max_reg == 31)
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The register must be r0-r31");
else
- SET_ERROR_NUMBER (ERROR_REG_FORMAT,
+ SET_ERROR_STRING (ERROR_REG_FORMAT,
"The register must be r0-r15");
return FALSE;
}
if (reg > max_reg)
{
- SET_ERROR_NUMBER (ERROR_REG_OVER_RANGE, reg);
+ SET_ERROR_STRING (ERROR_REG_OVER_RANGE, reg);
return FALSE;
}
reg |= reg << shift_num;
*oper = new_oper;
if (e.X_add_number > 31)
{
- SET_ERROR_NUMBER (ERROR_IMM_OVERFLOW, NULL);
+ SET_ERROR_STRING (ERROR_IMM_OVERFLOW, NULL);
return FALSE;
}
csky_insn.val[csky_insn.idx++] = e.X_add_number;
{
if (csky_insn.val[csky_insn.idx - 1] > csky_insn.val[csky_insn.idx - 2])
{
- SET_ERROR_NUMBER (ERROR_IMM_OVERFLOW, NULL);
+ SET_ERROR_STRING (ERROR_IMM_OVERFLOW, NULL);
return FALSE;
}
csky_insn.val[csky_insn.idx - 2] -= e.X_add_number;
if (**oper == '[')
{
(*oper)++;
- if (is_imm_over_range (oper, 0, 0xf, -1))
+ if (is_imm_within_range (oper, 0, 0xf))
{
if (**oper == ']')
{
return TRUE;
}
else
- SET_ERROR_NUMBER (ERROR_MISSING_RSQUARE_BRACKETS, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_RSQUARE_BRACKETS, NULL);
}
}
else
- SET_ERROR_NUMBER (ERROR_MISSING_LSQUARE_BRACKETS, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_LSQUARE_BRACKETS, NULL);
}
return FALSE;
|| (op[i].operand_num == -1 && csky_insn.number != 0)))
{
/* The smaller err_num is more serious. */
- SET_ERROR_NUMBER (ERROR_OPERANDS_NUMBER, op[i].operand_num);
+ SET_ERROR_INTEGER (ERROR_OPERANDS_NUMBER, op[i].operand_num);
flag_pass = FALSE;
continue;
}
oper++;
else
{
- SET_ERROR_NUMBER (ERROR_MISSING_COMMA, NULL);
+ SET_ERROR_STRING (ERROR_MISSING_COMMA, NULL);
flag_pass = FALSE;
break;
}
}
else if (!is_end_of_line[(unsigned char) *oper])
{
- SET_ERROR_NUMBER (ERROR_BAD_END, NULL);
+ SET_ERROR_STRING (ERROR_BAD_END, NULL);
flag_pass = FALSE;
break;
}
return;
}
else if (error_state.err_num > ERROR_OPERANDS_NUMBER)
- SET_ERROR_NUMBER (ERROR_OPERANDS_NUMBER, csky_insn.macro->oprnd_num);
+ SET_ERROR_STRING (ERROR_OPERANDS_NUMBER, csky_insn.macro->oprnd_num);
}
if (csky_insn.opcode == NULL)
{
- SET_ERROR_NUMBER (ERROR_OPCODE_ILLEGAL, NULL);
+ SET_ERROR_STRING (ERROR_OPCODE_ILLEGAL, NULL);
csky_show_error (error_state.err_num, error_state.opnum,
(void *)error_state.arg1, (void *)error_state.arg1);
return;
csky_idly (void)
{
char *s = csky_insn.opcode_end;
- if (!is_imm_over_range (&s, 4, 4, -1))
+ if (!is_imm_within_range (&s, 4, 4))
{
as_bad (_("second operand must be 4"));
return;
s += csky_get_macro_operand (s, reg, ',');
++s;
- if (is_imm_over_range (&s, 1, 1, -1))
+ if (is_imm_within_range (&s, 1, 1))
{
csky_macro_md_assemble ("addc", reg, reg, NULL);
return;
if (csky_insn.number == 3)
{
if (csky_insn.val[0] > 7)
- csky_show_error (ERROR_REG_OVER_RANGE, 1,
- (void *)(long)csky_insn.val[0], NULL);
+ {
+ SET_ERROR_INTEGER (ERROR_REG_OVER_RANGE, csky_insn.val[0]);
+ csky_show_error (ERROR_REG_OVER_RANGE, 1, NULL, NULL);
+ }
if (csky_insn.val[1] > 7)
- csky_show_error (ERROR_REG_OVER_RANGE, 2,
- (void *)(long)csky_insn.val[1], NULL);
+ {
+ SET_ERROR_INTEGER (ERROR_REG_OVER_RANGE, csky_insn.val[1]);
+ csky_show_error (ERROR_REG_OVER_RANGE, 2, NULL, NULL);
+ }
if (csky_insn.val[2] > 7)
- csky_show_error (ERROR_REG_OVER_RANGE, 3,
- (void *)(long)csky_insn.val[2], NULL);
+ {
+ SET_ERROR_INTEGER (ERROR_REG_OVER_RANGE, csky_insn.val[2]);
+ csky_show_error (ERROR_REG_OVER_RANGE, 3, NULL, NULL);
+ }
}
else
{
if (csky_insn.val[0] > 15)
- csky_show_error (ERROR_REG_OVER_RANGE, 1,
- (void *)(long)csky_insn.val[0], NULL);
+ {
+ SET_ERROR_INTEGER (ERROR_REG_OVER_RANGE, csky_insn.val[0]);
+ csky_show_error (ERROR_REG_OVER_RANGE, 1, NULL, NULL);
+ }
if (csky_insn.val[1] > 15)
- csky_show_error (ERROR_REG_OVER_RANGE, 2,
- (void *)(long)csky_insn.val[1], NULL);
+ {
+ SET_ERROR_INTEGER (ERROR_REG_OVER_RANGE, csky_insn.val[1]);
+ csky_show_error (ERROR_REG_OVER_RANGE, 2, NULL, NULL);
+ }
}
return FALSE;
}