public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org, mjambor@suse.cz
Subject: Cgraph alias reorg 10/14 (C++ fe tweek)
Date: Fri, 10 Jun 2011 18:32:00 -0000	[thread overview]
Message-ID: <20110610182931.GI28776@kam.mff.cuni.cz> (raw)

Hi,
this patch makes C++ FE to use cgraph_for_node_and_aliases instead of doing it on its
own.  It helps the transition to new aliases since I don't have to update the code in question.

Bootstrapped/regtested x86_64-linux, comitted as obvoius.

Honza

	* decl2.c (clear_decl_external): New functoin.
	(cp_write_global_declarations): Use it.
Index: cp/decl2.c
===================================================================
*** cp/decl2.c	(revision 174913)
--- cp/decl2.c	(working copy)
*************** collect_all_refs (const char *source_fil
*** 3635,3640 ****
--- 3635,3649 ----
    collect_ada_namespace (global_namespace, source_file);
  }
  
+ /* Clear DECL_EXTERNAL for NODE.  */
+ 
+ static bool
+ clear_decl_external (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
+ {
+   DECL_EXTERNAL (node->decl) = 0;
+   return false;
+ }
+ 
  /* This routine is called at the end of compilation.
     Its job is to create all the code needed to initialize and
     destroy the global aggregates.  We do the destruction
*************** cp_write_global_declarations (void)
*** 3857,3873 ****
  	      && DECL_INITIAL (decl)
  	      && decl_needed_p (decl))
  	    {
! 	      struct cgraph_node *node = cgraph_get_node (decl), *alias, *next;
  
! 	      DECL_EXTERNAL (decl) = 0;
! 	      /* If we mark !DECL_EXTERNAL one of the same body aliases,
! 		 we need to mark all of them that way.  */
! 	      if (node && node->same_body)
! 		{
! 		  DECL_EXTERNAL (node->decl) = 0;
! 		  for (alias = node->same_body; alias; alias = alias->next)
! 		    DECL_EXTERNAL (alias->decl) = 0;
! 		}
  	      /* If we mark !DECL_EXTERNAL one of the symbols in some comdat
  		 group, we need to mark all symbols in the same comdat group
  		 that way.  */
--- 3866,3880 ----
  	      && DECL_INITIAL (decl)
  	      && decl_needed_p (decl))
  	    {
! 	      struct cgraph_node *node, *next;
  
! 	      node = cgraph_get_node (decl);
! 	      if (node->alias
! 		  && VEC_length (ipa_ref_t, node->ref_list.references))
! 		node = cgraph_alias_aliased_node (node);
! 
! 	      cgraph_for_node_and_aliases (node, clear_decl_external,
! 					   NULL, true);
  	      /* If we mark !DECL_EXTERNAL one of the symbols in some comdat
  		 group, we need to mark all symbols in the same comdat group
  		 that way.  */
*************** cp_write_global_declarations (void)
*** 3875,3890 ****
  		for (next = node->same_comdat_group;
  		     next != node;
  		     next = next->same_comdat_group)
! 		  {
! 		    DECL_EXTERNAL (next->decl) = 0;
! 		    if (next->same_body)
! 		      {
! 			for (alias = next->same_body;
! 			     alias;
! 			     alias = alias->next)
! 			  DECL_EXTERNAL (alias->decl) = 0;
! 		      }
! 		  }
  	    }
  
  	  /* If we're going to need to write this function out, and
--- 3882,3889 ----
  		for (next = node->same_comdat_group;
  		     next != node;
  		     next = next->same_comdat_group)
! 	          cgraph_for_node_and_aliases (next, clear_decl_external,
! 					       NULL, true);
  	    }
  
  	  /* If we're going to need to write this function out, and

                 reply	other threads:[~2011-06-10 18:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110610182931.GI28776@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).