aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-streamer-out.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-10-15 10:39:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-10-15 10:39:59 +0000
commit0127aae46a182abeadf7419088ad85c9ba5bffc8 (patch)
tree4f2dbf465ecdb87bdee8ce3dc6bf6bc927afa874 /gcc/tree-streamer-out.c
parentfe0f6df424a2e13a7bfdbdc42dcf27d07650c119 (diff)
downloadgcc-0127aae46a182abeadf7419088ad85c9ba5bffc8.zip
gcc-0127aae46a182abeadf7419088ad85c9ba5bffc8.tar.gz
gcc-0127aae46a182abeadf7419088ad85c9ba5bffc8.tar.bz2
tree-streamer-out.c (streamer_pack_tree_bitfields): Back BINFO_BASE_ACCESSES and CONSTRUCTOR lengths here.
2012-10-15 Richard Guenther <rguenther@suse.de> * tree-streamer-out.c (streamer_pack_tree_bitfields): Back BINFO_BASE_ACCESSES and CONSTRUCTOR lengths here. (streamer_write_chain): Write TREE_CHAIN as null-terminated list. (write_ts_exp_tree_pointers): Adjust. (write_ts_binfo_tree_pointers): Likewise. (write_ts_constructor_tree_pointers): Likewise. * tree-streamer-in.c (streamer_read_chain): Read TREE_CHAIN as null-terminated list. (unpack_value_fields): Unpack BINFO_BASE_ACCESSES and CONSTRUCTOR lengths and materialize the arrays. (lto_input_ts_exp_tree_pointers): Adjust. (lto_input_ts_binfo_tree_pointers): Likewise. (lto_input_ts_constructor_tree_pointers): Likewise. From-SVN: r192451
Diffstat (limited to 'gcc/tree-streamer-out.c')
-rw-r--r--gcc/tree-streamer-out.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c
index fc70eb9..cb2ccf4 100644
--- a/gcc/tree-streamer-out.c
+++ b/gcc/tree-streamer-out.c
@@ -409,6 +409,12 @@ streamer_pack_tree_bitfields (struct output_block *ob,
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
pack_ts_optimization (bp, expr);
+
+ if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
+ bp_pack_var_len_unsigned (bp, VEC_length (tree, BINFO_BASE_ACCESSES (expr)));
+
+ if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
+ bp_pack_var_len_unsigned (bp, CONSTRUCTOR_NELTS (expr));
}
@@ -454,11 +460,7 @@ streamer_write_builtin (struct output_block *ob, tree expr)
void
streamer_write_chain (struct output_block *ob, tree t, bool ref_p)
{
- int i, count;
-
- count = list_length (t);
- streamer_write_hwi (ob, count);
- for (i = 0; i < count; i++)
+ while (t)
{
tree saved_chain;
@@ -480,6 +482,9 @@ streamer_write_chain (struct output_block *ob, tree t, bool ref_p)
TREE_CHAIN (t) = saved_chain;
t = TREE_CHAIN (t);
}
+
+ /* Write a sentinel to terminate the chain. */
+ stream_write_tree (ob, NULL_TREE, ref_p);
}
@@ -725,7 +730,6 @@ write_ts_exp_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
{
int i;
- streamer_write_hwi (ob, TREE_OPERAND_LENGTH (expr));
for (i = 0; i < TREE_OPERAND_LENGTH (expr); i++)
stream_write_tree (ob, TREE_OPERAND (expr, i), ref_p);
stream_write_tree (ob, TREE_BLOCK (expr), ref_p);
@@ -786,7 +790,8 @@ write_ts_binfo_tree_pointers (struct output_block *ob, tree expr, bool ref_p)
stream_write_tree (ob, BINFO_VTABLE (expr), ref_p);
stream_write_tree (ob, BINFO_VPTR_FIELD (expr), ref_p);
- streamer_write_uhwi (ob, VEC_length (tree, BINFO_BASE_ACCESSES (expr)));
+ /* The number of BINFO_BASE_ACCESSES has already been emitted in
+ EXPR's bitfield section. */
FOR_EACH_VEC_ELT (tree, BINFO_BASE_ACCESSES (expr), i, t)
stream_write_tree (ob, t, ref_p);
@@ -807,7 +812,6 @@ write_ts_constructor_tree_pointers (struct output_block *ob, tree expr,
unsigned i;
tree index, value;
- streamer_write_uhwi (ob, CONSTRUCTOR_NELTS (expr));
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (expr), i, index, value)
{
stream_write_tree (ob, index, ref_p);