/* Miscellaneous utilities for GIMPLE streaming. Things that are used
in both input and output are here.
- Copyright 2009 Free Software Foundation, Inc.
+ Copyright 2009, 2010 Free Software Foundation, Inc.
Contributed by Doug Kwan <dougkwan@google.com>
This file is part of GCC.
switch (section_type)
{
case LTO_section_function_body:
+ gcc_assert (name != NULL);
+ if (name[0] == '*')
+ name++;
return concat (LTO_SECTION_NAME_PREFIX, name, NULL);
case LTO_section_static_initializer:
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);
+
case LTO_section_ipa_pure_const:
return concat (LTO_SECTION_NAME_PREFIX, ".pureconst", NULL);
case LTO_section_ipa_reference:
return concat (LTO_SECTION_NAME_PREFIX, ".reference", NULL);
- case LTO_section_wpa_fixup:
- return concat (LTO_SECTION_NAME_PREFIX, ".wpa_fixup", NULL);
-
case LTO_section_opts:
return concat (LTO_SECTION_NAME_PREFIX, ".opts", NULL);
fprintf (stderr, "[%s] # of input files: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s, lto_stats.num_input_files);
- fprintf (stderr, "[%s] # of input cgraph nodes: "
+ fprintf (stderr, "[%s] # of input cgraph nodes: "
HOST_WIDE_INT_PRINT_UNSIGNED "\n", s,
lto_stats.num_input_cgraph_nodes);
*ix_p = ix;
if (offset_p)
- *offset_p = offset;
+ *offset_p = offset;
return existed_p;
}
These should be assured in pass_ipa_free_lang_data. */
gcc_assert (fileptr_type_node == ptr_type_node);
gcc_assert (TYPE_MAIN_VARIANT (fileptr_type_node) == ptr_type_node);
-
+
seen_nodes = pointer_set_create ();
/* Skip itk_char. char_type_node is shared with the appropriately
}
+#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
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
}
session can be started on both reader and writer using ORIG_T
as a breakpoint value in both sessions.
- Note that this mapping is transient and only valid while T is
+ Note that this mapping is transient and only valid while T is
being reconstructed. Once T is fully built, the mapping is
removed. */
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;
}
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);
}
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