static void output_cgraph_opt_summary (cgraph_node_set set);
static void input_cgraph_opt_summary (VEC (cgraph_node_ptr, heap) * nodes);
+/* Number of LDPR values known to GCC. */
+#define LDPR_NUM_KNOWN (LDPR_RESOLVED_DYN + 1)
/* Cgraph streaming is organized as set of record whose type
is indicated by a tag. */
LTO_cgraph_analyzed_node,
/* Cgraph edges. */
LTO_cgraph_edge,
- LTO_cgraph_indirect_edge
+ LTO_cgraph_indirect_edge,
+ LTO_cgraph_last_tag
};
/* Create a new cgraph encoder. */
struct bitpack_d bp;
if (edge->indirect_unknown_callee)
- lto_output_uleb128_stream (ob->main_stream, LTO_cgraph_indirect_edge);
+ lto_output_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
+ LTO_cgraph_indirect_edge);
else
- lto_output_uleb128_stream (ob->main_stream, LTO_cgraph_edge);
+ lto_output_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag,
+ LTO_cgraph_edge);
ref = lto_cgraph_encoder_lookup (encoder, edge->caller);
gcc_assert (ref != LCC_NOT_FOUND);
bp = bitpack_create (ob->main_stream);
uid = (!gimple_has_body_p (edge->caller->decl)
? edge->lto_stmt_uid : gimple_uid (edge->call_stmt));
- bp_pack_value (&bp, uid, HOST_BITS_PER_INT);
- bp_pack_value (&bp, edge->inline_failed, HOST_BITS_PER_INT);
- bp_pack_value (&bp, edge->frequency, HOST_BITS_PER_INT);
+ bp_pack_enum (&bp, cgraph_inline_failed_enum,
+ CIF_N_REASONS, edge->inline_failed);
+ bp_pack_var_len_unsigned (&bp, uid);
+ bp_pack_var_len_unsigned (&bp, edge->frequency);
bp_pack_value (&bp, edge->indirect_inlining_edge, 1);
bp_pack_value (&bp, edge->call_stmt_cannot_inline_p, 1);
bp_pack_value (&bp, edge->can_throw_external, 1);
else
tag = LTO_cgraph_unavail_node;
- lto_output_uleb128_stream (ob->main_stream, tag);
+ lto_output_enum (ob->main_stream, LTO_cgraph_tags, LTO_cgraph_last_tag, tag);
/* In WPA mode, we only output part of the call-graph. Also, we
fake cgraph node attributes. There are two cases that we care.
bp_pack_value (&bp, node->only_called_at_startup, 1);
bp_pack_value (&bp, node->only_called_at_exit, 1);
bp_pack_value (&bp, node->thunk.thunk_p && !boundary_p, 1);
+ bp_pack_enum (&bp, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN, node->resolution);
lto_output_bitpack (&bp);
- lto_output_uleb128_stream (ob->main_stream, node->resolution);
if (node->thunk.thunk_p && !boundary_p)
{
lto_output_fn_decl_index (ob->decl_state, ob->main_stream,
alias->thunk.alias);
gcc_assert (cgraph_get_node (alias->thunk.alias) == node);
- lto_output_uleb128_stream (ob->main_stream, alias->resolution);
+ lto_output_enum (ob->main_stream, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN, alias->resolution);
alias = alias->previous;
}
while (alias);
else
ref = LCC_NOT_FOUND;
lto_output_sleb128_stream (ob->main_stream, ref);
- lto_output_uleb128_stream (ob->main_stream, node->resolution);
+ lto_output_enum (ob->main_stream, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN, node->resolution);
if (count)
{
for (alias = node->extra_name; alias; alias = alias->next)
{
lto_output_var_decl_index (ob->decl_state, ob->main_stream, alias->decl);
- lto_output_uleb128_stream (ob->main_stream, alias->resolution);
+ lto_output_enum (ob->main_stream, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN, alias->resolution);
}
}
}
input_overwrite_node (struct lto_file_decl_data *file_data,
struct cgraph_node *node,
enum LTO_cgraph_tags tag,
- struct bitpack_d *bp,
- enum ld_plugin_symbol_resolution resolution)
+ struct bitpack_d *bp)
{
node->aux = (void *) tag;
node->local.lto_file_data = file_data;
node->only_called_at_startup = bp_unpack_value (bp, 1);
node->only_called_at_exit = bp_unpack_value (bp, 1);
node->thunk.thunk_p = bp_unpack_value (bp, 1);
- node->resolution = resolution;
+ node->resolution = bp_unpack_enum (bp, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN);
}
/* Output the part of the cgraph in SET. */
int ref = LCC_NOT_FOUND, ref2 = LCC_NOT_FOUND;
unsigned long same_body_count = 0;
int clone_ref;
- enum ld_plugin_symbol_resolution resolution;
clone_ref = lto_input_sleb128 (ib);
"node %d", node->uid);
bp = lto_input_bitpack (ib);
- resolution = (enum ld_plugin_symbol_resolution)lto_input_uleb128 (ib);
- input_overwrite_node (file_data, node, tag, &bp, resolution);
+ input_overwrite_node (file_data, node, tag, &bp);
/* Store a reference for now, and fix up later to be a pointer. */
node->global.inlined_to = (cgraph_node_ptr) (intptr_t) ref;
real_alias = lto_file_decl_data_get_fn_decl (file_data, decl_index);
alias = cgraph_same_body_alias (node, alias_decl, real_alias);
gcc_assert (alias);
- alias->resolution = (enum ld_plugin_symbol_resolution)lto_input_uleb128 (ib);
+ alias->resolution = lto_input_enum (ib, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN);
}
return node;
}
ref = lto_input_sleb128 (ib);
/* Store a reference for now, and fix up later to be a pointer. */
node->same_comdat_group = (struct varpool_node *) (intptr_t) ref;
- node->resolution = (enum ld_plugin_symbol_resolution)lto_input_uleb128 (ib);
+ node->resolution = lto_input_enum (ib, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN);
if (aliases_p)
{
count = lto_input_uleb128 (ib);
lto_input_uleb128 (ib));
struct varpool_node *alias;
alias = varpool_extra_name_alias (decl, var_decl);
- alias->resolution = (enum ld_plugin_symbol_resolution)lto_input_uleb128 (ib);
+ alias->resolution = lto_input_enum (ib, ld_plugin_symbol_resolution,
+ LDPR_NUM_KNOWN);
}
}
return node;
count = (gcov_type) lto_input_sleb128 (ib);
bp = lto_input_bitpack (ib);
- stmt_id = (unsigned int) bp_unpack_value (&bp, HOST_BITS_PER_INT);
- inline_failed = (cgraph_inline_failed_t) bp_unpack_value (&bp,
- HOST_BITS_PER_INT);
- freq = (int) bp_unpack_value (&bp, HOST_BITS_PER_INT);
+ inline_failed = bp_unpack_enum (&bp, cgraph_inline_failed_enum, CIF_N_REASONS);
+ stmt_id = bp_unpack_var_len_unsigned (&bp);
+ freq = (int) bp_unpack_var_len_unsigned (&bp);
if (indirect)
edge = cgraph_create_indirect_edge (caller, NULL, 0, count, freq);
unsigned i;
unsigned HOST_WIDE_INT len;
- tag = (enum LTO_cgraph_tags) lto_input_uleb128 (ib);
+ tag = lto_input_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
while (tag)
{
if (tag == LTO_cgraph_edge)
lto_cgraph_encoder_encode (file_data->cgraph_node_encoder, node);
}
- tag = (enum LTO_cgraph_tags) lto_input_uleb128 (ib);
+ tag = lto_input_enum (ib, LTO_cgraph_tags, LTO_cgraph_last_tag);
}
/* Input toplevel asms. */