public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: Jonathan Wakely <jwakely@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: Add target hook for emit_support_tinfos [PR108883]
Date: Tue, 28 Feb 2023 00:51:06 +0100	[thread overview]
Message-ID: <Y/1B6kgwVypKeY2y@tucnak> (raw)
In-Reply-To: <7163c5db-3025-01cb-c0ad-5526e46eff8c@redhat.com>

On Mon, Feb 27, 2023 at 06:26:04PM -0500, Jason Merrill wrote:
> > The following patch instead adds a target hook which allows the backend
> > to temporarily tweak registered types such that emit_support_tinfos
> > emits whatever is needed.
> 
> Why handle these types differently from the DFP handling at the end of
> emit_support_tinfos?

One thing is that the fallback_* nodes look like a waste to me,
the tinfo decls are mangled right away, and the fallback_* nodes need to be
walked by GC, so I think we could get away even for the decimal tinfos
to just do:
      dfloat32_type_node = make_node (REAL_TYPE);
      emit_support_tinfo_1 (dfloat32_type_node);
      dfloat32_type_node = NULL_TREE;
etc. and drop the fallback stuff.
If we wanted to do fallback_* even for the _Float*/decltype(0.0bf16)
nodes, which are at least sometimes mangled in target hooks it would
make stuff harder because fallback_* is C++ FE private.

And then there is a question whether we want to emit rtti for
_Float{16,32,64,128}, _Float{32,64,128}x and decltype(0.0bf16) regardless
of whether the target supports them at all or not.
Emitting them always would have an advantage, if say bfloat16_t support
isn't added for aarch64 for GCC 13 (it is still pending review), we wouldn't
need to deal with symbol versioning for it in GCC 14 or later.
On the other side, on some arches some types are very unlikely to be
supported.  And e.g. _Float128x isn't supported on any arch right now.

Though, if we can get rid of the fallback_* stuff and we wanted to emit
all _Float{16,32,64,128}, _Float{32,64,128}x and decltype(0.0bf16) tinfos
on all arches (or say for now all but _Float128x), we could do it simply
by splitting the fundamentals array in emit_support_tinfos into
one without fallback and one with fallback, put say
    &dfloat32_type_node, &dfloat64_type_node, &dfloat128_type_node,
    &bfloat16_type_node, &float16_type_node, &float32_type_node,
    &float64_type_node, &float128_type_node, &float32x_type_node,
    &float64x_type_node, &float128x_type_node, 0
into the latter and simply handle the NULL case with a temporary fallback,
like:
  tree fallback = NULL_TREE;
  for (ix = 0; fundamentals_with_fallback[ix]; ix++)
    if (*fundamentals_with_fallback[ix])
      emit_support_tinfo_1 (*fundamentals_with_fallback[ix]);
    else
      {
	if (fallback == NULL_TREE)
	  fallback = make_node (REAL_TYPE);
	*fundamentals_with_fallback[ix] = fallback;
	emit_support_tinfo_1 (fallback);
	*fundamentals_with_fallback[ix] = NULL_TREE;
      }

	Jakub


  reply	other threads:[~2023-02-27 23:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-23 10:23 Jakub Jelinek
2023-02-27 23:26 ` Jason Merrill
2023-02-27 23:51   ` Jakub Jelinek [this message]
2023-02-28 10:04     ` [PATCH] c++: Emit fundamental tinfos for all _Float*/decltype(0.0bf16) types unconditionally [PR108883] Jakub Jelinek
2023-03-01  9:19       ` [PATCH] c++, v2: " Jakub Jelinek
2023-03-01 22:50     ` [PATCH] c++: Add target hook for emit_support_tinfos [PR108883] Jason Merrill
2023-03-02 11:20       ` [PATCH] c++, v3: Emit fundamental tinfos for _Float16/decltype(0.0bf16) types on ia32 with -mno-sse2 [PR108883] Jakub Jelinek
2023-03-02 16:32         ` Jason Merrill

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=Y/1B6kgwVypKeY2y@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=jwakely@redhat.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).