[email protected] writes:
> +/* The routine used to output sequences of byte values. We use a special
> + version of this for most svr4 targets because doing so makes the
> + generated assembly code more compact (and thus faster to assemble)
> + as well as more readable. Note that if we find subparts of the
> + character sequence which end with NUL (and which are shorter than
> + ELF_STRING_LIMIT) we output those using ASM_OUTPUT_LIMITED_STRING. */
> +
> +void
> +ix86_elf_output_ascii (FILE *f, const char *string, size_t length)
> +{
> + const unsigned char *_ascii_bytes = (const unsigned char *) string;
> + const unsigned char *limit = _ascii_bytes + length;
> + unsigned bytes_in_chunk = 0;
> + for (; _ascii_bytes < limit; _ascii_bytes++)
> + {
> + const unsigned char *p;
> + if (bytes_in_chunk >= 64)
> + {
> + fputc ('\n', f);
> + bytes_in_chunk = 0;
> + }
> + for (p = _ascii_bytes; p < limit && *p != '\0'; p++)
> + continue;
> + if (p < limit && (p - _ascii_bytes) <= (long) ELF_STRING_LIMIT)
> + {
> + if (bytes_in_chunk > 0)
> + {
> + fputc ('\n', f);
> + bytes_in_chunk = 0;
> + }
> + ASM_OUTPUT_LIMITED_STRING (f, (const char *) _ascii_bytes);
> + _ascii_bytes = p;
> + }
> + else
> + {
> + if (bytes_in_chunk == 0)
> + fputs (ASM_BYTE, f);
> + else
> + fputc (',', f);
> + fprintf (f, "0x%02x", *_ascii_bytes); \
> + bytes_in_chunk += 5;
> + }
"_ascii_bytes = p;" onwards seems to be indented too far.
> +DEFHOOK
> +(output_ascii,
> + "A target hook to output an assembly instruction to assemble a string\n\
> + constant containing the @var{length} bytes at @var{str}.\n\
> +\n\
> +The defalt hook uses the @code{.ascii} pseudo op as found in the Berkely
> Unix assembler.",
> + void, (FILE *f, const char *str, size_t length),
> + default_output_ascii)
Preexisting, but how about s/an assembly instruction/assembly instructions/
(or "assembly directives"?), just to emphasise that more than one instruction
can be used.
> @@ -7586,6 +7586,37 @@ make_debug_expr_from_rtl (const_rtx exp)
> return dval;
> }
>
> +/* Default implementation of TARGET_ASM_OUTPUT_ASCII using .ascii. */
> +
> +void
> +default_output_ascii (FILE *f, const char *str, size_t length)
> +{
> + const unsigned char *p = (const unsigned char *) str;
> +
> + fprintf (f, "\t.ascii \"");
> + for (unsigned int i = 0; i < length; i++)
> + {
Some strange indentation here too.
Thanks,
Richard