aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-section-out.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2011-05-27 11:57:40 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2011-05-27 09:57:40 +0000
commit51a9ed47c9b664c30f7fc8693080f7059ec486e5 (patch)
tree0714052ce472f19a1f44bab51eb547b0db10018c /gcc/lto-section-out.c
parentdc38fc2e8a3b5ce18e6a22ea160da5ff7ecb0e4b (diff)
downloadgcc-51a9ed47c9b664c30f7fc8693080f7059ec486e5.zip
gcc-51a9ed47c9b664c30f7fc8693080f7059ec486e5.tar.gz
gcc-51a9ed47c9b664c30f7fc8693080f7059ec486e5.tar.bz2
lto-streamer-out.c (lto_string_index): break out from...; offset by 1 so 0 means NULL string.
* lto-streamer-out.c (lto_string_index): break out from...; offset by 1 so 0 means NULL string. (lto_output_string_with_length): ... here. (lto_output_string, output_string_cst, output_identifier): Update handling of NULL strings. (lto_output_location_bitpack): New function. (lto_output_location): Use it. (lto_output_tree_ref): Use output_record_start. (pack_ts_type_common_value_fields): Pack aliagn & alias set in var len values. * lto-streamer-in.c (string_for_index): Break out from ...; offset values by 1. (input_string_internal): ... here; (input_string_cst, input_identifier, lto_input_string): Update handling of NULL strings. (lto_input_location_bitpack): New function (lto_input_location): Use it. (unpack_ts_type_common_value_fields): Pack align & alias in var len values. * lto-streamer.h (bp_pack_val_len_unsigned, bp_pack_val_len_int, bp_unpack_val_len_unsigned, bp_unpack_val_len_int): Declare. (bp_pack_value): Sanity check the value range. * lto-section-in.c (bp_unpack_val_len_unsigned, bp_unpack_val_len_int): New functions. * lto-section-out.h (bp_pack_val_len_unsigned, bp_pack_val_len_int): New functions. From-SVN: r174325
Diffstat (limited to 'gcc/lto-section-out.c')
-rw-r--r--gcc/lto-section-out.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/lto-section-out.c b/gcc/lto-section-out.c
index 234d63e..55c9d8d 100644
--- a/gcc/lto-section-out.c
+++ b/gcc/lto-section-out.c
@@ -330,6 +330,48 @@ lto_output_sleb128_stream (struct lto_output_stream *obs, HOST_WIDE_INT work)
}
+/* Pack WORK into BP in a variant of uleb format. */
+
+void
+bp_pack_var_len_unsigned (struct bitpack_d *bp, unsigned HOST_WIDE_INT work)
+{
+ do
+ {
+ unsigned int half_byte = (work & 0x7);
+ work >>= 3;
+ if (work != 0)
+ /* More half_bytes to follow. */
+ half_byte |= 0x8;
+
+ bp_pack_value (bp, half_byte, 4);
+ }
+ while (work != 0);
+}
+
+
+/* Pack WORK into BP in a variant of sleb format. */
+
+void
+bp_pack_var_len_int (struct bitpack_d *bp, HOST_WIDE_INT work)
+{
+ int more, half_byte;
+
+ do
+ {
+ half_byte = (work & 0x7);
+ /* arithmetic shift */
+ work >>= 3;
+ more = !((work == 0 && (half_byte & 0x4) == 0)
+ || (work == -1 && (half_byte & 0x4) != 0));
+ if (more)
+ half_byte |= 0x8;
+
+ bp_pack_value (bp, half_byte, 4);
+ }
+ while (more);
+}
+
+
/* Lookup NAME in ENCODER. If NAME is not found, create a new entry in
ENCODER for NAME with the next available index of ENCODER, then
print the index to OBS. True is returned if NAME was added to