diff options
author | Nick Clifton <nickc@redhat.com> | 2005-06-08 17:02:54 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2005-06-08 17:02:54 +0000 |
commit | 03b13e59e203becdaec06f112afe53a50b11c2ce (patch) | |
tree | d54c8b9ab668badf73f470972a631036044ff2cf /gas | |
parent | 985d94900d3fd3a8c49798ca6cc2192b321be2f4 (diff) | |
download | gdb-03b13e59e203becdaec06f112afe53a50b11c2ce.zip gdb-03b13e59e203becdaec06f112afe53a50b11c2ce.tar.gz gdb-03b13e59e203becdaec06f112afe53a50b11c2ce.tar.bz2 |
PR991
* config/tc-m68k.c (m68k_ip): Test for insn compatiblity using a temporary copy
of the operands array so that changes can be safely backed out if the insn
does not match.
(m68k_compare_opcode): Shortcut the test when the parameters are the same.
Return 1 if the names match but the second opcode is further on in the array
than the first.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 10 | ||||
-rw-r--r-- | gas/config/tc-m68k.c | 22 |
2 files changed, 30 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 9bb49fe..5ea1397 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,13 @@ +2005-06-08 Tomas Hurka <tom@hukatronic.cz> + + PR991 + * config/tc-m68k.c (m68k_ip): Test for insn compatiblity using a + temporary copy of the operands array so that changes can be safely + backed out if the insn does not match. + (m68k_compare_opcode): Shortcut the test when the parameters are + the same. Return 1 if the names match but the second opcode is + further on in the array than the first. + 2005-06-08 Nick Clifton <nickc@redhat.com> PR 994 diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index eb6e469..07b06e7 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -1089,6 +1089,7 @@ m68k_ip (char *instring) char c; int losing; int opsfound; + struct m68k_op operands_backup[6]; LITTLENUM_TYPE words[6]; LITTLENUM_TYPE *wordp; unsigned long ok_arch = 0; @@ -1213,7 +1214,15 @@ m68k_ip (char *instring) ++losing; else { - for (s = opcode->m_operands, opP = &the_ins.operands[0]; + int i; + + /* Make a copy of the operands of this insn so that + we can modify them safely, should we want to. */ + assert (opsfound <= (int) ARRAY_SIZE (operands_backup)); + for (i = 0; i < opsfound; i++) + operands_backup[i] = the_ins.operands[i]; + + for (s = opcode->m_operands, opP = &operands_backup[0]; *s && !losing; s += 2, opP++) { @@ -1974,6 +1983,12 @@ m68k_ip (char *instring) if (losing) break; } + + /* Since we have found the correct instruction, copy + in the modifications that we may have made. */ + if (!losing) + for (i = 0; i < opsfound; i++) + the_ins.operands[i] = operands_backup[i]; } if (!losing) @@ -4116,6 +4131,9 @@ m68k_compare_opcode (const void * v1, const void * v2) struct m68k_opcode * op1, * op2; int ret; + if (v1 == v2) + return 0; + op1 = *(struct m68k_opcode **) v1; op2 = *(struct m68k_opcode **) v2; @@ -4126,7 +4144,7 @@ m68k_compare_opcode (const void * v1, const void * v2) return ret; if (op1 < op2) return -1; - return 0; + return 1; } void |