OSDN Git Service

* combine.c (simplify_shift_const): Calculate rotate count
[pf3gnuchains/gcc-fork.git] / gcc / ggc.h
index 8d65b12..0cd87f4 100644 (file)
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -19,105 +19,69 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
 #include "varray.h"
+#include "gtype-desc.h"
 
 /* Symbols are marked with `ggc' for `gcc gc' so as not to interfere with
    an external gc library that might be linked in.  */
 
-/* These structures are defined in various headers throughout the
-   compiler.  However, rather than force everyone who includes this
-   header to include all the headers in which they are declared, we
-   just forward-declare them here.  */
-struct eh_status;
-struct emit_status;
-struct expr_status;
-struct hash_table;
-struct label_node;
-struct rtx_def;
-struct rtvec_def;
-struct stmt_status;
-union  tree_node;
-struct varasm_status;
-
 /* Constants for general use.  */
 extern const char empty_string[];      /* empty string */
 extern const char digit_vector[];      /* "0" .. "9" */
 #define digit_string(d) (digit_vector + ((d) * 2))
 
-/* Trees that have been marked, but whose children still need marking.  */
-extern varray_type ggc_pending_trees;
-
-/* Manipulate global roots that are needed between calls to gc.  */
+/* Manipulate global roots that are needed between calls to gc.  
+   THIS ROUTINE IS OBSOLETE, do not use it for new code.  */
 extern void ggc_add_root               PARAMS ((void *base, int nelt,
                                                 int size, void (*)(void *)));
-extern void ggc_add_rtx_root           PARAMS ((struct rtx_def **, int nelt));
-extern void ggc_add_tree_root          PARAMS ((union tree_node **,
-                                                int nelt));
-extern void ggc_add_rtx_varray_root    PARAMS ((struct varray_head_tag **,
-                                                int nelt));
-extern void ggc_add_tree_varray_root   PARAMS ((struct varray_head_tag **,
-                                                int nelt));
-extern void ggc_add_tree_hash_table_root PARAMS ((struct hash_table **,
-                                                 int nelt));
-extern void ggc_del_root               PARAMS ((void *base));
-
-/* Types used for mark test and marking functions, if specified, in call
-   below.  */
-typedef int (*ggc_htab_marked_p) PARAMS ((const void *));
-typedef void (*ggc_htab_mark) PARAMS ((const void *));
-
-/* Add a hash table to be scanned when all roots have been processed.  We
-   delete any entry in the table that has not been marked.  The argument is
-   really htab_t.  */
-extern void ggc_add_deletable_htab     PARAMS ((PTR, ggc_htab_marked_p,
-                                                ggc_htab_mark));
-
-/* Mark nodes from the gc_add_root callback.  These functions follow
-   pointers to mark other objects too.  */
-extern void ggc_mark_rtx_varray                PARAMS ((struct varray_head_tag *));
-extern void ggc_mark_tree_varray       PARAMS ((struct varray_head_tag *));
-extern void ggc_mark_tree_hash_table   PARAMS ((struct hash_table *));
+
+/* Structures for the easy way to mark roots.
+   In an array, terminated by having base == NULL.*/
+struct ggc_root_tab {
+  void *base;
+  size_t nelt;
+  size_t stride;
+  void (*cb) PARAMS ((void *));
+};
+#define LAST_GGC_ROOT_TAB { NULL, 0, 0, NULL }
+/* Pointers to arrays of ggc_root_tab, terminated by NULL.  */
+extern const struct ggc_root_tab * const gt_ggc_rtab[];
+extern const struct ggc_root_tab * const gt_ggc_deletable_rtab[];
+
+/* Structure for hash table cache marking.  */
+struct htab;
+struct ggc_cache_tab {
+  struct htab * *base;
+  size_t nelt;
+  size_t stride;
+  void (*cb) PARAMS ((void *));
+  int (*marked_p) PARAMS ((const void *));
+};
+#define LAST_GGC_CACHE_TAB { NULL, 0, 0, NULL, NULL }
+/* Pointers to arrays of ggc_cache_tab, terminated by NULL.  */
+extern const struct ggc_cache_tab * const gt_ggc_cache_rtab[];
+
 extern void ggc_mark_roots             PARAMS ((void));
 
 extern void ggc_mark_rtx_children      PARAMS ((struct rtx_def *));
-extern void ggc_mark_rtvec_children    PARAMS ((struct rtvec_def *));
 
 /* If EXPR is not NULL and previously unmarked, mark it and evaluate
    to true.  Otherwise evaluate to false.  */
 #define ggc_test_and_set_mark(EXPR) \
-  ((EXPR) != NULL && ! ggc_set_mark (EXPR))
+  ((EXPR) != NULL && ((void *) (EXPR)) != (void *) 1 && ! ggc_set_mark (EXPR))
 
 #define ggc_mark_rtx(EXPR)                      \
   do {                                          \
-    rtx r__ = (EXPR);                           \
+    rtx const r__ = (EXPR);                     \
     if (ggc_test_and_set_mark (r__))            \
       ggc_mark_rtx_children (r__);              \
   } while (0)
 
-#define ggc_mark_tree(EXPR)                            \
-  do {                                                 \
-    tree t__ = (EXPR);                                 \
-    if (ggc_test_and_set_mark (t__))                   \
-      VARRAY_PUSH_TREE (ggc_pending_trees, t__);       \
-  } while (0)
-
-#define ggc_mark_nonnull_tree(EXPR)                    \
-  do {                                                 \
-    tree t__ = (EXPR);                                 \
-    if (! ggc_set_mark (t__))                          \
-      VARRAY_PUSH_TREE (ggc_pending_trees, t__);       \
-  } while (0)
-
-#define ggc_mark_rtvec(EXPR)                    \
-  do {                                          \
-    rtvec v__ = (EXPR);                         \
-    if (ggc_test_and_set_mark (v__))            \
-      ggc_mark_rtvec_children (v__);            \
-  } while (0)
+#define ggc_mark_tree gt_ggc_m_tree_node
 
 #define ggc_mark(EXPR)                         \
   do {                                         \
-    const void *a__ = (EXPR);                  \
-    if (a__ != NULL)                           \
+    const void *const a__ = (EXPR);            \
+    if (a__ != NULL && a__ != (void *) 1)      \
       ggc_set_mark (a__);                      \
   } while (0)
 
@@ -141,6 +105,10 @@ extern void ggc_pop_context        PARAMS ((void));
 extern void *ggc_alloc         PARAMS ((size_t));
 /* Like ggc_alloc, but allocates cleared memory.  */
 extern void *ggc_alloc_cleared PARAMS ((size_t));
+/* Resize a block.  */
+extern void *ggc_realloc       PARAMS ((void *, size_t));
+/* Like ggc_alloc_cleared, but performs a multiplication.  */
+extern void *ggc_calloc                PARAMS ((size_t, size_t));
 
 #define ggc_alloc_rtx(NSLOTS)                                            \
   ((struct rtx_def *) ggc_alloc (sizeof (struct rtx_def)                 \
@@ -152,6 +120,9 @@ extern void *ggc_alloc_cleared      PARAMS ((size_t));
 
 #define ggc_alloc_tree(LENGTH) ((union tree_node *) ggc_alloc (LENGTH))
 
+#define htab_create_ggc(SIZE, HASH, EQ, DEL) \
+  htab_create_alloc (SIZE, HASH, EQ, DEL, ggc_calloc, NULL)
+
 /* Allocate a gc-able string, and fill it with LENGTH bytes from CONTENTS.
    If LENGTH is -1, then CONTENTS is assumed to be a
    null-terminated string and the memory sized accordingly.  */
@@ -172,42 +143,25 @@ extern void ggc_collect                   PARAMS ((void));
    pointers in this data structure should not be traversed.  */
 extern int ggc_set_mark                        PARAMS ((const void *));
 
-/* Return 1 if P has been marked, zero otherwise. 
+/* Return 1 if P has been marked, zero otherwise.
    P must have been allocated by the GC allocator; it mustn't point to
    static objects, stack variables, or memory allocated with malloc.  */
 extern int ggc_marked_p                        PARAMS ((const void *));
 
-/* Callbacks to the languages.  */
-
-/* The FALSE_LABEL_STACK, declared in except.h, has language-dependent
-   semantics.  If a front-end needs to mark the false label stack, it
-   should set this pointer to a non-NULL value.  Otherwise, no marking
-   will be done.  */
-extern void (*lang_mark_false_label_stack) PARAMS ((struct label_node *));
-
-/* Mark functions for various structs scattered about.  */
-
-void mark_eh_status                    PARAMS ((struct eh_status *));
-void mark_emit_status                  PARAMS ((struct emit_status *));
-void mark_expr_status                  PARAMS ((struct expr_status *));
-void mark_stmt_status                  PARAMS ((struct stmt_status *));
-void mark_varasm_status                        PARAMS ((struct varasm_status *));
-void mark_optab                                PARAMS ((void *));
-
 /* Statistics.  */
 
 /* This structure contains the statistics common to all collectors.
    Particular collectors can extend this structure.  */
-typedef struct ggc_statistics 
+typedef struct ggc_statistics
 {
   /* The Ith element is the number of nodes allocated with code I.  */
   unsigned num_trees[256];
-  /* The Ith element is the number of bytes allocated by nodes with 
+  /* The Ith element is the number of bytes allocated by nodes with
      code I.  */
   size_t size_trees[256];
   /* The Ith element is the number of nodes allocated with code I.  */
   unsigned num_rtxs[256];
-  /* The Ith element is the number of bytes allocated by nodes with 
+  /* The Ith element is the number of bytes allocated by nodes with
      code I.  */
   size_t size_rtxs[256];
   /* The total size of the tree nodes allocated.  */