summaryrefslogtreecommitdiff
path: root/gcc/lto-streamer-in.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-16 09:38:13 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-16 09:38:13 +0000
commit23bdc9ca4ff5b204fd3a51aaab2c21cf6a544ff4 (patch)
treedb74c86f639c1dd58991243eee16d61445974c50 /gcc/lto-streamer-in.c
parent1716d6278b1443368721b44ddfc0a2bda8ff6f1d (diff)
downloadgcc-23bdc9ca4ff5b204fd3a51aaab2c21cf6a544ff4.tar.gz
2010-09-16 Richard Guenther <rguenther@suse.de>
* tree.c (tree_node_structure_for_code): TRANSLATION_UNIT_DECL is TS_TRANSLATION_UNIT_DECL. (initialize_tree_contains_struct): Adjust. (all_translation_units): New global vector. (build_translation_unit_decl): New function. * tree.h (TRANSLATION_UNIT_LANGUAGE): New macro. (struct tree_translation_unit_decl): New. (all_translation_units): Declare. (union tree_node): Add translation_unit_decl member. (build_translation_unit_decl): Declare. * treestruct.def (TS_TRANSLATION_UNIT_DECL): New. * lto-streamer-out.c (pack_ts_translation_unit_decl_value_fields): New function. (pack_value_fields): Call it. (lto_output_tree_ref): Handle references to TRANSLATION_UNIT_DECL. (lto_output_ts_translation_unit_decl_tree_pointers): New function. (lto_output_tree_pointers): Call it. * lto-streamer-in.c (lto_input_tree_ref): Handle references to TRANSLATION_UNIT_DECL. (unpack_ts_translation_unit_decl_value_fields): New function. (unpack_value_fields): Call it. (lto_input_ts_translation_unit_decl_tree_pointers): New function. (lto_input_tree_pointers): Call it. * lto-streamer.c (check_handled_ts_structures): Adjust. * lto-streamer.h (enum LTO_tags): Add LTO_translation_unit_decl_ref. * c-decl.c (all_translation_units): Remove. (pop_scope): Use build_translation_unit_decl. (collect_all_refs): Adjust. (for_each_global_decl): Likewise. (c_write_global_declarations): Likewise. java/ * jcf-parse.c (current_file_list): Remove. (java_parse_file): Use build_translation_unit_decl. Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164331 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto-streamer-in.c')
-rw-r--r--gcc/lto-streamer-in.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index fec9833fa8b..83315e86d1b 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -355,6 +355,7 @@ lto_input_tree_ref (struct lto_input_block *ib, struct data_in *data_in,
case LTO_const_decl_ref:
case LTO_imported_decl_ref:
case LTO_label_decl_ref:
+ case LTO_translation_unit_decl_ref:
ix_u = lto_input_uleb128 (ib);
result = lto_file_decl_data_get_var_decl (data_in->file_data, ix_u);
break;
@@ -1683,6 +1684,13 @@ unpack_ts_block_value_fields (struct bitpack_d *bp, tree expr)
BLOCK_NUMBER (expr) = (unsigned) bp_unpack_value (bp, 31);
}
+/* Unpack all the non-pointer fields of the TS_TRANSLATION_UNIT_DECL
+ structure of expression EXPR from bitpack BP. */
+
+static void
+unpack_ts_translation_unit_decl_value_fields (struct bitpack_d *bp ATTRIBUTE_UNUSED, tree expr ATTRIBUTE_UNUSED)
+{
+}
/* Unpack all the non-pointer fields in EXPR into a bit pack. */
@@ -1738,6 +1746,9 @@ unpack_value_fields (struct bitpack_d *bp, tree expr)
/* This is only used by High GIMPLE. */
gcc_unreachable ();
}
+
+ if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
+ unpack_ts_translation_unit_decl_value_fields (bp, expr);
}
@@ -2223,6 +2234,17 @@ lto_input_ts_target_option (struct lto_input_block *ib, tree expr)
fatal_error ("cl_target_option size mismatch in LTO reader and writer");
}
+/* Input a TS_TRANSLATION_UNIT_DECL tree from IB and DATA_IN into EXPR. */
+
+static void
+lto_input_ts_translation_unit_decl_tree_pointers (struct lto_input_block *ib,
+ struct data_in *data_in,
+ tree expr)
+{
+ TRANSLATION_UNIT_LANGUAGE (expr) = input_string (data_in, ib);
+ VEC_safe_push (tree, gc, all_translation_units, expr);
+}
+
/* Helper for lto_input_tree. Read all pointer fields in EXPR from
input block IB. DATA_IN contains tables and descriptors for the
file being read. */
@@ -2308,6 +2330,9 @@ lto_input_tree_pointers (struct lto_input_block *ib, struct data_in *data_in,
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION))
lto_input_ts_target_option (ib, expr);
+
+ if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
+ lto_input_ts_translation_unit_decl_tree_pointers (ib, data_in, expr);
}