OSDN Git Service

* Makefile.in (cgraphbuild.o): Add dependency on except.h.
[pf3gnuchains/gcc-fork.git] / gcc / lto-streamer.c
index 46d6154..01703f1 100644 (file)
@@ -160,6 +160,12 @@ lto_get_section_name (int section_type, const char *name)
     case LTO_section_cgraph:
       return concat (LTO_SECTION_NAME_PREFIX, ".cgraph", NULL);
 
+    case LTO_section_varpool:
+      return concat (LTO_SECTION_NAME_PREFIX, ".vars", NULL);
+
+    case LTO_section_refs:
+      return concat (LTO_SECTION_NAME_PREFIX, ".refs", NULL);
+
     case LTO_section_jump_functions:
       return concat (LTO_SECTION_NAME_PREFIX, ".jmpfuncs", NULL);
 
@@ -785,6 +791,31 @@ lto_streamer_cache_delete (struct lto_streamer_cache_d *c)
 }
 
 
+#ifdef LTO_STREAMER_DEBUG
+static htab_t tree_htab;
+
+struct tree_hash_entry
+{
+  tree key;
+  intptr_t value;
+};
+
+static hashval_t
+hash_tree (const void *p)
+{
+  const struct tree_hash_entry *e = (const struct tree_hash_entry *) p;
+  return htab_hash_pointer (e->key);
+}
+
+static int
+eq_tree (const void *p1, const void *p2)
+{
+  const struct tree_hash_entry *e1 = (const struct tree_hash_entry *) p1;
+  const struct tree_hash_entry *e2 = (const struct tree_hash_entry *) p2;
+  return (e1->key == e2->key);
+}
+#endif
+
 /* Initialization common to the LTO reader and writer.  */
 
 void
@@ -795,6 +826,10 @@ lto_streamer_init (void)
      new TS_* astructure is added, the streamer should be updated to
      handle it.  */
   check_handled_ts_structures ();
+
+#ifdef LTO_STREAMER_DEBUG
+  tree_htab = htab_create (31, hash_tree, eq_tree, NULL);
+#endif
 }
 
 
@@ -823,10 +858,16 @@ gate_lto_out (void)
 void
 lto_orig_address_map (tree t, intptr_t orig_t)
 {
-  /* FIXME lto.  Using the annotation field is quite hacky as it relies
-     on the GC not running while T is being rematerialized.  It would
-     be cleaner to use a hash table here.  */
-  t->base.ann = (union tree_ann_d *) orig_t;
+  struct tree_hash_entry ent;
+  struct tree_hash_entry **slot;
+
+  ent.key = t;
+  ent.value = orig_t;
+  slot
+    = (struct tree_hash_entry **) htab_find_slot (tree_htab, &ent, INSERT);
+  gcc_assert (!*slot);
+  *slot = XNEW (struct tree_hash_entry);
+  **slot = ent;
 }
 
 
@@ -836,7 +877,13 @@ lto_orig_address_map (tree t, intptr_t orig_t)
 intptr_t
 lto_orig_address_get (tree t)
 {
-  return (intptr_t) t->base.ann;
+  struct tree_hash_entry ent;
+  struct tree_hash_entry **slot;
+
+  ent.key = t;
+  slot
+    = (struct tree_hash_entry **) htab_find_slot (tree_htab, &ent, NO_INSERT);
+  return (slot ? (*slot)->value : 0);
 }
 
 
@@ -845,7 +892,15 @@ lto_orig_address_get (tree t)
 void
 lto_orig_address_remove (tree t)
 {
-  t->base.ann = NULL;
+  struct tree_hash_entry ent;
+  struct tree_hash_entry **slot;
+
+  ent.key = t;
+  slot
+    = (struct tree_hash_entry **) htab_find_slot (tree_htab, &ent, NO_INSERT);
+  gcc_assert (slot);
+  free (*slot);
+  htab_clear_slot (tree_htab, (PTR *)slot);
 }
 #endif