diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-02-09 13:18:15 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-02-09 13:18:15 +0000 |
commit | c76dc4685b6de1a9841f503d65a56dc6492f8448 (patch) | |
tree | 2de8a54c507a8559e8a96f20f92c86c2abcff2ce /gcc/tree-streamer-in.c | |
parent | cdd742414cd41311eea9eeabde5d0d9c24c060d4 (diff) | |
download | gcc-c76dc4685b6de1a9841f503d65a56dc6492f8448.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220540 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-streamer-in.c')
-rw-r--r-- | gcc/tree-streamer-in.c | 96 |
1 files changed, 44 insertions, 52 deletions
diff --git a/gcc/tree-streamer-in.c b/gcc/tree-streamer-in.c index 96f4adacede..9b7dd91cb06 100644 --- a/gcc/tree-streamer-in.c +++ b/gcc/tree-streamer-in.c @@ -123,7 +123,7 @@ streamer_read_chain (struct lto_input_block *ib, struct data_in *data_in) /* Unpack all the non-pointer fields of the TS_BASE structure of expression EXPR from bitpack BP. */ -static void +static inline void unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr) { /* Note that the code for EXPR has already been unpacked to create EXPR in @@ -158,6 +158,8 @@ unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr) TREE_STATIC (expr) = (unsigned) bp_unpack_value (bp, 1); if (TREE_CODE (expr) != TREE_BINFO) TREE_PRIVATE (expr) = (unsigned) bp_unpack_value (bp, 1); + else + bp_unpack_value (bp, 1); TREE_PROTECTED (expr) = (unsigned) bp_unpack_value (bp, 1); TREE_DEPRECATED (expr) = (unsigned) bp_unpack_value (bp, 1); if (TYPE_P (expr)) @@ -166,9 +168,12 @@ unpack_ts_base_value_fields (struct bitpack_d *bp, tree expr) TYPE_ADDR_SPACE (expr) = (unsigned) bp_unpack_value (bp, 8); } else if (TREE_CODE (expr) == SSA_NAME) - SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1); + { + SSA_NAME_IS_DEFAULT_DEF (expr) = (unsigned) bp_unpack_value (bp, 1); + bp_unpack_value (bp, 8); + } else - bp_unpack_value (bp, 1); + bp_unpack_value (bp, 9); } @@ -456,115 +461,102 @@ unpack_ts_omp_clause_value_fields (struct data_in *data_in, } } -/* Unpack all the non-pointer fields in EXPR into a bit pack. */ -static void -unpack_value_fields (struct data_in *data_in, struct bitpack_d *bp, tree expr) +/* Read all the language-independent bitfield values for EXPR from IB. + Return the partially unpacked bitpack so the caller can unpack any other + bitfield values that the writer may have written. */ + +struct bitpack_d +streamer_read_tree_bitfields (struct lto_input_block *ib, + struct data_in *data_in, tree expr) { enum tree_code code; + struct bitpack_d bp; - code = TREE_CODE (expr); + /* Read the bitpack of non-pointer values from IB. */ + bp = streamer_read_bitpack (ib); + + /* The first word in BP contains the code of the tree that we + are about to read. */ + code = (enum tree_code) bp_unpack_value (&bp, 16); + lto_tag_check (lto_tree_code_to_tag (code), + lto_tree_code_to_tag (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. */ - unpack_ts_base_value_fields (bp, expr); + unpack_ts_base_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_INT_CST)) - unpack_ts_int_cst_value_fields (bp, expr); + unpack_ts_int_cst_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_REAL_CST)) - unpack_ts_real_cst_value_fields (bp, expr); + unpack_ts_real_cst_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_FIXED_CST)) - unpack_ts_fixed_cst_value_fields (bp, expr); + unpack_ts_fixed_cst_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_DECL_MINIMAL)) - DECL_SOURCE_LOCATION (expr) = stream_input_location (bp, data_in); + DECL_SOURCE_LOCATION (expr) = stream_input_location (&bp, data_in); if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) - unpack_ts_decl_common_value_fields (bp, expr); + unpack_ts_decl_common_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_DECL_WRTL)) - unpack_ts_decl_wrtl_value_fields (bp, expr); + unpack_ts_decl_wrtl_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_DECL_WITH_VIS)) - unpack_ts_decl_with_vis_value_fields (bp, expr); + unpack_ts_decl_with_vis_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_FUNCTION_DECL)) - unpack_ts_function_decl_value_fields (bp, expr); + unpack_ts_function_decl_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_TYPE_COMMON)) - unpack_ts_type_common_value_fields (bp, expr); + unpack_ts_type_common_value_fields (&bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_EXP)) { - SET_EXPR_LOCATION (expr, stream_input_location (bp, data_in)); + SET_EXPR_LOCATION (expr, stream_input_location (&bp, data_in)); if (code == MEM_REF || code == TARGET_MEM_REF) { MR_DEPENDENCE_CLIQUE (expr) - = (unsigned)bp_unpack_value (bp, sizeof (short) * 8); + = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8); if (MR_DEPENDENCE_CLIQUE (expr) != 0) MR_DEPENDENCE_BASE (expr) - = (unsigned)bp_unpack_value (bp, sizeof (short) * 8); + = (unsigned)bp_unpack_value (&bp, sizeof (short) * 8); } } if (CODE_CONTAINS_STRUCT (code, TS_BLOCK)) - unpack_ts_block_value_fields (data_in, bp, expr); + unpack_ts_block_value_fields (data_in, &bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_TRANSLATION_UNIT_DECL)) - unpack_ts_translation_unit_decl_value_fields (data_in, bp, expr); + unpack_ts_translation_unit_decl_value_fields (data_in, &bp, expr); if (CODE_CONTAINS_STRUCT (code, TS_OPTIMIZATION)) - cl_optimization_stream_in (bp, TREE_OPTIMIZATION (expr)); + cl_optimization_stream_in (&bp, TREE_OPTIMIZATION (expr)); if (CODE_CONTAINS_STRUCT (code, TS_BINFO)) { - unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (bp); + unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp); if (length > 0) vec_safe_grow (BINFO_BASE_ACCESSES (expr), length); } if (CODE_CONTAINS_STRUCT (code, TS_CONSTRUCTOR)) { - unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (bp); + unsigned HOST_WIDE_INT length = bp_unpack_var_len_unsigned (&bp); if (length > 0) vec_safe_grow (CONSTRUCTOR_ELTS (expr), length); } #ifndef ACCEL_COMPILER if (CODE_CONTAINS_STRUCT (code, TS_TARGET_OPTION)) - cl_target_option_stream_in (data_in, bp, TREE_TARGET_OPTION (expr)); + cl_target_option_stream_in (data_in, &bp, TREE_TARGET_OPTION (expr)); #endif if (code == OMP_CLAUSE) - unpack_ts_omp_clause_value_fields (data_in, bp, expr); -} - - -/* Read all the language-independent bitfield values for EXPR from IB. - Return the partially unpacked bitpack so the caller can unpack any other - bitfield values that the writer may have written. */ - -struct bitpack_d -streamer_read_tree_bitfields (struct lto_input_block *ib, - struct data_in *data_in, tree expr) -{ - enum tree_code code; - struct bitpack_d bp; - - /* Read the bitpack of non-pointer values from IB. */ - bp = streamer_read_bitpack (ib); - - /* The first word in BP contains the code of the tree that we - are about to read. */ - code = (enum tree_code) bp_unpack_value (&bp, 16); - lto_tag_check (lto_tree_code_to_tag (code), - lto_tree_code_to_tag (TREE_CODE (expr))); - - /* Unpack all the value fields from BP. */ - unpack_value_fields (data_in, &bp, expr); + unpack_ts_omp_clause_value_fields (data_in, &bp, expr); return bp; } |