OSDN Git Service

* gjavah.c (cxx_keyword_subst): Use ARRAY_SIZE.
[pf3gnuchains/gcc-fork.git] / gcc / lists.c
index 331b953..eb665b8 100644 (file)
@@ -1,5 +1,6 @@
 /* List management for the GNU C-Compiler expander.
-   Copyright (C) 1987, 88, 92-97, 1998, 1999 Free Software Foundation, Inc.
+   Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
+   1999 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -22,6 +23,10 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "toplev.h"
 #include "rtl.h"
+#include "ggc.h"
+
+static void free_list PARAMS ((rtx *, rtx *));
+static void zap_lists PARAMS ((void *));
 
 /* Functions for maintaining cache-able lists of EXPR_LIST and INSN_LISTs.  */
 
@@ -104,13 +109,36 @@ alloc_EXPR_LIST (kind, val, next)
 }
 
 /* This function will initialize the EXPR_LIST and INSN_LIST caches.  */
-void 
-init_EXPR_INSN_LIST_cache ()
+
+static void
+zap_lists (dummy)
+     void *dummy ATTRIBUTE_UNUSED;
 {
   unused_expr_list = NULL;
   unused_insn_list = NULL;
 }
 
+void 
+init_EXPR_INSN_LIST_cache ()
+{
+  if (ggc_p)
+    {
+      static int initialized;
+      if (!initialized)
+        {
+          initialized = 1;
+          ggc_add_root (&unused_expr_list, 1, 1, zap_lists);
+        }
+
+      /* No need to squish the lists across functions with GC enabled.  */
+    }
+  else
+    {
+      unused_expr_list = NULL;
+      unused_insn_list = NULL;
+    }
+}
+
 /* This function will free up an entire list of EXPR_LIST nodes.  */
 void 
 free_EXPR_LIST_list (listp)