Commit c383c15f by Geoffrey Keating Committed by Geoffrey Keating

final.c (output_asm_insn): Use strtoul instead of atoi, save a loop.

	* final.c (output_asm_insn): Use strtoul instead of atoi, save a
	loop.

From-SVN: r87316
parent 1adaa117
2004-09-10 Geoffrey Keating <geoffk@apple.com> 2004-09-10 Geoffrey Keating <geoffk@apple.com>
* final.c (output_asm_insn): Use strtoul instead of atoi, save a
loop.
* config/darwin.c: Include target.h. * config/darwin.c: Include target.h.
(struct machopic_indirection): Make ptr_name a string. (struct machopic_indirection): Make ptr_name a string.
(machopic_indirection_hash): Update for ptr_name a string. (machopic_indirection_hash): Update for ptr_name a string.
......
...@@ -3084,61 +3084,66 @@ output_asm_insn (const char *template, rtx *operands) ...@@ -3084,61 +3084,66 @@ output_asm_insn (const char *template, rtx *operands)
else if (ISALPHA (*p)) else if (ISALPHA (*p))
{ {
int letter = *p++; int letter = *p++;
c = atoi (p); unsigned long opnum;
char *endptr;
if (! ISDIGIT (*p))
output_operand_lossage ("operand number missing after %%-letter"); opnum = strtoul (p, &endptr, 10);
else if (this_is_asm_operands
&& (c < 0 || (unsigned int) c >= insn_noperands)) if (endptr == p)
output_operand_lossage ("operand number missing "
"after %%-letter");
else if (this_is_asm_operands && opnum >= insn_noperands)
output_operand_lossage ("operand number out of range"); output_operand_lossage ("operand number out of range");
else if (letter == 'l') else if (letter == 'l')
output_asm_label (operands[c]); output_asm_label (operands[opnum]);
else if (letter == 'a') else if (letter == 'a')
output_address (operands[c]); output_address (operands[opnum]);
else if (letter == 'c') else if (letter == 'c')
{ {
if (CONSTANT_ADDRESS_P (operands[c])) if (CONSTANT_ADDRESS_P (operands[opnum]))
output_addr_const (asm_out_file, operands[c]); output_addr_const (asm_out_file, operands[opnum]);
else else
output_operand (operands[c], 'c'); output_operand (operands[opnum], 'c');
} }
else if (letter == 'n') else if (letter == 'n')
{ {
if (GET_CODE (operands[c]) == CONST_INT) if (GET_CODE (operands[opnum]) == CONST_INT)
fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC, fprintf (asm_out_file, HOST_WIDE_INT_PRINT_DEC,
- INTVAL (operands[c])); - INTVAL (operands[opnum]));
else else
{ {
putc ('-', asm_out_file); putc ('-', asm_out_file);
output_addr_const (asm_out_file, operands[c]); output_addr_const (asm_out_file, operands[opnum]);
} }
} }
else else
output_operand (operands[c], letter); output_operand (operands[opnum], letter);
if (!opoutput[c]) if (!opoutput[opnum])
oporder[ops++] = c; oporder[ops++] = c;
opoutput[c] = 1; opoutput[opnum] = 1;
while (ISDIGIT (c = *p)) p = endptr;
p++; c = *p;
} }
/* % followed by a digit outputs an operand the default way. */ /* % followed by a digit outputs an operand the default way. */
else if (ISDIGIT (*p)) else if (ISDIGIT (*p))
{ {
c = atoi (p); unsigned long opnum;
if (this_is_asm_operands char *endptr;
&& (c < 0 || (unsigned int) c >= insn_noperands))
opnum = strtoul (p, &endptr, 10);
if (this_is_asm_operands && opnum >= insn_noperands)
output_operand_lossage ("operand number out of range"); output_operand_lossage ("operand number out of range");
else else
output_operand (operands[c], 0); output_operand (operands[opnum], 0);
if (!opoutput[c]) if (!opoutput[opnum])
oporder[ops++] = c; oporder[ops++] = c;
opoutput[c] = 1; opoutput[opnum] = 1;
while (ISDIGIT (c = *p)) p = endptr;
p++; c = *p;
} }
/* % followed by punctuation: output something for that /* % followed by punctuation: output something for that
punctuation character alone, with no operand. punctuation character alone, with no operand.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment