Patchwork [C,C++] Move common tree node building to c_common_nodes_and_builtins

login
register
mail settings
Submitter Richard Guenther
Date July 5, 2011, 11:20 a.m.
Message ID <alpine.LNX.2.00.1107051317230.810@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/103253/
State New
Headers show

Comments

Richard Guenther - July 5, 2011, 11:20 a.m.
This consolidates build_common_tree_nodes and build_common_tree_nodes_2
at a single place in c_common_nodes_and_builtins for C family languages.
It is a preparation for merging those two functions and moving them
to be called from toplev.c as they are middle-end inits.

Bootstrapped and tested on x86_64-unknown-linux-gnu for all C
family languages and Java.

Ok for trunk?

Thanks,
Richard.

2011-07-05  Richard Guenther  <rguenther@suse.de>

	c-family/
	* c-common.c (c_common_nodes_and_builtins): Build all common
	tree nodes first.

	* c-decl.c (c_init_decl_processing): Defer building common
	tree nodes to c_common_nodes_and_builtins.

	cp/
	* decl.c (cxx_init_decl_processing): Defer building common
	tree nodes to c_common_nodes_and_builtins.
Joseph S. Myers - July 5, 2011, 1:03 p.m.
On Tue, 5 Jul 2011, Richard Guenther wrote:

> This consolidates build_common_tree_nodes and build_common_tree_nodes_2
> at a single place in c_common_nodes_and_builtins for C family languages.
> It is a preparation for merging those two functions and moving them
> to be called from toplev.c as they are middle-end inits.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu for all C
> family languages and Java.
> 
> Ok for trunk?

The c-common.c and c-decl.c changes are OK.
Jason Merrill - July 5, 2011, 2:36 p.m.
OK.

Jason

Patch

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c	(revision 175840)
+++ gcc/c-family/c-common.c	(working copy)
@@ -4576,6 +4576,9 @@  c_common_nodes_and_builtins (void)
   tree va_list_ref_type_node;
   tree va_list_arg_type_node;
 
+  build_common_tree_nodes (flag_signed_char);
+  build_common_tree_nodes_2 (flag_short_double);
+
   /* Define `int' and `char' first so that dbx will output them first.  */
   record_builtin_type (RID_INT, NULL, integer_type_node);
   record_builtin_type (RID_CHAR, "char", char_type_node);
@@ -4675,8 +4678,6 @@  c_common_nodes_and_builtins (void)
   pid_type_node =
     TREE_TYPE (identifier_global_value (get_identifier (PID_TYPE)));
 
-  build_common_tree_nodes_2 (flag_short_double);
-
   record_builtin_type (RID_FLOAT, NULL, float_type_node);
   record_builtin_type (RID_DOUBLE, NULL, double_type_node);
   record_builtin_type (RID_MAX, "long double", long_double_type_node);
Index: gcc/c-decl.c
===================================================================
--- gcc/c-decl.c	(revision 175840)
+++ gcc/c-decl.c	(working copy)
@@ -3478,8 +3478,6 @@  c_init_decl_processing (void)
      using preprocessed headers.  */
   input_location = BUILTINS_LOCATION;
 
-  build_common_tree_nodes (flag_signed_char);
-
   c_common_nodes_and_builtins ();
 
   /* In C, comparisons and TRUTH_* expressions have type int.  */
Index: gcc/cp/decl.c
===================================================================
--- gcc/cp/decl.c	(revision 175840)
+++ gcc/cp/decl.c	(working copy)
@@ -3518,8 +3518,6 @@  cxx_init_decl_processing (void)
   tree void_ftype;
   tree void_ftype_ptr;
 
-  build_common_tree_nodes (flag_signed_char);
-
   /* Create all the identifiers we need.  */
   initialize_predefined_identifiers ();
 
@@ -3536,8 +3534,6 @@  cxx_init_decl_processing (void)
   TREE_PUBLIC (global_namespace) = 1;
   begin_scope (sk_namespace, global_namespace);
 
-  current_lang_name = NULL_TREE;
-
   if (flag_visibility_ms_compat)
     default_visibility = VISIBILITY_HIDDEN;