This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: proposed patch for struct reorg branch


I just committed this change. Most of it was a merge with the tree profiling branch as of 12/08/2004 and the rest are contained in the enclosed patch and listed below.


2004-12-09 Kenneth Zadeck <Kenneth.Zadeck@NaturalBridge.com> * tree-gimple.c (get_base_var): missing const_decl case. * cgraphunit.c (cgraph_mark_nonexportable): remove. (cgraph_function_and_variable_visibility): added global_export attribute.

kenny



Dale Johannesen wrote:


On Dec 9, 2004, at 8:11 AM, Kenneth Zadeck wrote:


I would like to commit the following patch to the struct reorg branch. This patch was prepared by Danny and myself.
I will get the changelogs correct after this is approved for commit.


For the most part this patch just brings forward all of the changes on the profiling branch. These are needed by what I am planning to do on this branch.


This is OK with the Apple people. Glad you told me, I was in the process of bringing t-p branch over.

Index: gcc/tree-gimple.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-gimple.c,v
retrieving revision 2.1.2.3.2.1
diff -c -3 -p -u -p -r2.1.2.3.2.1 tree-gimple.c
--- gcc/tree-gimple.c	22 Nov 2004 23:48:50 -0000	2.1.2.3.2.1
+++ gcc/tree-gimple.c	9 Dec 2004 15:47:29 -0000
@@ -442,7 +461,8 @@ get_base_var (tree t)
   while (!SSA_VAR_P (t) 
 	 && (!CONSTANT_CLASS_P (t))
 	 && TREE_CODE (t) != LABEL_DECL
-	 && TREE_CODE (t) != FUNCTION_DECL)
+	 && TREE_CODE (t) != FUNCTION_DECL
+	 && TREE_CODE (t) != CONST_DECL)
     {
       t = TREE_OPERAND (t, 0);
     }

Index: gcc/cgraphunit.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.35.2.12.2.11
diff -c -3 -p -u -p -r1.1.4.35.2.12.2.11 cgraphunit.c
--- gcc/cgraphunit.c	22 Nov 2004 23:46:26 -0000	1.1.4.35.2.12.2.11
+++ gcc/cgraphunit.c	9 Dec 2004 15:47:26 -0000
@@ -2200,8 +1094,9 @@ cgraph_function_and_variable_visibility 
 	      || (TREE_PUBLIC (node->decl) && !DECL_EXTERNAL (node->decl)
 		  && !flag_whole_program)))
 	node->local.externally_visible = 1;
-      if (!node->local.externally_visible && node->analyzed
+      if ((!node->local.externally_visible && node->analyzed
 	  && !DECL_EXTERNAL (node->decl))
+	  && !lookup_attribute ("global_export", DECL_ATTRIBUTES (node->decl)))
 	{
 	  gcc_assert (flag_whole_program || !TREE_PUBLIC (node->decl));
 	  TREE_PUBLIC (node->decl) = 0;
@@ -2216,7 +1111,8 @@ cgraph_function_and_variable_visibility 
 	  && (DECL_COMDAT (vnode->decl)
 	      || (TREE_PUBLIC (vnode->decl) && !flag_whole_program)))
 	vnode->externally_visible = 1;
-      if (!vnode->externally_visible)
+      if (!vnode->externally_visible 
+	  && !lookup_attribute ("global_export", DECL_ATTRIBUTES (vnode->decl)))
 	{
 	  gcc_assert (flag_whole_program || !TREE_PUBLIC (vnode->decl));
 	  TREE_PUBLIC (vnode->decl) = 0;
@@ -2264,47 +1160,3 @@ cgraph_preserve_function_body_p (tree de
   return false;
 }
 
-/* Nothing in the current compilation, other than main, should be
-   allowed to be externally visible.  Fix the TREE_PUBLIC field to make
-   this so.  */
-
-static void 
-cgraph_mark_nonexportable (void)
-{
-  struct cgraph_node *c_node;
-  struct cgraph_varpool_node *current_varpool;
-  tree var_decl;
-  bool main_found = false;
-
-  for (current_varpool = cgraph_varpool_nodes_queue; current_varpool;
-       current_varpool = current_varpool->next_needed)
-    {
-      
-      var_decl = current_varpool->decl;
-      if (!var_decl || TREE_CODE (var_decl) != VAR_DECL)
-	continue;
-      
-      if (! lookup_attribute ("global_export", DECL_ATTRIBUTES (var_decl)))
-	TREE_PUBLIC (var_decl) = 0;
-    }
-
-  for (c_node = cgraph_nodes; c_node; c_node = c_node->next)
-    {
-      tree fn_decl = c_node->decl;
-
-      if ((TREE_STATIC (fn_decl))
-	  && (TREE_PUBLIC (fn_decl)))
-	{
-	  if (strcmp (IDENTIFIER_POINTER (DECL_NAME (fn_decl)), "main")
-	      == 0)
-	    main_found = true;
-	  else
-	    if (! lookup_attribute ("global_export", DECL_ATTRIBUTES (fn_decl)))
-	      TREE_PUBLIC (fn_decl) = 0;
-	}
-    }
-
-  if (!main_found)
-    internal_error ("No function 'main' found, with -fwhole-program flag.\n");
-}
-

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]