Commit b1721339 by Kaveh R. Ghazi Committed by Kaveh Ghazi

final.c (asm_fprintf): Update comments...

	* final.c (asm_fprintf): Update comments, accept "-+ #0" flags,
	optimize '%' case, handle %c, don't accept %p, %e, %f or %g,
	handle %ll, optimize regular character case.

From-SVN: r67434
parent 9bf8cfbf
2003-06-04 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* final.c (asm_fprintf): Update comments, accept "-+ #0" flags,
optimize '%' case, handle %c, don't accept %p, %e, %f or %g,
handle %ll, optimize regular character case.
2003-06-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> 2003-06-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* Makefile.in (cse.o): Add params.h dependency. * Makefile.in (cse.o): Add params.h dependency.
......
...@@ -3372,7 +3372,7 @@ output_addr_const (file, x) ...@@ -3372,7 +3372,7 @@ output_addr_const (file, x)
%U prints the value of USER_LABEL_PREFIX. %U prints the value of USER_LABEL_PREFIX.
%I prints the value of IMMEDIATE_PREFIX. %I prints the value of IMMEDIATE_PREFIX.
%O runs ASM_OUTPUT_OPCODE to transform what follows in the string. %O runs ASM_OUTPUT_OPCODE to transform what follows in the string.
Also supported are %d, %x, %s, %e, %f, %g and %%. Also supported are %d, %i, %u, %x, %X, %o, %c, %s and %%.
We handle alternate assembler dialects here, just like output_asm_insn. */ We handle alternate assembler dialects here, just like output_asm_insn. */
...@@ -3421,6 +3421,11 @@ asm_fprintf (FILE *file, const char *p, ...) ...@@ -3421,6 +3421,11 @@ asm_fprintf (FILE *file, const char *p, ...)
case '%': case '%':
c = *p++; c = *p++;
q = &buf[1]; q = &buf[1];
while (strchr ("-+ #0", c))
{
*q++ = c;
c = *p++;
}
while (ISDIGIT (c) || c == '.') while (ISDIGIT (c) || c == '.')
{ {
*q++ = c; *q++ = c;
...@@ -3429,21 +3434,22 @@ asm_fprintf (FILE *file, const char *p, ...) ...@@ -3429,21 +3434,22 @@ asm_fprintf (FILE *file, const char *p, ...)
switch (c) switch (c)
{ {
case '%': case '%':
fprintf (file, "%%"); putc ('%', file);
break; break;
case 'd': case 'i': case 'u': case 'd': case 'i': case 'u':
case 'x': case 'p': case 'X': case 'x': case 'X': case 'o':
case 'o': case 'c':
*q++ = c; *q++ = c;
*q = 0; *q = 0;
fprintf (file, buf, va_arg (argptr, int)); fprintf (file, buf, va_arg (argptr, int));
break; break;
case 'w': case 'w':
/* This is a prefix to the 'd', 'i', 'u', 'x', 'p', and 'X' cases, /* This is a prefix to the 'd', 'i', 'u', 'x', 'X', and
but we do not check for those cases. It means that the value 'o' cases, but we do not check for those cases. It
is a HOST_WIDE_INT, which may be either `int' or `long'. */ means that the value is a HOST_WIDE_INT, which may be
either `long' or `long long'. */
#if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
#else #else
...@@ -3462,17 +3468,22 @@ asm_fprintf (FILE *file, const char *p, ...) ...@@ -3462,17 +3468,22 @@ asm_fprintf (FILE *file, const char *p, ...)
case 'l': case 'l':
*q++ = c; *q++ = c;
*q++ = *p++; #ifdef HAVE_LONG_LONG
*q = 0; if (*p == 'l')
fprintf (file, buf, va_arg (argptr, long)); {
break; *q++ = *p++;
*q++ = *p++;
case 'e': *q = 0;
case 'f': fprintf (file, buf, va_arg (argptr, long long));
case 'g': }
*q++ = c; else
*q = 0; #endif
fprintf (file, buf, va_arg (argptr, double)); {
*q++ = *p++;
*q = 0;
fprintf (file, buf, va_arg (argptr, long));
}
break; break;
case 's': case 's':
...@@ -3529,7 +3540,7 @@ asm_fprintf (FILE *file, const char *p, ...) ...@@ -3529,7 +3540,7 @@ asm_fprintf (FILE *file, const char *p, ...)
break; break;
default: default:
fputc (c, file); putc (c, file);
} }
va_end (argptr); va_end (argptr);
} }
......
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