aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-streamer-out.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-02-09 13:18:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-02-09 13:18:15 +0000
commitb6bf201e3420300f685a4706dc0ef6581962e32f (patch)
tree2de8a54c507a8559e8a96f20f92c86c2abcff2ce /gcc/tree-streamer-out.c
parentddc5ffe9c2061ff5dba6545de658e6541269fdab (diff)
downloadgcc-b6bf201e3420300f685a4706dc0ef6581962e32f.zip
gcc-b6bf201e3420300f685a4706dc0ef6581962e32f.tar.gz
gcc-b6bf201e3420300f685a4706dc0ef6581962e32f.tar.bz2
tree-streamer.h (streamer_pack_tree_bitfields): Remove.
2015-02-09 Richard Biener <rguenther@suse.de> * tree-streamer.h (streamer_pack_tree_bitfields): Remove. (streamer_write_tree_bitfields): Declare. * tree-streamer-in.c (unpack_ts_base_value_fields): Inline, properly unpack padding. (unpack_value_fields): Inline ... (streamer_read_tree_bitfields): ... here. * tree-streamer-out.c (pack_ts_base_value_fields): Inline and properly add padding bits. (streamer_pack_tree_bitfields): Fold into ... (streamer_write_tree_bitfields): ... this new function, exposing the bitpack object. * lto-streamer-out.c (lto_write_tree_1): Call streamer_write_tree_bitfields. From-SVN: r220540
Diffstat (limited to 'gcc/tree-streamer-out.c')
-rw-r--r--gcc/tree-streamer-out.c57
1 files changed, 32 insertions, 25 deletions
diff --git a/gcc/tree-streamer-out.c b/gcc/tree-streamer-out.c
index 3669680a..36102ed 100644
--- a/gcc/tree-streamer-out.c
+++ b/gcc/tree-streamer-out.c
@@ -92,7 +92,7 @@ write_identifier (struct output_block *ob,
/* Pack all the non-pointer fields of the TS_BASE structure of
expression EXPR into bitpack BP. */
-static void
+static inline void
pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
{
bp_pack_value (bp, TREE_CODE (expr), 16);
@@ -129,6 +129,8 @@ pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_value (bp, TREE_STATIC (expr), 1);
if (TREE_CODE (expr) != TREE_BINFO)
bp_pack_value (bp, TREE_PRIVATE (expr), 1);
+ else
+ bp_pack_value (bp, 0, 1);
bp_pack_value (bp, TREE_PROTECTED (expr), 1);
bp_pack_value (bp, TREE_DEPRECATED (expr), 1);
if (TYPE_P (expr))
@@ -137,9 +139,12 @@ pack_ts_base_value_fields (struct bitpack_d *bp, tree expr)
bp_pack_value (bp, TYPE_ADDR_SPACE (expr), 8);
}
else if (TREE_CODE (expr) == SSA_NAME)
- bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
+ {
+ bp_pack_value (bp, SSA_NAME_IS_DEFAULT_DEF (expr), 1);
+ bp_pack_value (bp, 0, 8);
+ }
else
- bp_pack_value (bp, 0, 1);
+ bp_pack_value (bp, 0, 9);
}
@@ -417,78 +422,80 @@ pack_ts_omp_clause_value_fields (struct output_block *ob,
/* Pack all the bitfields in EXPR into a bit pack. */
void
-streamer_pack_tree_bitfields (struct output_block *ob,
- struct bitpack_d *bp, tree expr)
+streamer_write_tree_bitfields (struct output_block *ob, tree expr)
{
+ bitpack_d bp = bitpack_create (ob->main_stream);
enum tree_code code;
code = TREE_CODE (expr);
/* Note that all these functions are highly sensitive to changes in
the types and sizes of each of the fields being packed. */
- pack_ts_base_value_fields (bp, expr);
+ pack_ts_base_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_INT_CST))
- pack_ts_int_cst_value_fields (bp, expr);
+ pack_ts_int_cst_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST))
- pack_ts_real_cst_value_fields (bp, expr);
+ pack_ts_real_cst_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST))
- pack_ts_fixed_cst_value_fields (bp, expr);
+ pack_ts_fixed_cst_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL))
- stream_output_location (ob, bp, DECL_SOURCE_LOCATION (expr));
+ stream_output_location (ob, &bp, DECL_SOURCE_LOCATION (expr));
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
- pack_ts_decl_common_value_fields (bp, expr);
+ pack_ts_decl_common_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL))
- pack_ts_decl_wrtl_value_fields (bp, expr);
+ pack_ts_decl_wrtl_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS))
- pack_ts_decl_with_vis_value_fields (bp, expr);
+ pack_ts_decl_with_vis_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL))
- pack_ts_function_decl_value_fields (bp, expr);
+ pack_ts_function_decl_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON))
- pack_ts_type_common_value_fields (bp, expr);
+ pack_ts_type_common_value_fields (&bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_EXP))
{
- stream_output_location (ob, bp, EXPR_LOCATION (expr));
+ stream_output_location (ob, &bp, EXPR_LOCATION (expr));
if (code == MEM_REF
|| code == TARGET_MEM_REF)
{
- bp_pack_value (bp, MR_DEPENDENCE_CLIQUE (expr), sizeof (short) * 8);
+ bp_pack_value (&bp, MR_DEPENDENCE_CLIQUE (expr), sizeof (short) * 8);
if (MR_DEPENDENCE_CLIQUE (expr) != 0)
- bp_pack_value (bp, MR_DEPENDENCE_BASE (expr), sizeof (short) * 8);
+ bp_pack_value (&bp, MR_DEPENDENCE_BASE (expr), sizeof (short) * 8);
}
}
if (CODE_CONTAINS_STRUCT (code, TS_BLOCK))
- pack_ts_block_value_fields (ob, bp, expr);
+ pack_ts_block_value_fields (ob, &bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL))
- pack_ts_translation_unit_decl_value_fields (ob, bp, expr);
+ pack_ts_translation_unit_decl_value_fields (ob, &bp, expr);
if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION))
- cl_optimization_stream_out (bp, TREE_OPTIMIZATION (expr));
+ cl_optimization_stream_out (&bp, TREE_OPTIMIZATION (expr));
if (CODE_CONTAINS_STRUCT (code, TS_BINFO))
- bp_pack_var_len_unsigned (bp, vec_safe_length (BINFO_BASE_ACCESSES (expr)));
+ bp_pack_var_len_unsigned (&bp, vec_safe_length (BINFO_BASE_ACCESSES (expr)));
if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR))
- bp_pack_var_len_unsigned (bp, CONSTRUCTOR_NELTS (expr));
+ bp_pack_var_len_unsigned (&bp, CONSTRUCTOR_NELTS (expr));
if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)
/* Don't stream these when passing things to a different target. */
&& !lto_stream_offload_p)
- cl_target_option_stream_out (ob, bp, TREE_TARGET_OPTION (expr));
+ cl_target_option_stream_out (ob, &bp, TREE_TARGET_OPTION (expr));
if (code == OMP_CLAUSE)
- pack_ts_omp_clause_value_fields (ob, bp, expr);
+ pack_ts_omp_clause_value_fields (ob, &bp, expr);
+
+ streamer_write_bitpack (&bp);
}