public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH,c++] convert repo.c:pending_repo into a VEC
@ 2010-06-30  2:06 Nathan Froyd
  2010-06-30 13:25 ` Diego Novillo
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2010-06-30  2:06 UTC (permalink / raw)
  To: gcc-patches

As $SUBJECT indicates.  More TREE_LIST removal, hooray, hooray.

Tested on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

	* repo.c (pending_repo): Change type to a VEC.
	(finish_repo): Adjust for new type of pending_repo.
	(repo_emit_p): Likewise.

diff --git a/gcc/cp/repo.c b/gcc/cp/repo.c
index 08a4d62..15c6d65 100644
--- a/gcc/cp/repo.c
+++ b/gcc/cp/repo.c
@@ -43,7 +43,7 @@ static FILE *open_repo_file (const char *);
 static char *afgets (FILE *);
 static FILE *reopen_repo_file_for_write (void);
 
-static GTY(()) tree pending_repo;
+static GTY(()) VEC(tree,gc) *pending_repo;
 static char *repo_name;
 
 static const char *old_args, *old_dir, *old_main;
@@ -236,9 +236,10 @@ reopen_repo_file_for_write (void)
 void
 finish_repo (void)
 {
-  tree t;
+  tree val;
   char *dir, *args;
   FILE *repo_file;
+  unsigned ix;
 
   if (!flag_use_repository || flag_compare_debug)
     return;
@@ -266,9 +267,10 @@ finish_repo (void)
       fprintf (repo_file, "\n");
     }
 
-  for (t = pending_repo; t; t = TREE_CHAIN (t))
+  for (ix = VEC_length (tree, pending_repo) - 1;
+       VEC_iterate (tree, pending_repo, ix, val);
+       ix--);
     {
-      tree val = TREE_VALUE (t);
       tree name = DECL_ASSEMBLER_NAME (val);
       char type = IDENTIFIER_REPO_CHOSEN (name) ? 'C' : 'O';
       fprintf (repo_file, "%c %s\n", type, IDENTIFIER_POINTER (name));
@@ -352,7 +354,7 @@ repo_emit_p (tree decl)
   if (!DECL_REPO_AVAILABLE_P (decl))
     {
       DECL_REPO_AVAILABLE_P (decl) = 1;
-      pending_repo = tree_cons (NULL_TREE, decl, pending_repo);
+      VEC_safe_push (tree, gc, pending_repo, decl);
     }
 
   return IDENTIFIER_REPO_CHOSEN (DECL_ASSEMBLER_NAME (decl)) ? 1 : ret;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH,c++] convert repo.c:pending_repo into a VEC
  2010-06-30  2:06 [PATCH,c++] convert repo.c:pending_repo into a VEC Nathan Froyd
@ 2010-06-30 13:25 ` Diego Novillo
  0 siblings, 0 replies; 2+ messages in thread
From: Diego Novillo @ 2010-06-30 13:25 UTC (permalink / raw)
  To: Nathan Froyd; +Cc: gcc-patches

On Tue, Jun 29, 2010 at 21:30, Nathan Froyd <froydnj@codesourcery.com> wrote:
> As $SUBJECT indicates.  More TREE_LIST removal, hooray, hooray.
>
> Tested on x86_64-unknown-linux-gnu.  OK to commit?
>
> -Nathan
>
>        * repo.c (pending_repo): Change type to a VEC.
>        (finish_repo): Adjust for new type of pending_repo.
>        (repo_emit_p): Likewise.

OK.


Diego.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-30 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-30  2:06 [PATCH,c++] convert repo.c:pending_repo into a VEC Nathan Froyd
2010-06-30 13:25 ` Diego Novillo

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).