node->thunk = true;
node->definition = true;
- thunk_info *i = thunk_info::get_create (node);
+ thunk_info *i;
+ thunk_info local_info;
+ if (symtab->state < CONSTRUCTION)
+ i = &local_info;
+ else
+ i = thunk_info::get_create (node);
i->fixed_offset = fixed_offset;
i->virtual_value = virtual_value;
i->indirect_offset = indirect_offset;
i->alias = real_alias;
i->this_adjusting = this_adjusting;
i->virtual_offset_p = virtual_offset != NULL;
+ if (symtab->state < CONSTRUCTION)
+ i->register_early (node);
return node;
}
symtab->state = CONSTRUCTION;
input_location = UNKNOWN_LOCATION;
+ thunk_info::process_early_thunks ();
+
/* Ugly, but the fixup cannot happen at a time same body alias is created;
C++ FE is confused about the COMDAT groups being right. */
if (symtab->cpp_implicit_aliases_done)
/* Used for vtable lookup in thunk adjusting. */
static GTY (()) tree vtable_entry_type;
+struct GTY (()) unprocessed_thunk
+{
+ cgraph_node *node;
+ thunk_info *info;
+};
+/* To be PCH safe we store thunks into a vector before end of compilation
+ unit. */
+static GTY (()) vec<unprocessed_thunk, va_gc> *thunks;
namespace {
return hstate.end ();
}
+/* Add unprocessed thunk. */
+void
+thunk_info::register_early (cgraph_node *node)
+{
+ unprocessed_thunk entry = {node, new (ggc_alloc <thunk_info> ()) thunk_info};
+ *entry.info = *this;
+ vec_safe_push (thunks, entry);
+}
+
+/* Attach recorded thunks to cgraph_nodes.
+ All this is done only to avoid need to stream summaries to PCH. */
+void
+thunk_info::process_early_thunks ()
+{
+ unprocessed_thunk *e;
+ unsigned int i;
+ if (!thunks)
+ return;
+
+ FOR_EACH_VEC_ELT (*thunks, i, e)
+ {
+ *thunk_info::get_create (e->node) = *e->info;
+ }
+ vec_free (thunks);
+ thunks = NULL;
+}
+
/* Adjust PTR by the constant FIXED_OFFSET, by the vtable offset indicated by
VIRTUAL_OFFSET, and by the indirect offset indicated by INDIRECT_OFFSET, if
it is non-null. THIS_ADJUSTING is nonzero for a this adjusting thunk and zero
fixed_offset = other.fixed_offset;
virtual_value = other.virtual_value;
indirect_offset = other.indirect_offset;
+ alias = other.alias;
this_adjusting = other.this_adjusting;
virtual_offset_p = other.virtual_offset_p;
return *this;
/* Remove thunk_info. */
static void remove (cgraph_node *node);
+ /* Add unprocessed thunk. */
+ void register_early (cgraph_node *node);
+
+ /* Attach recorded thunks to cgraph_nodes. */
+ static void process_early_thunks ();
+
/* Release all thunk_infos. */
static void release (void);
};