@@ -316,34 +316,17 @@ lto_input_tree_ref (class lto_input_block *ib, class data_in *data_in,
unsigned HOST_WIDE_INT ix_u;
tree result = NULL_TREE;
- lto_tag_check_range (tag, LTO_field_decl_ref, LTO_namelist_decl_ref);
-
- switch (tag)
+ if (tag == LTO_ssa_name_ref)
{
- case LTO_ssa_name_ref:
ix_u = streamer_read_uhwi (ib);
result = (*SSANAMES (fn))[ix_u];
- break;
-
- case LTO_type_ref:
- case LTO_field_decl_ref:
- case LTO_function_decl_ref:
- case LTO_type_decl_ref:
- case LTO_namespace_decl_ref:
- case LTO_global_decl_ref:
- case LTO_result_decl_ref:
- case LTO_const_decl_ref:
- case LTO_imported_decl_ref:
- case LTO_label_decl_ref:
- case LTO_translation_unit_decl_ref:
- case LTO_namelist_decl_ref:
+ }
+ else
+ {
+ gcc_checking_assert (tag == LTO_global_stream_ref);
ix_u = streamer_read_uhwi (ib);
result = (*data_in->file_data->current_decl_state
->streams[LTO_DECL_STREAM])[ix_u];
- break;
-
- default:
- gcc_unreachable ();
}
gcc_assert (result);
@@ -1485,7 +1468,7 @@ lto_input_scc (class lto_input_block *ib, class data_in *data_in,
{
enum LTO_tags tag = streamer_read_record_start (ib);
if (tag == LTO_null
- || (tag >= LTO_field_decl_ref && tag <= LTO_global_decl_ref)
+ || tag == LTO_global_stream_ref
|| tag == LTO_tree_pickle_reference
|| tag == LTO_integer_cst
|| tag == LTO_tree_scc
@@ -1549,7 +1532,7 @@ lto_input_tree_1 (class lto_input_block *ib, class data_in *data_in,
if (tag == LTO_null)
result = NULL_TREE;
- else if (tag >= LTO_field_decl_ref && tag <= LTO_namelist_decl_ref)
+ else if (tag == LTO_global_stream_ref || tag == LTO_ssa_name_ref)
{
/* If TAG is a reference to an indexable tree, the next value
in IB is the index into the table where we expect to find
@@ -252,84 +252,18 @@ static void
lto_indexable_tree_ref (struct output_block *ob, tree expr,
enum LTO_tags *tag, unsigned *index)
{
- enum tree_code code;
- enum lto_decl_stream_e_t encoder;
-
gcc_checking_assert (tree_is_indexable (expr));
- if (TYPE_P (expr))
+ if (TREE_CODE (expr) == SSA_NAME)
{
- *tag = LTO_type_ref;
- encoder = LTO_DECL_STREAM;
+ *tag = LTO_ssa_name_ref;
+ *index = SSA_NAME_VERSION (expr);
}
else
{
- code = TREE_CODE (expr);
- switch (code)
- {
- case SSA_NAME:
- *tag = LTO_ssa_name_ref;
- *index = SSA_NAME_VERSION (expr);
- return;
- break;
-
- case FIELD_DECL:
- *tag = LTO_field_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case FUNCTION_DECL:
- *tag = LTO_function_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case VAR_DECL:
- case DEBUG_EXPR_DECL:
- gcc_checking_assert (decl_function_context (expr) == NULL
- || TREE_STATIC (expr));
- /* FALLTHRU */
- case PARM_DECL:
- *tag = LTO_global_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case CONST_DECL:
- *tag = LTO_const_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case TYPE_DECL:
- *tag = LTO_type_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case NAMESPACE_DECL:
- *tag = LTO_namespace_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case LABEL_DECL:
- *tag = LTO_label_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case RESULT_DECL:
- *tag = LTO_result_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- case TRANSLATION_UNIT_DECL:
- *tag = LTO_translation_unit_decl_ref;
- encoder = LTO_DECL_STREAM;
- break;
-
- default:
- /* No other node is indexable, so it should have been handled by
- lto_output_tree. */
- gcc_unreachable ();
- }
+ *tag = LTO_global_stream_ref;
+ *index = lto_get_index (&ob->decl_state->streams[LTO_DECL_STREAM], expr);
}
- *index = lto_get_index (&ob->decl_state->streams[encoder], expr);
}
@@ -84,24 +84,10 @@ lto_tag_name (enum LTO_tags tag)
return "LTO_ert_must_not_throw";
case LTO_tree_pickle_reference:
return "LTO_tree_pickle_reference";
- case LTO_field_decl_ref:
- return "LTO_field_decl_ref";
- case LTO_function_decl_ref:
- return "LTO_function_decl_ref";
- case LTO_label_decl_ref:
- return "LTO_label_decl_ref";
- case LTO_namespace_decl_ref:
- return "LTO_namespace_decl_ref";
- case LTO_result_decl_ref:
- return "LTO_result_decl_ref";
+ case LTO_global_stream_ref:
+ return "LTO_global_sream_ref";
case LTO_ssa_name_ref:
return "LTO_ssa_name_ref";
- case LTO_type_decl_ref:
- return "LTO_type_decl_ref";
- case LTO_type_ref:
- return "LTO_type_ref";
- case LTO_global_decl_ref:
- return "LTO_global_decl_ref";
default:
return "LTO_UNKNOWN";
}
@@ -185,28 +185,15 @@ enum LTO_tags
LTO_trees,
/* References to indexable tree nodes. These objects are stored in
- tables that are written separately from the function bodies that
- reference them. This way they can be instantiated even when the
- referencing functions aren't (e.g., during WPA) and it also allows
- functions to be copied from one file to another without having
- to unpickle the body first (the references are location
- independent).
-
- NOTE, do not regroup these values as the grouping is exposed
- in the range checks done in lto_input_tree. */
- LTO_field_decl_ref, /* Do not change. */
- LTO_function_decl_ref,
- LTO_label_decl_ref,
- LTO_namespace_decl_ref,
- LTO_result_decl_ref,
+ tables that are written separately from the function bodies
+ and variable constructors that reference them. This way they can be
+ instantiated even when the referencing functions aren't (e.g., during WPA)
+ and it also allows functions to be copied from one file to another without
+ having to unpickle the body first (the references are location
+ independent). */
+ LTO_global_stream_ref,
+
LTO_ssa_name_ref,
- LTO_type_decl_ref,
- LTO_type_ref,
- LTO_const_decl_ref,
- LTO_imported_decl_ref,
- LTO_translation_unit_decl_ref,
- LTO_global_decl_ref,
- LTO_namelist_decl_ref, /* Do not change. */
/* This tag must always be last. */
LTO_NUM_TAGS