mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 13:27:26 +08:00
gas/
2011-07-24 Maciej W. Rozycki <macro@codesourcery.com> * config/tc-mips.c (mips_ip): Make a copy of the instruction's mnemonic and use it for further processing.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2011-07-24 Maciej W. Rozycki <macro@codesourcery.com>
|
||||||
|
|
||||||
|
* config/tc-mips.c (mips_ip): Make a copy of the instruction's
|
||||||
|
mnemonic and use it for further processing.
|
||||||
|
|
||||||
2011-07-24 Maciej W. Rozycki <macro@codesourcery.com>
|
2011-07-24 Maciej W. Rozycki <macro@codesourcery.com>
|
||||||
|
|
||||||
* config/tc-mips.c (can_swap_branch_p): Adjust for the rename of
|
* config/tc-mips.c (can_swap_branch_p): Adjust for the rename of
|
||||||
|
@ -8931,67 +8931,38 @@ mips_ip (char *str, struct mips_cl_insn *ip)
|
|||||||
unsigned int lastpos = 0;
|
unsigned int lastpos = 0;
|
||||||
unsigned int limlo, limhi;
|
unsigned int limlo, limhi;
|
||||||
char *s_reset;
|
char *s_reset;
|
||||||
char save_c = 0;
|
|
||||||
offsetT min_range, max_range;
|
offsetT min_range, max_range;
|
||||||
|
char *name;
|
||||||
int argnum;
|
int argnum;
|
||||||
unsigned int rtype;
|
unsigned int rtype;
|
||||||
|
long end;
|
||||||
|
|
||||||
insn_error = NULL;
|
insn_error = NULL;
|
||||||
|
|
||||||
/* If the instruction contains a '.', we first try to match an instruction
|
|
||||||
including the '.'. Then we try again without the '.'. */
|
|
||||||
insn = NULL;
|
insn = NULL;
|
||||||
for (s = str; *s != '\0' && !ISSPACE (*s); ++s)
|
|
||||||
|
/* Try to match an instruction up to a space or to the end. */
|
||||||
|
for (end = 0; str[end] != '\0' && !ISSPACE (str[end]); end++)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* If we stopped on whitespace, then replace the whitespace with null for
|
/* Make a copy of the instruction so that we can fiddle with it. */
|
||||||
the call to hash_find. Save the character we replaced just in case we
|
name = alloca (end + 1);
|
||||||
have to re-parse the instruction. */
|
memcpy (name, str, end);
|
||||||
if (ISSPACE (*s))
|
name[end] = '\0';
|
||||||
{
|
|
||||||
save_c = *s;
|
|
||||||
*s++ = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
insn = (struct mips_opcode *) hash_find (op_hash, str);
|
insn = (struct mips_opcode *) hash_find (op_hash, name);
|
||||||
|
|
||||||
/* If we didn't find the instruction in the opcode table, try again, but
|
|
||||||
this time with just the instruction up to, but not including the
|
|
||||||
first '.'. */
|
|
||||||
if (insn == NULL)
|
if (insn == NULL)
|
||||||
{
|
|
||||||
/* Restore the character we overwrite above (if any). */
|
|
||||||
if (save_c)
|
|
||||||
*(--s) = save_c;
|
|
||||||
|
|
||||||
/* Scan up to the first '.' or whitespace. */
|
|
||||||
for (s = str;
|
|
||||||
*s != '\0' && *s != '.' && !ISSPACE (*s);
|
|
||||||
++s)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* If we did not find a '.', then we can quit now. */
|
|
||||||
if (*s != '.')
|
|
||||||
{
|
{
|
||||||
insn_error = _("Unrecognized opcode");
|
insn_error = _("Unrecognized opcode");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup the instruction in the hash table. */
|
argsStart = s = str + end;
|
||||||
*s++ = '\0';
|
|
||||||
if ((insn = (struct mips_opcode *) hash_find (op_hash, str)) == NULL)
|
|
||||||
{
|
|
||||||
insn_error = _("Unrecognized opcode");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
argsStart = s;
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
bfd_boolean ok;
|
bfd_boolean ok;
|
||||||
|
|
||||||
gas_assert (strcmp (insn->name, str) == 0);
|
gas_assert (strcmp (insn->name, name) == 0);
|
||||||
|
|
||||||
ok = is_opcode_valid (insn);
|
ok = is_opcode_valid (insn);
|
||||||
if (! ok)
|
if (! ok)
|
||||||
@ -9013,8 +8984,6 @@ mips_ip (char *str, struct mips_cl_insn *ip)
|
|||||||
mips_cpu_info_from_isa (mips_opts.isa)->name);
|
mips_cpu_info_from_isa (mips_opts.isa)->name);
|
||||||
insn_error = buf;
|
insn_error = buf;
|
||||||
}
|
}
|
||||||
if (save_c)
|
|
||||||
*(--s) = save_c;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10474,8 +10443,6 @@ mips_ip (char *str, struct mips_cl_insn *ip)
|
|||||||
insn_error = _("Illegal operands");
|
insn_error = _("Illegal operands");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (save_c)
|
|
||||||
*(--argsStart) = save_c;
|
|
||||||
insn_error = _("Illegal operands");
|
insn_error = _("Illegal operands");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user