aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2014-06-26 04:28:37 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2014-06-26 02:28:37 +0000
commitb9b5f43367ced552bdd92808fa3a38cb55cb2fd3 (patch)
tree3eaf13ad99f89c77885a9dbdccb807978ff0d594
parent3b89b26ef67f19fc775a2f923dfb4f6200d981f5 (diff)
downloadgcc-b9b5f43367ced552bdd92808fa3a38cb55cb2fd3.zip
gcc-b9b5f43367ced552bdd92808fa3a38cb55cb2fd3.tar.gz
gcc-b9b5f43367ced552bdd92808fa3a38cb55cb2fd3.tar.bz2
toplev.c (backend_init_target): Move init_emit_regs and init_regs to...
* 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. From-SVN: r212007
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/function.c5
-rw-r--r--gcc/rtl.h4
-rw-r--r--gcc/toplev.c54
-rw-r--r--gcc/toplev.h2
5 files changed, 66 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48d6f22..ba0f832 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2014-06-25 Jan Hubicka <hubicka@ucw.cz>
+
+ * 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.
+
2014-06-25 Paul Gortmaker <paul.gortmaker@windriver.com>
Jakub Jelinek <jakub@redhat.com>
diff --git a/gcc/function.c b/gcc/function.c
index 441289e..001c579 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -64,6 +64,7 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "bb-reorder.h"
#include "shrink-wrap.h"
+#include "toplev.h"
/* So we can assign to cfun in this file. */
#undef cfun
@@ -4630,6 +4631,10 @@ init_function_start (tree subr)
set_cfun (DECL_STRUCT_FUNCTION (subr));
else
allocate_struct_function (subr, false);
+
+ /* Initialize backend, if needed. */
+ initialize_rtl ();
+
prepare_function_start ();
decide_function_section (subr);
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 6ec91a8..8eb215c 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2514,6 +2514,10 @@ struct GTY(()) target_rtl {
/* The default memory attributes for each mode. */
struct mem_attrs *x_mode_mem_attrs[(int) MAX_MACHINE_MODE];
+
+ /* Track if RTL has been initialized. */
+ bool target_specific_initialized;
+ bool lang_dependent_initialized;
};
extern GTY(()) struct target_rtl default_target_rtl;
diff --git a/gcc/toplev.c b/gcc/toplev.c
index fcd0e43..e35b826 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1583,14 +1583,6 @@ backend_init_target (void)
/* Initialize alignment variables. */
init_alignments ();
- /* This reinitializes hard_frame_pointer, and calls init_reg_modes_target()
- to initialize reg_raw_mode[]. */
- init_emit_regs ();
-
- /* This invokes target hooks to set fixed_reg[] etc, which is
- mode-dependent. */
- init_regs ();
-
/* This depends on stack_pointer_rtx. */
init_fake_stack_mems ();
@@ -1632,9 +1624,13 @@ backend_init (void)
init_varasm_once ();
save_register_info ();
- /* Initialize the target-specific back end pieces. */
- ira_init_once ();
- backend_init_target ();
+ /* Middle end needs this initialization for default mem attributes
+ used by early calls to make_decl_rtl. */
+ init_emit_regs ();
+
+ /* Middle end needs this initialization for mode tables used to assign
+ modes to vector variables. */
+ init_regs ();
}
/* Initialize excess precision settings. */
@@ -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->target_specific_initialized = false;
+
+ /* This initializes hard_frame_pointer, and calls init_reg_modes_target()
+ to initialize reg_raw_mode[]. */
+ init_emit_regs ();
+
+ /* This invokes target hooks to set fixed_reg[] etc, which is
+ mode-dependent. */
+ init_regs ();
/* Reinitialize lang-dependent parts. */
lang_dependent_init_target ();
diff --git a/gcc/toplev.h b/gcc/toplev.h
index 0290be3..1b54578 100644
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -77,4 +77,6 @@ extern bool set_src_pwd (const char *);
extern HOST_WIDE_INT get_random_seed (bool);
extern const char *set_random_seed (const char *);
+extern void initialize_rtl (void);
+
#endif /* ! GCC_TOPLEV_H */