From: Richard Sandiford <rdsandiford@googlemail.com>
To: tbsaunde+gcc@tbsaunde.org
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 1/4] convert ASM_OUTPUT_ASCII to a hook
Date: Mon, 27 Jul 2015 20:51:00 -0000 [thread overview]
Message-ID: <876155fj8k.fsf@googlemail.com> (raw)
In-Reply-To: <1437791820-17927-2-git-send-email-tbsaunde+gcc@tbsaunde.org> (tbsaunde's message of "Fri, 24 Jul 2015 22:36:57 -0400")
tbsaunde+gcc@tbsaunde.org 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
next prev parent reply other threads:[~2015-07-27 20:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-25 2:37 [PATCH 0/4] misc work to get rid of target macros tbsaunde+gcc
2015-07-25 2:37 ` [PATCH 3/4] remove unused TARGET_DEFERRED_OUTPUT_DEFS tbsaunde+gcc
2015-07-31 0:55 ` Joseph Myers
2015-07-25 2:37 ` [PATCH 1/4] convert ASM_OUTPUT_ASCII to a hook tbsaunde+gcc
2015-07-25 6:22 ` pinskia
2015-07-25 19:44 ` Trevor Saunders
2015-07-25 17:02 ` Segher Boessenkool
2015-07-27 20:51 ` Richard Sandiford [this message]
2015-07-25 3:09 ` [PATCH 2/4] make TLS_COMMON_ASM_OP " tbsaunde+gcc
2015-07-25 5:42 ` [PATCH 4/4] define ASM_OUTPUT_LABEL to the name of a function tbsaunde+gcc
2015-07-25 18:34 ` Segher Boessenkool
2015-07-25 19:27 ` Trevor Saunders
2015-07-25 19:44 ` Segher Boessenkool
2015-07-27 9:17 ` Richard Biener
2015-07-28 6:45 ` Trevor Saunders
2015-07-29 23:05 ` Jeff Law
2015-08-05 10:58 ` Trevor Saunders
2015-08-05 11:47 ` Richard Biener
2015-08-05 13:38 ` Trevor Saunders
2015-08-05 13:59 ` Richard Biener
2015-08-05 22:28 ` Segher Boessenkool
2015-08-05 15:28 ` David Malcolm
2015-08-05 15:34 ` David Malcolm
2015-08-05 20:23 ` Trevor Saunders
2015-08-06 18:48 ` David Malcolm
2015-08-06 19:36 ` Richard Sandiford
2015-08-07 4:32 ` Trevor Saunders
2015-08-07 9:46 ` Richard Sandiford
2015-08-07 13:50 ` Trevor Saunders
2015-08-07 20:24 ` Richard Biener
2015-08-07 21:52 ` Richard Sandiford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=876155fj8k.fsf@googlemail.com \
--to=rdsandiford@googlemail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=tbsaunde+gcc@tbsaunde.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).