From: Richard Sandiford <richard.sandiford@arm.com>
To: Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: Richard Earnshaw <rearnsha@arm.com>
Subject: Re: [PATCH] rtl: Forward declare rtx_code
Date: Wed, 23 Aug 2023 16:49:06 +0100 [thread overview]
Message-ID: <mpth6opbvyl.fsf@arm.com> (raw)
In-Reply-To: <20230822120219.3997652-1-rearnsha@arm.com> (Richard Earnshaw via Gcc-patches's message of "Tue, 22 Aug 2023 13:02:19 +0100")
Richard Earnshaw via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Now that we require C++ 11, we can safely forward declare rtx_code
> so that we can use it in target hooks.
>
> gcc/ChangeLog
> * coretypes.h (rtx_code): Add forward declaration.
> * rtl.h (rtx_code): Make compatible with forward declaration.
> ---
> gcc/coretypes.h | 4 ++++
> gcc/rtl.h | 2 +-
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/coretypes.h b/gcc/coretypes.h
> index ca8837cef67..51e55559ce0 100644
> --- a/gcc/coretypes.h
> +++ b/gcc/coretypes.h
> @@ -100,6 +100,10 @@ struct gimple;
> typedef gimple *gimple_seq;
> struct gimple_stmt_iterator;
>
> +/* Forward declare rtx_code, so that we can use it in target hooks without
> + needing to pull in rtl.h. */
> +enum rtx_code : unsigned;
> +
> /* Forward decls for leaf gimple subclasses (for individual gimple codes).
> Keep this in the same order as the corresponding codes in gimple.def. */
>
> diff --git a/gcc/rtl.h b/gcc/rtl.h
> index e1c51156f90..0e9491b89b4 100644
> --- a/gcc/rtl.h
> +++ b/gcc/rtl.h
> @@ -45,7 +45,7 @@ class predefined_function_abi;
> /* Register Transfer Language EXPRESSIONS CODES */
>
> #define RTX_CODE enum rtx_code
> -enum rtx_code {
> +enum rtx_code : unsigned {
>
> #define DEF_RTL_EXPR(ENUM, NAME, FORMAT, CLASS) ENUM ,
> #include "rtl.def" /* rtl expressions are documented here */
Given:
#define RTX_CODE_BITSIZE 8
there might be some value in making it uint8_t rather than unsigned.
Preapproved if you agree.
But the patch as posted is a strict improvement over the status quo,
so it's also OK as-is.
Thanks,
Richard
next prev parent reply other threads:[~2023-08-23 15:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-22 12:02 Richard Earnshaw
2023-08-23 15:49 ` Richard Sandiford [this message]
2023-08-23 16:11 ` Richard Earnshaw (lists)
2023-08-23 16:18 ` 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=mpth6opbvyl.fsf@arm.com \
--to=richard.sandiford@arm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rearnsha@arm.com \
/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).