public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Alexandre Oliva <oliva@adacore.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] untyped calls: enable target switching [PR112334]
Date: Mon, 11 Dec 2023 09:02:18 -0700	[thread overview]
Message-ID: <dc1fdd01-cacf-42ea-8605-4f5ad26681f7@gmail.com> (raw)
In-Reply-To: <oredg6yn48.fsf@lxoliva.fsfla.org>



On 12/1/23 08:10, Alexandre Oliva wrote:
> On Dec  1, 2023, Alexandre Oliva <oliva@adacore.com> wrote:
> 
>> Also tested on arm-eabi, but it's *not* enough (or needed) to fix the
>> PR, there's another bug lurking there, with a separate patch coming
>> up.
> 
> Here it is.
> 
> ----
> 
> The computation of apply_args_size and apply_result_size is saved in a
> static variable, so that the corresponding _mode arrays are
> initialized only once.  That is not compatible with switchable
> targets, and ARM's arm_set_current_function, by saving and restoring
> target globals, exercises this problem with a testcase such as that in
> the PR, in which more than one function in the translation unit calls
> __builtin_apply or __builtin_return, respectively.
> 
> This patch moves the _size statics into the target_builtins array,
> with a bit of ugliness over _plus_one so that zero initialization of
> the struct does the right thing.
> 
> Regstrapped on x86_64-linux-gnu, tested on arm-eabi with and without the
> upthread patch.  It fixes the hardcfr fails either way.  As for the
> ugliness, there's a follow up patch below that attempts to alleviate it
> a little (also regstrapped and tested), but I'm not sure we want to go
> down that path.  WDYT?
It's a wart, but doesn't seem too bad to me.

> 
> 
> for  gcc/ChangeLog
> 
> 	PR target/112334
> 	* builtins.h (target_builtins): Add fields for apply_args_size
> 	and apply_result_size.
> 	* builtins.cc (apply_args_size, apply_result_size): Cache
> 	results in fields rather than in static variables.
> 	(get_apply_args_size, set_apply_args_size): New.
> 	(get_apply_result_size, set_apply_result_size): New.
OK.


> 
> untyped calls: use wrapper class type for implicit plus_one
> 
> Instead of get and set macros to apply a delta, use a single macro
> that resorts to a temporary wrapper class to apply it.
> 
> To be combined (or not) with the previous patch.
I'd be OK with this as well.

jeff


  reply	other threads:[~2023-12-11 16:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 12:57 [PATCH] hardcfr: make builtin_return tests more portable [PR112334] Alexandre Oliva
2023-12-01 14:27 ` Richard Biener
2023-12-01 15:10 ` [PATCH] untyped calls: enable target switching [PR112334] Alexandre Oliva
2023-12-11 16:02   ` Jeff Law [this message]
2023-12-12  4:44     ` Alexandre Oliva
2023-12-20  5:08       ` Jeff Law
2023-12-21  1:01         ` Alexandre Oliva
2023-12-01 17:39 ` [PATCH] hardcfr: make builtin_return tests more portable [PR112334] Alexandre Oliva

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=dc1fdd01-cacf-42ea-8605-4f5ad26681f7@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=oliva@adacore.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).