* RFA: current_function_funcdef_no vs. target_reinit
@ 2008-06-26 21:16 Richard Sandiford
2008-06-26 21:52 ` Richard Guenther
0 siblings, 1 reply; 2+ messages in thread
From: Richard Sandiford @ 2008-06-26 21:16 UTC (permalink / raw)
To: gcc-patches
I think we should make:
...switch to a new subtarget...
target_reinit ();
...switch back to the old subtarget...
target_reinit ();
a no-op sequence as far as possible. For example, PCH files should
only be sensitive to the target in use for each given function;
they should not be sensitive the _number_ of target_reinit calls.
This patch fixes one case where the sequence isn't a no-op.
backend_init_target has the following code:
/* The following initialization functions need to generate rtl, so
provide a dummy function context for them. */
init_dummy_function_start ();
And this dummy function gets a unique function definition number,
meaning that the call leaves a trace in function.c:funcdef_no.
A definition number of 0 should be fine for the dummy function,
so this patch only allocates a unique number for non-null decls.
Tested on mipsisa64-elfoabi and x86_64-linux-gnu. It fixes some
PCH regressions caused by another patch that I'm about to post.
OK to install?
Richard
gcc/
* function.c (allocate_struct_function): Only allocate a unique
funcdef_no if the decl is nonzero.
Index: gcc/function.c
===================================================================
--- gcc/function.c 2008-06-24 17:15:41.000000000 +0100
+++ gcc/function.c 2008-06-24 17:16:05.000000000 +0100
@@ -3843,8 +3843,6 @@ allocate_struct_function (tree fndecl, b
cfun = ggc_alloc_cleared (sizeof (struct function));
- current_function_funcdef_no = get_next_funcdef_no ();
-
cfun->function_frequency = FUNCTION_FREQUENCY_NORMAL;
init_eh_for_function ();
@@ -3860,6 +3858,7 @@ allocate_struct_function (tree fndecl, b
{
DECL_STRUCT_FUNCTION (fndecl) = cfun;
cfun->decl = fndecl;
+ current_function_funcdef_no = get_next_funcdef_no ();
result = DECL_RESULT (fndecl);
if (!abstract_p && aggregate_value_p (result, fndecl))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: RFA: current_function_funcdef_no vs. target_reinit
2008-06-26 21:16 RFA: current_function_funcdef_no vs. target_reinit Richard Sandiford
@ 2008-06-26 21:52 ` Richard Guenther
0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2008-06-26 21:52 UTC (permalink / raw)
To: gcc-patches, rdsandiford
On Thu, Jun 26, 2008 at 11:13 PM, Richard Sandiford
<rdsandiford@googlemail.com> wrote:
> I think we should make:
>
> ...switch to a new subtarget...
> target_reinit ();
> ...switch back to the old subtarget...
> target_reinit ();
>
> a no-op sequence as far as possible. For example, PCH files should
> only be sensitive to the target in use for each given function;
> they should not be sensitive the _number_ of target_reinit calls.
>
> This patch fixes one case where the sequence isn't a no-op.
> backend_init_target has the following code:
>
> /* The following initialization functions need to generate rtl, so
> provide a dummy function context for them. */
> init_dummy_function_start ();
>
> And this dummy function gets a unique function definition number,
> meaning that the call leaves a trace in function.c:funcdef_no.
>
> A definition number of 0 should be fine for the dummy function,
> so this patch only allocates a unique number for non-null decls.
>
> Tested on mipsisa64-elfoabi and x86_64-linux-gnu. It fixes some
> PCH regressions caused by another patch that I'm about to post.
> OK to install?
Ok.
Thanks,
Richard.
> Richard
>
>
> gcc/
> * function.c (allocate_struct_function): Only allocate a unique
> funcdef_no if the decl is nonzero.
>
> Index: gcc/function.c
> ===================================================================
> --- gcc/function.c 2008-06-24 17:15:41.000000000 +0100
> +++ gcc/function.c 2008-06-24 17:16:05.000000000 +0100
> @@ -3843,8 +3843,6 @@ allocate_struct_function (tree fndecl, b
>
> cfun = ggc_alloc_cleared (sizeof (struct function));
>
> - current_function_funcdef_no = get_next_funcdef_no ();
> -
> cfun->function_frequency = FUNCTION_FREQUENCY_NORMAL;
>
> init_eh_for_function ();
> @@ -3860,6 +3858,7 @@ allocate_struct_function (tree fndecl, b
> {
> DECL_STRUCT_FUNCTION (fndecl) = cfun;
> cfun->decl = fndecl;
> + current_function_funcdef_no = get_next_funcdef_no ();
>
> result = DECL_RESULT (fndecl);
> if (!abstract_p && aggregate_value_p (result, fndecl))
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-26 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-26 21:16 RFA: current_function_funcdef_no vs. target_reinit Richard Sandiford
2008-06-26 21:52 ` Richard Guenther
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).