public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rdsandiford@googlemail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: Jakub Jelinek <jakub@redhat.com>,  gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: PR target/52555: attribute optimize is overriding command line options
Date: Tue, 12 Feb 2013 17:46:00 -0000	[thread overview]
Message-ID: <87zjz9v31p.fsf@talisman.default> (raw)
In-Reply-To: <874nhhwhvi.fsf@talisman.default> (Richard Sandiford's message of	"Tue, 12 Feb 2013 17:40:17 +0000")

Richard Sandiford <rdsandiford@googlemail.com> writes:
> Aldy Hernandez <aldyh@redhat.com> writes:
>>> Rather than:
>>>
>>> 	  /* Change optabs if needed.  */
>>> 	  if (TREE_OPTIMIZATION_OPTABS (opts))
>>> 	    this_target_optabs
>>> 	      = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts);
>>> 	  else
>>> 	    this_target_optabs = &default_target_optabs;
>>>
>>> I think it'd be better to have:
>>>
>>> 	  /* Change optabs if needed.  */
>>> 	  if (TREE_OPTIMIZATION_OPTABS (opts))
>>> 	    this_fn_optabs
>>> 	      = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts);
>>> 	  else
>>> 	    this_fn_optabs = this_target_optabs;
>>>
>>> with genopinit.c updated to use this_fn_optabs instead of this_target_optabs.
>>
>> Hmmm, ok.
>>
>> I also added a default case setting this_fn_optabs = 
>> &default_target_optabs when the optimizations haven't changed.  I can 
>> remove this if redundant.
>
> No, sounds like a good plan, but I think it should be this_target_optabs
> rather than &default_target_optabs.

Gah, just realised after sending that it would be better to have:

static void
invoke_set_current_function_hook (tree fndecl)
{
  this_fn_optabs = this_target_optabs;
  if (!in_dummy_function)
    {
      tree opts = ((fndecl)
		   ? DECL_FUNCTION_SPECIFIC_OPTIMIZATION (fndecl)
		   : optimization_default_node);

      if (!opts)
	opts = optimization_default_node;

      /* Change optimization options if needed.  */
      if (optimization_current_node != opts)
	{
	  optimization_current_node = opts;
	  cl_optimization_restore (&global_options, TREE_OPTIMIZATION (opts));

	  /* Change optabs if needed.  */
	  if (TREE_OPTIMIZATION_OPTABS (opts))
	    this_fn_optabs
	      = (struct target_optabs *) TREE_OPTIMIZATION_OPTABS (opts);
	}

      targetm.set_current_function (fndecl);
    }
}

Richard

  reply	other threads:[~2013-02-12 17:46 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  0:15 Aldy Hernandez
2013-02-12 14:05 ` Jakub Jelinek
2013-02-12 15:58   ` Aldy Hernandez
2013-02-12 16:16     ` Jakub Jelinek
2013-02-12 16:30   ` Richard Sandiford
2013-02-12 17:28     ` Aldy Hernandez
2013-02-12 17:48       ` Richard Sandiford
2013-02-12 17:46         ` Richard Sandiford [this message]
2013-02-13 17:39         ` Aldy Hernandez
2013-02-13 17:58           ` Richard Sandiford
2013-02-13 18:08             ` Aldy Hernandez
2013-02-13 19:54               ` Jakub Jelinek
2013-02-15 17:23                 ` Aldy Hernandez
2013-02-15 17:35                   ` Jakub Jelinek
2013-02-15 17:52                     ` Aldy Hernandez
2013-02-16 11:20                   ` Richard Sandiford
2013-02-18 18:51                     ` Aldy Hernandez
2013-02-18 23:05                       ` Jakub Jelinek
2013-02-21 23:03                         ` Steve Ellcey
2013-02-22  0:10                           ` Aldy Hernandez
2013-02-22 10:03                           ` Jakub Jelinek
2013-02-22 17:32                             ` Steve Ellcey
2013-02-22 18:17                               ` Jakub Jelinek
2013-02-22 19:49                                 ` Richard Sandiford
2013-03-01 23:37                             ` Steve Ellcey

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=87zjz9v31p.fsf@talisman.default \
    --to=rdsandiford@googlemail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@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).