From 711eeac0eb83f0d9e8ef5b0dfbc5d932725aabc8 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Tue, 28 Jul 1998 17:03:05 +0000 Subject: * config/tc-mn10300.c (md_assemble): Fix "errmsg" initialization to work with internationalization code. Issue an error when two operands match that are not allowed to match. --- gas/ChangeLog | 6 ++++++ gas/config/tc-mn10300.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) (limited to 'gas') diff --git a/gas/ChangeLog b/gas/ChangeLog index a0551af..a54ab3a 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +Tue Jul 28 11:01:21 1998 Jeffrey A Law (law@cygnus.com) + + * config/tc-mn10300.c (md_assemble): Fix "errmsg" initialization + to work with internationalization code. Issue an error when two + operands match that are not allowed to match. + Mon Jul 27 16:25:58 1998 Doug Evans * configure.in (install_tooldir): Allow target to specify whether diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 1dd5803..1389a9b 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -105,6 +105,10 @@ struct mn10300_fixup }; struct mn10300_fixup fixups[MAX_INSN_FIXUPS]; static int fc; + +/* We must store the value of each register operand so that we can + verify that certain registers do not match. */ +int mn10300_reg_operands[MN10300_MAX_OPERANDS]; const char *md_shortopts = ""; struct option md_longopts[] = { @@ -878,7 +882,7 @@ md_begin () /* This is both a simplification (we don't have to write md_apply_fix) and support for future optimizations (branch shortening and similar - stuff in the linker. */ + stuff in the linker). */ linkrelax = 1; /* Set the default machine type. */ @@ -924,12 +928,17 @@ md_assemble (str) for(;;) { - const char *errmsg = "Invalid opcode/operands"; + const char *errmsg; int op_idx; char *hold; int extra_shift = 0; + errmsg = _("Invalid opcode/operands"); + + /* Reset the array of register operands. */ + memset (mn10300_reg_operands, -1, sizeof (mn10300_reg_operands)); + relaxable = 0; fc = 0; match = 0; @@ -1330,6 +1339,9 @@ md_assemble (str) ex.X_add_number, (char *) NULL, 0, extra_shift); + + /* And note the register number in the register array. */ + mn10300_reg_operands[op_idx - 1] = ex.X_add_number; break; } @@ -1384,6 +1396,35 @@ keep_going: if (*str != ',') match = 1; + /* If this instruction has registers that must not match, verify + that they do indeed not match. */ + if (opcode->no_match_operands) + { + int i; + + /* Look at each operand to see if it's marked. */ + for (i = 0; i < MN10300_MAX_OPERANDS; i++) + { + if ((1 << i) & opcode->no_match_operands) + { + int j; + + /* operand I is marked. Check that it does not match any + operands > I which are marked. */ + for (j = i + 1; j < MN10300_MAX_OPERANDS; j++) + { + if (((1 << j) & opcode->no_match_operands) + && mn10300_reg_operands[i] == mn10300_reg_operands[j]) + { + errmsg = _("Invalid register specification."); + match = 0; + goto error; + } + } + } + } + } + error: if (match == 0) { -- cgit v1.1