On Fri, Nov 08, 2024 at 05:44:48PM +0000, Richard Sandiford wrote:
> It's for https://gcc.gnu.org/pipermail/gcc-patches/2024-November/667499.html ,
> which needs to switch to the simd clone's chosen target (SVE) in order
> to construct the correct types.  Currently the patch uses:
> 
> +      cl_target_option_save (&cur_target, &global_options, 
> &global_options_set);
> +      tree new_target = DECL_FUNCTION_SPECIFIC_TARGET (node->decl);
> +      cl_target_option_restore (&global_options, &global_options_set,
> +                             TREE_TARGET_OPTION (new_target));
> +      aarch64_override_options_internal (&global_options);
> +      memcpy (m_old_have_regs_of_mode, have_regs_of_mode,
> +           sizeof (have_regs_of_mode));
> +      for (int i = 0; i < NUM_MACHINE_MODES; ++i)
> +     if (aarch64_sve_mode_p ((machine_mode) i))
> +       have_regs_of_mode[i] = true;
> 
> to switch in and:
> 
> +      /* Restore current options.  */
> +      cl_target_option_restore (&global_options, &global_options_set, 
> &cur_target);
> +      aarch64_override_options_internal (&global_options);
> +      memcpy (have_regs_of_mode, m_old_have_regs_of_mode,
> +           sizeof (have_regs_of_mode));
> 
> to switch back, but the idea is to replace that with:
> 
>       push_function_decl (node->decl);
> 
>       ...
> 
>       pop_function_decl ();

Why do you need that?  Can't you just use opt_for_fn?

        Jakub

Reply via email to