/* Miscellaneous utilities for GIMPLE streaming. Things that are used
in both input and output are here.
- Copyright (C) 2009-2016 Free Software Foundation, Inc.
+ Copyright (C) 2009-2020 Free Software Foundation, Inc.
Contributed by Doug Kwan <dougkwan@google.com>
This file is part of GCC.
/* Statistics gathered during LTO, WPA and LTRANS. */
struct lto_stats_d lto_stats;
-/* LTO uses bitmaps with different life-times. So use a separate
- obstack for all LTO bitmaps. */
-static bitmap_obstack lto_obstack;
-static bool lto_obstack_initialized;
-
const char *section_name_prefix = LTO_SECTION_NAME_PREFIX;
/* Set when streaming LTO for offloading compiler. */
bool lto_stream_offload_p;
+FILE *streamer_dump_file;
+
/* Return a string representing LTO tag TAG. */
const char *
}
-/* Allocate a bitmap from heap. Initializes the LTO obstack if necessary. */
-
-bitmap
-lto_bitmap_alloc (void)
-{
- if (!lto_obstack_initialized)
- {
- bitmap_obstack_initialize (<o_obstack);
- lto_obstack_initialized = true;
- }
- return BITMAP_ALLOC (<o_obstack);
-}
-
-/* Free bitmap B. */
-
-void
-lto_bitmap_free (bitmap b)
-{
- BITMAP_FREE (b);
-}
-
-
/* Get a section name for a particular type or name. The NAME field
is only used if SECTION_TYPE is LTO_section_function_body. For all
others it is ignored. The callee of this function is responsible
to free the returned name. */
char *
-lto_get_section_name (int section_type, const char *name, struct lto_file_decl_data *f)
+lto_get_section_name (int section_type, const char *name,
+ int node_order, struct lto_file_decl_data *f)
{
const char *add;
char post[32];
gcc_assert (name != NULL);
if (name[0] == '*')
name++;
- add = name;
+
+ char *buffer = (char *)xmalloc (strlen (name) + 32);
+ sprintf (buffer, "%s.%d", name, node_order);
+
+ add = buffer;
sep = "";
}
else if (section_type < LTO_N_SECTION_TYPES)
lto_section_name[i], lto_stats.section_size[i]);
}
-
-#ifdef LTO_STREAMER_DEBUG
-struct tree_hash_entry
-{
- tree key;
- intptr_t value;
-};
-
-struct tree_entry_hasher : nofree_ptr_hash <tree_hash_entry>
-{
- static inline hashval_t hash (const tree_hash_entry *);
- static inline bool equal (const tree_hash_entry *, const tree_hash_entry *);
-};
-
-inline hashval_t
-tree_entry_hasher::hash (const tree_hash_entry *e)
-{
- return htab_hash_pointer (e->key);
-}
-
-inline bool
-tree_entry_hasher::equal (const tree_hash_entry *e1, const tree_hash_entry *e2)
-{
- return (e1->key == e2->key);
-}
-
-static hash_table<tree_entry_hasher> *tree_htab;
-#endif
-
/* Initialization common to the LTO reader and writer. */
void
handle it. */
if (flag_checking)
streamer_check_handled_ts_structures ();
-
-#ifdef LTO_STREAMER_DEBUG
- tree_htab = new hash_table<tree_entry_hasher> (31);
-#endif
}
&& !seen_error ());
}
-
-#ifdef LTO_STREAMER_DEBUG
-/* Add a mapping between T and ORIG_T, which is the numeric value of
- the original address of T as it was seen by the LTO writer. This
- mapping is useful when debugging streaming problems. A debugging
- 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
- being reconstructed. Once T is fully built, the mapping is
- removed. */
-
-void
-lto_orig_address_map (tree t, intptr_t orig_t)
-{
- struct tree_hash_entry ent;
- struct tree_hash_entry **slot;
-
- ent.key = t;
- ent.value = orig_t;
- slot = tree_htab->find_slot (&ent, INSERT);
- gcc_assert (!*slot);
- *slot = XNEW (struct tree_hash_entry);
- **slot = ent;
-}
-
-
-/* Get the original address of T as it was seen by the writer. This
- is only valid while T is being reconstructed. */
-
-intptr_t
-lto_orig_address_get (tree t)
-{
- struct tree_hash_entry ent;
- struct tree_hash_entry **slot;
-
- ent.key = t;
- slot = tree_htab->find_slot (&ent, NO_INSERT);
- return (slot ? (*slot)->value : 0);
-}
-
-
-/* Clear the mapping of T to its original address. */
-
-void
-lto_orig_address_remove (tree t)
-{
- struct tree_hash_entry ent;
- struct tree_hash_entry **slot;
-
- ent.key = t;
- slot = tree_htab->find_slot (&ent, NO_INSERT);
- gcc_assert (slot);
- free (*slot);
- tree_htab->clear_slot (slot);
-}
-#endif
-
-
/* Check that the version MAJOR.MINOR is the correct version number. */
void
{
if (major != LTO_major_version || minor != LTO_minor_version)
fatal_error (input_location,
- "bytecode stream in file '%s' generated with LTO version "
+ "bytecode stream in file %qs generated with LTO version "
"%d.%d instead of the expected %d.%d",
file_name,
major, minor,