Mercurial > hg > CbC > CbC_gcc
comparison gcc/data-streamer.h @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 /* Generic streaming support for various data types. | 1 /* Generic streaming support for various data types. |
2 | 2 |
3 Copyright (C) 2011-2018 Free Software Foundation, Inc. | 3 Copyright (C) 2011-2020 Free Software Foundation, Inc. |
4 Contributed by Diego Novillo <dnovillo@google.com> | 4 Contributed by Diego Novillo <dnovillo@google.com> |
5 | 5 |
6 This file is part of GCC. | 6 This file is part of GCC. |
7 | 7 |
8 GCC is free software; you can redistribute it and/or modify it under | 8 GCC is free software; you can redistribute it and/or modify it under |
51 | 51 |
52 /* In data-streamer-out.c */ | 52 /* In data-streamer-out.c */ |
53 void streamer_write_zero (struct output_block *); | 53 void streamer_write_zero (struct output_block *); |
54 void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT); | 54 void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT); |
55 void streamer_write_hwi (struct output_block *, HOST_WIDE_INT); | 55 void streamer_write_hwi (struct output_block *, HOST_WIDE_INT); |
56 void streamer_write_poly_uint64 (struct output_block *, poly_uint64); | |
56 void streamer_write_gcov_count (struct output_block *, gcov_type); | 57 void streamer_write_gcov_count (struct output_block *, gcov_type); |
57 void streamer_write_string (struct output_block *, struct lto_output_stream *, | 58 void streamer_write_string (struct output_block *, struct lto_output_stream *, |
58 const char *, bool); | 59 const char *, bool); |
59 void streamer_write_string_with_length (struct output_block *, | 60 void streamer_write_string_with_length (struct output_block *, |
60 struct lto_output_stream *, | 61 struct lto_output_stream *, |
71 size_t); | 72 size_t); |
72 void streamer_write_wide_int (struct output_block *, const wide_int &); | 73 void streamer_write_wide_int (struct output_block *, const wide_int &); |
73 void streamer_write_widest_int (struct output_block *, const widest_int &); | 74 void streamer_write_widest_int (struct output_block *, const widest_int &); |
74 | 75 |
75 /* In data-streamer-in.c */ | 76 /* In data-streamer-in.c */ |
76 const char *streamer_read_string (struct data_in *, struct lto_input_block *); | 77 const char *streamer_read_string (class data_in *, class lto_input_block *); |
77 const char *streamer_read_indexed_string (struct data_in *, | 78 const char *streamer_read_indexed_string (class data_in *, |
78 struct lto_input_block *, | 79 class lto_input_block *, |
79 unsigned int *); | 80 unsigned int *); |
80 const char *bp_unpack_indexed_string (struct data_in *, struct bitpack_d *, | 81 const char *bp_unpack_indexed_string (class data_in *, struct bitpack_d *, |
81 unsigned int *); | 82 unsigned int *); |
82 const char *bp_unpack_string (struct data_in *, struct bitpack_d *); | 83 const char *bp_unpack_string (class data_in *, struct bitpack_d *); |
83 unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *); | 84 unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *); |
84 HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *); | 85 HOST_WIDE_INT streamer_read_hwi (class lto_input_block *); |
85 gcov_type streamer_read_gcov_count (struct lto_input_block *); | 86 poly_uint64 streamer_read_poly_uint64 (class lto_input_block *); |
86 wide_int streamer_read_wide_int (struct lto_input_block *); | 87 gcov_type streamer_read_gcov_count (class lto_input_block *); |
87 widest_int streamer_read_widest_int (struct lto_input_block *); | 88 wide_int streamer_read_wide_int (class lto_input_block *); |
89 widest_int streamer_read_widest_int (class lto_input_block *); | |
88 | 90 |
89 /* Returns a new bit-packing context for bit-packing into S. */ | 91 /* Returns a new bit-packing context for bit-packing into S. */ |
90 static inline struct bitpack_d | 92 static inline struct bitpack_d |
91 bitpack_create (struct lto_output_stream *s) | 93 bitpack_create (struct lto_output_stream *s) |
92 { | 94 { |
147 bp->pos = 0; | 149 bp->pos = 0; |
148 } | 150 } |
149 | 151 |
150 /* Returns a new bit-packing context for bit-unpacking from IB. */ | 152 /* Returns a new bit-packing context for bit-unpacking from IB. */ |
151 static inline struct bitpack_d | 153 static inline struct bitpack_d |
152 streamer_read_bitpack (struct lto_input_block *ib) | 154 streamer_read_bitpack (class lto_input_block *ib) |
153 { | 155 { |
154 struct bitpack_d bp; | 156 struct bitpack_d bp; |
155 bp.word = streamer_read_uhwi (ib); | 157 bp.word = streamer_read_uhwi (ib); |
156 bp.pos = 0; | 158 bp.pos = 0; |
157 bp.stream = (void *)ib; | 159 bp.stream = (void *)ib; |
172 /* If there are not continuous nbits in the current bitpack word | 174 /* If there are not continuous nbits in the current bitpack word |
173 switch to the next one. */ | 175 switch to the next one. */ |
174 if (pos + nbits > BITS_PER_BITPACK_WORD) | 176 if (pos + nbits > BITS_PER_BITPACK_WORD) |
175 { | 177 { |
176 bp->word = val | 178 bp->word = val |
177 = streamer_read_uhwi ((struct lto_input_block *)bp->stream); | 179 = streamer_read_uhwi ((class lto_input_block *)bp->stream); |
178 bp->pos = nbits; | 180 bp->pos = nbits; |
179 return val & mask; | 181 return val & mask; |
180 } | 182 } |
181 val = bp->word; | 183 val = bp->word; |
182 val >>= pos; | 184 val >>= pos; |
216 | 218 |
217 | 219 |
218 /* Read byte from the input block. */ | 220 /* Read byte from the input block. */ |
219 | 221 |
220 static inline unsigned char | 222 static inline unsigned char |
221 streamer_read_uchar (struct lto_input_block *ib) | 223 streamer_read_uchar (class lto_input_block *ib) |
222 { | 224 { |
223 if (ib->p >= ib->len) | 225 if (ib->p >= ib->len) |
224 lto_section_overrun (ib); | 226 lto_section_overrun (ib); |
225 return (ib->data[ib->p++]); | 227 return (ib->data[ib->p++]); |
226 } | 228 } |
246 | 248 |
247 /* Input VAL into OBS and verify it is in range MIN...MAX that is supposed | 249 /* Input VAL into OBS and verify it is in range MIN...MAX that is supposed |
248 to be compile time constant. PURPOSE is used for error reporting. */ | 250 to be compile time constant. PURPOSE is used for error reporting. */ |
249 | 251 |
250 static inline HOST_WIDE_INT | 252 static inline HOST_WIDE_INT |
251 streamer_read_hwi_in_range (struct lto_input_block *ib, | 253 streamer_read_hwi_in_range (class lto_input_block *ib, |
252 const char *purpose, | 254 const char *purpose, |
253 HOST_WIDE_INT min, | 255 HOST_WIDE_INT min, |
254 HOST_WIDE_INT max) | 256 HOST_WIDE_INT max) |
255 { | 257 { |
256 HOST_WIDE_INT range = max - min; | 258 HOST_WIDE_INT range = max - min; |
335 } | 337 } |
336 | 338 |
337 /* Return the next tag in the input block IB. */ | 339 /* Return the next tag in the input block IB. */ |
338 | 340 |
339 static inline enum LTO_tags | 341 static inline enum LTO_tags |
340 streamer_read_record_start (struct lto_input_block *ib) | 342 streamer_read_record_start (class lto_input_block *ib) |
341 { | 343 { |
342 return streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS); | 344 return streamer_read_enum (ib, LTO_tags, LTO_NUM_TAGS); |
343 } | 345 } |
344 | 346 |
345 #endif /* GCC_DATA_STREAMER_H */ | 347 #endif /* GCC_DATA_STREAMER_H */ |