This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Delay RTL initialization until it is really needed
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jeff Law <law at redhat dot com>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 Jun 2014 09:09:46 +0200
- Subject: Re: Delay RTL initialization until it is really needed
- Authentication-results: sourceware.org; auth=none
- References: <20140620075143 dot GA27603 at kam dot mff dot cuni dot cz> <53A9CF8A dot 1030107 at redhat dot com>
> On 06/20/14 01:51, Jan Hubicka wrote:
> >Hi,
> >IRA initialization shows high in profiles even when building lto objects. This patch simply
> >delays RTL backend initialization until we really decide to output a function. In some cases
> >this avoids the initialization completely (like in the case of LTO but also user target attributes)
> >and there is some hope for better cache locality.
> >
> >Basic idea is to have two flags saying whether lang and target dependent bits
> >needs initialization and check it when starting function codegen.
> >
> >Bootstrapped/regtested x86_64-linux, testing also at AIX. Ok if it passes?
> >
> >Honza
> >
> > * toplev.c (backend_init_target): Move init_emit_regs and init_regs to...
> > (backend_init) ... here; skip ira_init_once and backend_init_target.
> > (target_reinit) ... and here; clear this_target_rtl->lang_dependent_initialized.
> > (lang_dependent_init_target): Clear this_target_rtl->lang_dependent_initialized;
> > break out rtl initialization to ...
> > (initialize_rtl): ... here; call also backend_init_target and ira_init_once.
> > * toplev.h (initialize_rtl): New function.
> > * function.c: Include toplev.h
> > (init_function_start): Call initialize_rtl.
> > * rtl.h (target_rtl): Add target_specific_initialized,
> > lang_dependent_initialized.
> >Index: toplev.c
> >===================================================================
> >--- toplev.c (revision 211837)
> >+++ toplev.c (working copy)
> >@@ -1686,6 +1682,31 @@ lang_dependent_init_target (void)
> > front end is initialized. It also depends on the HAVE_xxx macros
> > generated from the target machine description. */
> > init_optabs ();
> >+ this_target_rtl->lang_dependent_initialized = false;
> >+}
> >+
> >+/* Perform initializations that are lang-dependent or target-dependent.
> >+ but matters only for late optimizations and RTL generation. */
> >+
> >+void
> >+initialize_rtl (void)
> >+{
> >+ static int initialized_once;
> >+
> >+ /* Initialization done just once per compilation, but delayed
> >+ till code generation. */
> >+ if (!initialized_once)
> >+ ira_init_once ();
> >+ initialized_once = true;
> >+
> >+ /* Target specific RTL backend initialization. */
> >+ if (!this_target_rtl->target_specific_initialized)
> >+ backend_init_target ();
> >+ this_target_rtl->target_specific_initialized = true;
> >+
> >+ if (this_target_rtl->lang_dependent_initialized)
> >+ return;
> >+ this_target_rtl->lang_dependent_initialized = true;
> >
> > /* The following initialization functions need to generate rtl, so
> > provide a dummy function context for them. */
> >@@ -1784,8 +1805,15 @@ target_reinit (void)
> > regno_reg_rtx = NULL;
> > }
> >
> >- /* Reinitialize RTL backend. */
> >- backend_init_target ();
> >+ this_target_rtl->lang_dependent_initialized = false;
> Do you want to reset target_specific_initialized here as well?
Actually I meant to only resert target_specific_initialized.
lang_dependent_initialized is reset few lines later by call
to lang_dependent_init_target.
I am re-testing with this change. OK?
Honza
>
>
>
> Jeff