public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Cc: gcc-patches@gcc.gnu.org, Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Subject: Re: [PATCH 06/14] lto: use _P() defines from tree.h
Date: Mon, 15 May 2023 09:45:43 +0200	[thread overview]
Message-ID: <CAFiYyc1hctqSW-w3NXCV3y18AtnF=81GvBn5RpLftfwffK5bug@mail.gmail.com> (raw)
In-Reply-To: <20230513232321.279733-7-rep.dot.nop@gmail.com>

On Sun, May 14, 2023 at 1:40 AM Bernhard Reutner-Fischer via
Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>
> From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>

OK.

> gcc/ChangeLog:
>
>         * lto-streamer-in.cc (lto_input_var_decl_ref): Use _P defines from
>         tree.h.
>         (lto_read_body_or_constructor): Ditto.
>         * lto-streamer-out.cc (tree_is_indexable): Ditto.
>         (lto_output_var_decl_ref): Ditto.
>         (DFS::DFS_write_tree_body): Ditto.
>         (wrap_refs): Ditto.
>         (write_symbol_extension_info): Ditto.
>
> gcc/lto/ChangeLog:
>
>         * lto-common.cc (lto_maybe_register_decl):
>         * lto-symtab.cc (warn_type_compatibility_p):
>         (lto_symtab_resolve_replaceable_p):
>         (lto_symtab_merge_decls_1):
>         * lto-symtab.h (lto_symtab_prevailing_decl):
> ---
>  gcc/lto-streamer-in.cc  |  4 ++--
>  gcc/lto-streamer-out.cc | 11 +++++------
>  gcc/lto/lto-common.cc   |  2 +-
>  gcc/lto/lto-symtab.cc   |  8 ++++----
>  gcc/lto/lto-symtab.h    |  2 +-
>  5 files changed, 13 insertions(+), 14 deletions(-)
>
> diff --git a/gcc/lto-streamer-in.cc b/gcc/lto-streamer-in.cc
> index 03cb41cfa16..2cb83406db5 100644
> --- a/gcc/lto-streamer-in.cc
> +++ b/gcc/lto-streamer-in.cc
> @@ -671,7 +671,7 @@ lto_input_var_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data)
>    unsigned int ix_u = streamer_read_uhwi (ib);
>    tree result = (*file_data->current_decl_state
>                  ->streams[LTO_DECL_STREAM])[ix_u];
> -  gcc_assert (TREE_CODE (result) == VAR_DECL);
> +  gcc_assert (VAR_P (result));
>    return result;
>  }
>
> @@ -1653,7 +1653,7 @@ lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symta
>
>               if (TYPE_P (t))
>                 {
> -                 gcc_assert (TYPE_CANONICAL (t) == NULL_TREE);
> +                 gcc_assert (TYPE_STRUCTURAL_EQUALITY_P (t));
>                   if (type_with_alias_set_p (t)
>                       && canonical_type_used_p (t))
>                     TYPE_CANONICAL (t) = TYPE_MAIN_VARIANT (t);
> diff --git a/gcc/lto-streamer-out.cc b/gcc/lto-streamer-out.cc
> index 0bca530313c..5ab2eb4301e 100644
> --- a/gcc/lto-streamer-out.cc
> +++ b/gcc/lto-streamer-out.cc
> @@ -178,7 +178,7 @@ tree_is_indexable (tree t)
>            && lto_variably_modified_type_p (DECL_CONTEXT (t)))
>      return false;
>    else
> -    return (TYPE_P (t) || DECL_P (t) || TREE_CODE (t) == SSA_NAME);
> +    return (IS_TYPE_OR_DECL_P (t) || TREE_CODE (t) == SSA_NAME);
>  }
>
>
> @@ -346,7 +346,7 @@ void
>  lto_output_var_decl_ref (struct lto_out_decl_state *decl_state,
>                          struct lto_output_stream * obs, tree decl)
>  {
> -  gcc_checking_assert (TREE_CODE (decl) == VAR_DECL);
> +  gcc_checking_assert (VAR_P (decl));
>    streamer_write_uhwi_stream
>       (obs, lto_get_index (&decl_state->streams[LTO_DECL_STREAM],
>                           decl));
> @@ -1078,8 +1078,7 @@ DFS::DFS_write_tree_body (struct output_block *ob,
>        else if (RECORD_OR_UNION_TYPE_P (expr))
>         for (tree t = TYPE_FIELDS (expr); t; t = TREE_CHAIN (t))
>           DFS_follow_tree_edge (t);
> -      else if (TREE_CODE (expr) == FUNCTION_TYPE
> -              || TREE_CODE (expr) == METHOD_TYPE)
> +      else if (FUNC_OR_METHOD_TYPE_P (expr))
>         DFS_follow_tree_edge (TYPE_ARG_TYPES (expr));
>
>        if (!POINTER_TYPE_P (expr))
> @@ -2626,7 +2625,7 @@ wrap_refs (tree *tp, int *ws, void *)
>  {
>    tree t = *tp;
>    if (handled_component_p (t)
> -      && TREE_CODE (TREE_OPERAND (t, 0)) == VAR_DECL
> +      && VAR_P (TREE_OPERAND (t, 0))
>        && TREE_PUBLIC (TREE_OPERAND (t, 0)))
>      {
>        tree decl = TREE_OPERAND (t, 0);
> @@ -3064,7 +3063,7 @@ write_symbol_extension_info (tree t)
>         ? GCCST_VARIABLE : GCCST_FUNCTION);
>    lto_write_data (&c, 1);
>    unsigned char section_kind = 0;
> -  if (TREE_CODE (t) == VAR_DECL)
> +  if (VAR_P (t))
>      {
>        section *s = get_variable_section (t, false);
>        if (s->common.flags & SECTION_BSS)
> diff --git a/gcc/lto/lto-common.cc b/gcc/lto/lto-common.cc
> index 882dd8971a4..537570204b3 100644
> --- a/gcc/lto/lto-common.cc
> +++ b/gcc/lto/lto-common.cc
> @@ -958,7 +958,7 @@ lto_register_function_decl_in_symtab (class data_in *data_in, tree decl,
>  static void
>  lto_maybe_register_decl (class data_in *data_in, tree t, unsigned ix)
>  {
> -  if (TREE_CODE (t) == VAR_DECL)
> +  if (VAR_P (t))
>      lto_register_var_decl_in_symtab (data_in, t, ix);
>    else if (TREE_CODE (t) == FUNCTION_DECL
>            && !fndecl_built_in_p (t))
> diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc
> index 2b57d0d5371..79ba8ddde20 100644
> --- a/gcc/lto/lto-symtab.cc
> +++ b/gcc/lto/lto-symtab.cc
> @@ -214,7 +214,7 @@ warn_type_compatibility_p (tree prevailing_type, tree type,
>
>    /* Function types needs special care, because types_compatible_p never
>       thinks prototype is compatible to non-prototype.  */
> -  if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE)
> +  if (FUNC_OR_METHOD_TYPE_P (type))
>      {
>        if (TREE_CODE (type) != TREE_CODE (prevailing_type))
>         lev |= 1;
> @@ -401,7 +401,7 @@ lto_symtab_resolve_replaceable_p (symtab_node *e)
>        || DECL_WEAK (e->decl))
>      return true;
>
> -  if (TREE_CODE (e->decl) == VAR_DECL)
> +  if (VAR_P (e->decl))
>      return (DECL_COMMON (e->decl)
>             || (!flag_no_common && !DECL_INITIAL (e->decl)));
>
> @@ -803,7 +803,7 @@ lto_symtab_merge_decls_1 (symtab_node *first)
>          This is needed for C++ typeinfos, for example in
>          lto/20081204-1 there are typeifos in both units, just
>          one of them do have size.  */
> -      if (TREE_CODE (prevailing->decl) == VAR_DECL)
> +      if (VAR_P (prevailing->decl))
>         {
>           for (e = prevailing->next_sharing_asm_name;
>                e; e = e->next_sharing_asm_name)
> @@ -848,7 +848,7 @@ lto_symtab_merge_decls_1 (symtab_node *first)
>           break;
>
>         case FUNCTION_DECL:
> -         gcc_assert (TREE_CODE (e->decl) == VAR_DECL);
> +         gcc_assert (VAR_P (e->decl));
>           error_at (DECL_SOURCE_LOCATION (e->decl),
>                     "function %qD redeclared as variable",
>                     prevailing->decl);
> diff --git a/gcc/lto/lto-symtab.h b/gcc/lto/lto-symtab.h
> index f654f2cdebb..a60f262869b 100644
> --- a/gcc/lto/lto-symtab.h
> +++ b/gcc/lto/lto-symtab.h
> @@ -46,7 +46,7 @@ lto_symtab_prevailing_decl (tree decl)
>      return DECL_CHAIN (decl);
>    else
>      {
> -      if ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
> +      if ((VAR_P (decl) || TREE_CODE (decl) == FUNCTION_DECL)
>           && DECL_VIRTUAL_P (decl)
>           && (TREE_PUBLIC (decl) || DECL_EXTERNAL (decl))
>           && !symtab_node::get (decl))
> --
> 2.30.2
>

  reply	other threads:[~2023-05-15  7:45 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13 23:23 [PATCH 00/14] " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 01/14] ada: " Bernhard Reutner-Fischer
2023-05-14 23:03   ` Jeff Law
2023-05-18 19:59     ` Bernhard Reutner-Fischer
2023-05-15 10:05   ` Eric Botcazou
2023-05-18 19:53     ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 02/14] analyzer: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 03/14] gcc/config/*: " Bernhard Reutner-Fischer
2023-05-14  8:21   ` Iain Sandoe
2023-05-15  7:46     ` Richard Biener
2023-05-13 23:23 ` [PATCH 04/14] c++: " Bernhard Reutner-Fischer
2023-06-01 15:24   ` Patrick Palka
2023-06-01 16:33     ` Bernhard Reutner-Fischer
2023-06-01 18:10       ` Bernhard Reutner-Fischer
2023-08-02 16:51         ` Patrick Palka
2023-08-08 20:31           ` Jason Merrill
2023-11-15 17:42             ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 05/14] m2: " Bernhard Reutner-Fischer
2023-05-14  1:44   ` Gaius Mulley
2023-05-14  1:47   ` Gaius Mulley
2023-05-13 23:23 ` [PATCH 06/14] lto: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener [this message]
2023-05-13 23:23 ` [PATCH 07/14] d: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 08/14] fortran: " Bernhard Reutner-Fischer
2023-05-14 13:10   ` Mikael Morin
2023-05-18 15:18     ` Bernhard Reutner-Fischer
2023-05-18 19:20       ` Mikael Morin
2023-05-19 19:19         ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 09/14] rust: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 10/14] c: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 11/14] objc: " Bernhard Reutner-Fischer
2023-05-14  8:13   ` Iain Sandoe
2023-05-13 23:23 ` [PATCH 12/14] go: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 13/14] omp: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 14/14] gcc: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener

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='CAFiYyc1hctqSW-w3NXCV3y18AtnF=81GvBn5RpLftfwffK5bug@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=aldot@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rep.dot.nop@gmail.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).