GCC Middle and Back End API Reference
data-streamer.h File Reference
#include "lto-streamer.h"
Include dependency graph for data-streamer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bitpack_d
 

Macros

#define streamer_write_enum(obs, enum_name, enum_last, val)    streamer_write_hwi_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val))
 
#define streamer_read_enum(ib, enum_name, enum_last)
 
#define bp_pack_enum(bp, enum_name, enum_last, val)    bp_pack_int_in_range ((bp), 0, (int)(enum_last) - 1, (int)(val))
 
#define bp_unpack_enum(bp, enum_name, enum_last)
 

Typedefs

typedef unsigned HOST_WIDE_INT bitpack_word_t
 

Functions

void bp_pack_var_len_unsigned (struct bitpack_d *, unsigned HOST_WIDE_INT)
 
void bp_pack_var_len_int (struct bitpack_d *, HOST_WIDE_INT)
 
void bp_pack_real_value (struct bitpack_d *, const REAL_VALUE_TYPE *)
 
void bp_unpack_real_value (struct bitpack_d *, REAL_VALUE_TYPE *)
 
unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned (struct bitpack_d *)
 
HOST_WIDE_INT bp_unpack_var_len_int (struct bitpack_d *)
 
void streamer_write_zero (struct output_block *)
 
void streamer_write_uhwi (struct output_block *, unsigned HOST_WIDE_INT)
 
void streamer_write_hwi (struct output_block *, HOST_WIDE_INT)
 
void streamer_write_poly_uint64 (struct output_block *, poly_uint64)
 
void streamer_write_poly_int64 (struct output_block *, poly_int64)
 
void streamer_write_gcov_count (struct output_block *, gcov_type)
 
void streamer_write_string (struct output_block *, struct lto_output_stream *, const char *, bool)
 
void streamer_write_string_with_length (struct output_block *, struct lto_output_stream *, const char *, unsigned int, bool)
 
void bp_pack_string_with_length (struct output_block *, struct bitpack_d *, const char *, unsigned int, bool)
 
void bp_pack_string (struct output_block *, struct bitpack_d *, const char *, bool)
 
void streamer_write_uhwi_stream (struct lto_output_stream *, unsigned HOST_WIDE_INT)
 
void streamer_write_hwi_stream (struct lto_output_stream *, HOST_WIDE_INT)
 
void streamer_write_gcov_count_stream (struct lto_output_stream *, gcov_type)
 
void streamer_write_data_stream (struct lto_output_stream *, const void *, size_t)
 
void streamer_write_wide_int (struct output_block *, const wide_int &)
 
void streamer_write_widest_int (struct output_block *, const widest_int &)
 
void streamer_write_vrange (struct output_block *, const class vrange &)
 
const charstreamer_read_string (class data_in *, class lto_input_block *)
 
const charstreamer_read_indexed_string (class data_in *, class lto_input_block *, unsigned int *)
 
const charbp_unpack_indexed_string (class data_in *, struct bitpack_d *, unsigned int *)
 
const charbp_unpack_string (class data_in *, struct bitpack_d *)
 
unsigned HOST_WIDE_INT streamer_read_uhwi (class lto_input_block *)
 
HOST_WIDE_INT streamer_read_hwi (class lto_input_block *)
 
poly_uint64 streamer_read_poly_uint64 (class lto_input_block *)
 
poly_int64 streamer_read_poly_int64 (class lto_input_block *)
 
gcov_type streamer_read_gcov_count (class lto_input_block *)
 
wide_int streamer_read_wide_int (class lto_input_block *)
 
widest_int streamer_read_widest_int (class lto_input_block *)
 
void streamer_read_value_range (class lto_input_block *, class data_in *, class Value_Range &)
 
struct bitpack_d bitpack_create (struct lto_output_stream *s)
 
void bp_pack_value (struct bitpack_d *bp, bitpack_word_t val, unsigned nbits)
 
void bp_pack_poly_value (struct bitpack_d *bp, const poly_int< NUM_POLY_INT_COEFFS, bitpack_word_t > &val, unsigned nbits)
 
void streamer_write_bitpack (struct bitpack_d *bp)
 
struct bitpack_d streamer_read_bitpack (class lto_input_block *ib)
 
bitpack_word_t bp_unpack_value (struct bitpack_d *bp, unsigned nbits)
 
poly_int< NUM_POLY_INT_COEFFS, bitpack_word_tbp_unpack_poly_value (struct bitpack_d *bp, unsigned nbits)
 
void streamer_write_char_stream (struct lto_output_stream *obs, char c)
 
unsigned char streamer_read_uchar (class lto_input_block *ib)
 
void streamer_write_hwi_in_range (struct lto_output_stream *obs, HOST_WIDE_INT min, HOST_WIDE_INT max, HOST_WIDE_INT val)
 
HOST_WIDE_INT streamer_read_hwi_in_range (class lto_input_block *ib, const char *purpose, HOST_WIDE_INT min, HOST_WIDE_INT max)
 
void bp_pack_int_in_range (struct bitpack_d *bp, HOST_WIDE_INT min, HOST_WIDE_INT max, HOST_WIDE_INT val)
 
HOST_WIDE_INT bp_unpack_int_in_range (struct bitpack_d *bp, const char *purpose, HOST_WIDE_INT min, HOST_WIDE_INT max)
 
void streamer_write_record_start (struct output_block *ob, enum LTO_tags tag)
 
enum LTO_tags streamer_read_record_start (class lto_input_block *ib)
 

Variables

static unsigned const BITS_PER_BITPACK_WORD = HOST_BITS_PER_WIDE_INT
 

Macro Definition Documentation

◆ bp_pack_enum

#define bp_pack_enum ( bp,
enum_name,
enum_last,
val )    bp_pack_int_in_range ((bp), 0, (int)(enum_last) - 1, (int)(val))

◆ bp_unpack_enum

#define bp_unpack_enum ( bp,
enum_name,
enum_last )
Value:
(enum enum_name)bp_unpack_int_in_range ((bp), #enum_name, 0, \
(int)(enum_last) - 1)
HOST_WIDE_INT bp_unpack_int_in_range(struct bitpack_d *bp, const char *purpose, HOST_WIDE_INT min, HOST_WIDE_INT max)
Definition data-streamer.h:300
T * ggc_alloc(ALONE_CXX_MEM_STAT_INFO)
Definition ggc.h:184
Input enum of type "enum enum_name" from BP.
Assume range 0...ENUM_LAST - 1.   

Referenced by bp_unpack_machine_mode(), input_edge(), input_overwrite_node(), lto_input_mode_table(), stream_in_histogram_value(), streamer_read_tree_bitfields(), unpack_ts_function_decl_value_fields(), and unpack_ts_omp_clause_value_fields().

◆ streamer_read_enum

#define streamer_read_enum ( ib,
enum_name,
enum_last )
Value:
(enum enum_name)streamer_read_hwi_in_range ((ib), #enum_name, 0, \
(int)(enum_last) - 1)
HOST_WIDE_INT streamer_read_hwi_in_range(class lto_input_block *ib, const char *purpose, HOST_WIDE_INT min, HOST_WIDE_INT max)
Definition data-streamer.h:260
Input enum of type "enum enum_name" from IB.
Assume range 0...ENUM_LAST - 1.   

Referenced by input_cfg(), input_cgraph_1(), input_gimple_stmt(), input_offload_tables(), input_varpool_node(), streamer_get_pickled_tree(), streamer_read_record_start(), and streamer_read_value_range().

◆ streamer_write_enum

#define streamer_write_enum ( obs,
enum_name,
enum_last,
val )    streamer_write_hwi_in_range ((obs), 0, (int)(enum_last) - 1, (int)(val))
Output VAL of type "enum enum_name" into OBS.
Assume range 0...ENUM_LAST - 1.   

Referenced by lto_output_edge(), lto_output_node(), lto_output_tree(), lto_output_varpool_node(), output_cfg(), output_gimple_stmt(), output_offload_tables(), and streamer_write_record_start().

Typedef Documentation

◆ bitpack_word_t

Function Documentation

◆ bitpack_create()

◆ bp_pack_int_in_range()

void bp_pack_int_in_range ( struct bitpack_d * bp,
HOST_WIDE_INT min,
HOST_WIDE_INT max,
HOST_WIDE_INT val )
inline
Output VAL into BP and verify it is in range MIN...MAX that is supposed
to be compile time constant.
Be host independent, limit range to 31bits.   

References bp_pack_value(), floor_log2(), gcc_checking_assert, and ggc_alloc().

Referenced by lto_output_location_1().

◆ bp_pack_poly_value()

void bp_pack_poly_value ( struct bitpack_d * bp,
const poly_int< NUM_POLY_INT_COEFFS, bitpack_word_t > & val,
unsigned nbits )
inline
Pack VAL into the bit-packing context BP, using NBITS for each
coefficient.   

References bp_pack_value(), poly_int< N, C >::coeffs, ggc_alloc(), i, and NUM_POLY_INT_COEFFS.

Referenced by lto_write_mode_table().

◆ bp_pack_real_value()

void bp_pack_real_value ( struct bitpack_d * bp,
const REAL_VALUE_TYPE * r )
Pack REAL_VALUE_TYPE R into BP.   

References bp_pack_value(), EXP_BITS, ggc_alloc(), HOST_BITS_PER_LONG, i, r, and SIGSZ.

Referenced by pack_ts_real_cst_value_fields(), and streamer_write_real_value().

◆ bp_pack_string()

void bp_pack_string ( struct output_block * ob,
struct bitpack_d * bp,
const char * s,
bool persistent )
Output the '\0' terminated STRING to the string
table in OB.  Then put the index onto the bitpack BP.
When PERSISTENT is set, the string S is supposed to not change during
duration of the OB and thus OB can keep pointer into it.   

References bp_pack_var_len_unsigned(), ggc_alloc(), string_slot::s, and streamer_string_index().

Referenced by lto_output_location_1(), lto_write_mode_table(), and pack_ts_translation_unit_decl_value_fields().

◆ bp_pack_string_with_length()

void bp_pack_string_with_length ( struct output_block * ob,
struct bitpack_d * bp,
const char * s,
unsigned int len,
bool persistent )
Output STRING of LEN characters to the string table in OB.  Then
put the index into BP.
When PERSISTENT is set, the string S is supposed to not change during
duration of the OB and thus OB can keep pointer into it.   

References bp_pack_var_len_unsigned(), ggc_alloc(), string_slot::len, string_slot::s, and streamer_string_index().

◆ bp_pack_value()

◆ bp_pack_var_len_int()

void bp_pack_var_len_int ( struct bitpack_d * bp,
HOST_WIDE_INT work )
Pack WORK into BP in a variant of sleb format.   

References bp_pack_value(), and ggc_alloc().

Referenced by pack_ts_fixed_cst_value_fields(), and pack_ts_int_cst_value_fields().

◆ bp_pack_var_len_unsigned()

void bp_pack_var_len_unsigned ( struct bitpack_d * bp,
unsigned HOST_WIDE_INT work )
In data-streamer.cc   
Generic streaming support for basic data types.

   Copyright (C) 2011-2024 Free Software Foundation, Inc.
   Contributed by Diego Novillo <dnovillo@google.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Pack WORK into BP in a variant of uleb format.   

References bp_pack_value(), and ggc_alloc().

Referenced by bp_pack_string(), bp_pack_string_with_length(), lto_output_edge(), lto_output_location_1(), output_cfg(), output_gimple_stmt(), pack_ts_decl_common_value_fields(), pack_ts_type_common_value_fields(), and streamer_write_tree_bitfields().

◆ bp_unpack_indexed_string()

const char * bp_unpack_indexed_string ( class data_in * data_in,
struct bitpack_d * bp,
unsigned int * rlen )
Read a string from the string table in DATA_IN using the bitpack BP.
Write the length to RLEN.   

References bp_unpack_var_len_unsigned(), ggc_alloc(), and string_for_index().

Referenced by bp_unpack_string(), and lto_input_mode_table().

◆ bp_unpack_int_in_range()

HOST_WIDE_INT bp_unpack_int_in_range ( struct bitpack_d * bp,
const char * purpose,
HOST_WIDE_INT min,
HOST_WIDE_INT max )
inline
Input VAL into BP and verify it is in range MIN...MAX that is supposed
to be compile time constant.  PURPOSE is used for error reporting.   

References bp_unpack_value(), floor_log2(), gcc_checking_assert, ggc_alloc(), and lto_value_range_error().

Referenced by lto_location_cache::input_location_and_block().

◆ bp_unpack_poly_value()

poly_int< NUM_POLY_INT_COEFFS, bitpack_word_t > bp_unpack_poly_value ( struct bitpack_d * bp,
unsigned nbits )
inline
Unpacks a polynomial value from the bit-packing context BP in which each
coefficient has NBITS bits.   

References bp_unpack_value(), poly_int< N, C >::coeffs, ggc_alloc(), i, and NUM_POLY_INT_COEFFS.

Referenced by lto_input_mode_table().

◆ bp_unpack_real_value()

void bp_unpack_real_value ( struct bitpack_d * bp,
REAL_VALUE_TYPE * r )
Unpack REAL_VALUE_TYPE R from BP.   

References bp_unpack_value(), EXP_BITS, ggc_alloc(), HOST_BITS_PER_LONG, i, r, and SIGSZ.

Referenced by streamer_read_real_value(), and unpack_ts_real_cst_value_fields().

◆ bp_unpack_string()

const char * bp_unpack_string ( class data_in * data_in,
struct bitpack_d * bp )
Read a NULL terminated string from the string table in DATA_IN.   

References bp_unpack_indexed_string(), ggc_alloc(), internal_error(), and NULL.

Referenced by lto_location_cache::input_location_and_block(), and unpack_ts_translation_unit_decl_value_fields().

◆ bp_unpack_value()

◆ bp_unpack_var_len_int()

HOST_WIDE_INT bp_unpack_var_len_int ( struct bitpack_d * bp)
Unpack VAL from BP in a variant of sleb format.   

References bp_unpack_value(), ggc_alloc(), HOST_BITS_PER_WIDE_INT, HOST_WIDE_INT_1U, and shift.

Referenced by unpack_ts_fixed_cst_value_fields(), and unpack_ts_int_cst_value_fields().

◆ bp_unpack_var_len_unsigned()

◆ streamer_read_bitpack()

◆ streamer_read_gcov_count()

gcov_type streamer_read_gcov_count ( class lto_input_block * ib)

◆ streamer_read_hwi()

◆ streamer_read_hwi_in_range()

HOST_WIDE_INT streamer_read_hwi_in_range ( class lto_input_block * ib,
const char * purpose,
HOST_WIDE_INT min,
HOST_WIDE_INT max )
inline
Input VAL into OBS and verify it is in range MIN...MAX that is supposed
to be compile time constant.  PURPOSE is used for error reporting.   

References gcc_checking_assert, ggc_alloc(), lto_value_range_error(), and streamer_read_uhwi().

◆ streamer_read_indexed_string()

const char * streamer_read_indexed_string ( class data_in * data_in,
class lto_input_block * ib,
unsigned int * rlen )
Read a string from the string table in DATA_IN using input block
IB.  Write the length to RLEN.   

References ggc_alloc(), streamer_read_uhwi(), and string_for_index().

Referenced by input_identifier(), streamer_read_string(), and streamer_read_string_cst().

◆ streamer_read_poly_int64()

poly_int64 streamer_read_poly_int64 ( class lto_input_block * ib)

◆ streamer_read_poly_uint64()

poly_uint64 streamer_read_poly_uint64 ( class lto_input_block * ib)
Read a poly_uint64 from IB.   

References poly_int< N, C >::coeffs, ggc_alloc(), i, NUM_POLY_INT_COEFFS, and streamer_read_uhwi().

◆ streamer_read_record_start()

enum LTO_tags streamer_read_record_start ( class lto_input_block * ib)
inline

◆ streamer_read_string()

const char * streamer_read_string ( class data_in * data_in,
class lto_input_block * ib )
In data-streamer-in.cc   
Read a NULL terminated string from the string table in DATA_IN.   

References ggc_alloc(), internal_error(), NULL, and streamer_read_indexed_string().

Referenced by ipa_odr_read_section(), and lto_read_tree_1().

◆ streamer_read_uchar()

unsigned char streamer_read_uchar ( class lto_input_block * ib)
inline
Read byte from the input block.   

References ggc_alloc(), and lto_section_overrun().

Referenced by input_eh_regions(), input_ssa_names(), lto_input_data_block(), and streamer_read_hwi().

◆ streamer_read_uhwi()

◆ streamer_read_value_range()

◆ streamer_read_wide_int()

wide_int streamer_read_wide_int ( class lto_input_block * ib)
Read the physical representation of a wide_int val from
input block IB.   

References a, wide_int_storage::from_array(), ggc_alloc(), i, streamer_read_hwi(), streamer_read_uhwi(), UNLIKELY, and WIDE_INT_MAX_INL_ELTS.

Referenced by ipa_odr_read_section(), and streamer_read_value_range().

◆ streamer_read_widest_int()

widest_int streamer_read_widest_int ( class lto_input_block * ib)
Read the physical representation of a widest_int val from
input block IB.   

References a, ggc_alloc(), i, streamer_read_hwi(), streamer_read_uhwi(), UNLIKELY, and WIDE_INT_MAX_INL_ELTS.

Referenced by input_cfg().

◆ streamer_write_bitpack()

◆ streamer_write_char_stream()

◆ streamer_write_data_stream()

void streamer_write_data_stream ( struct lto_output_stream * obs,
const void * data,
size_t len )
Write raw DATA of length LEN to the output block OB.   

References ggc_alloc(), string_slot::len, and lto_append_block().

Referenced by lto_output_node(), lto_output_varpool_node(), and streamer_string_index().

◆ streamer_write_gcov_count()

void streamer_write_gcov_count ( struct output_block * ob,
gcov_type work )
Write a gcov counter value WORK to OB->main_stream.   

References output_block::main_stream, and streamer_write_gcov_count_stream().

Referenced by profile_count::stream_out(), and stream_out_histogram_value().

◆ streamer_write_gcov_count_stream()

void streamer_write_gcov_count_stream ( struct lto_output_stream * obs,
gcov_type work )

◆ streamer_write_hwi()

◆ streamer_write_hwi_in_range()

void streamer_write_hwi_in_range ( struct lto_output_stream * obs,
HOST_WIDE_INT min,
HOST_WIDE_INT max,
HOST_WIDE_INT val )
inline
Output VAL into OBS and verify it is in range MIN...MAX that is supposed
to be compile time constant.
Be host independent, limit range to 31bits.   

References gcc_checking_assert, ggc_alloc(), and streamer_write_uhwi_stream().

◆ streamer_write_hwi_stream()

◆ streamer_write_poly_int64()

void streamer_write_poly_int64 ( struct output_block * ob,
poly_int64 work )
Write a poly_int64 value WORK to OB->main_stream.   

References poly_int< N, C >::coeffs, i, output_block::main_stream, NUM_POLY_INT_COEFFS, and streamer_write_hwi_stream().

Referenced by modref_access_node::stream_out().

◆ streamer_write_poly_uint64()

void streamer_write_poly_uint64 ( struct output_block * ob,
poly_uint64 work )
Write a poly_uint64 value WORK to OB->main_stream.   

References poly_int< N, C >::coeffs, i, output_block::main_stream, NUM_POLY_INT_COEFFS, and streamer_write_uhwi_stream().

◆ streamer_write_record_start()

◆ streamer_write_string()

void streamer_write_string ( struct output_block * ob,
struct lto_output_stream * index_stream,
const char * string,
bool persistent )
Output the '\0' terminated STRING to the string
table in OB.  Then put the index onto the INDEX_STREAM.
When PERSISTENT is set, the string S is supposed to not change during
duration of the OB and thus OB can keep pointer into it.   

References ggc_alloc(), streamer_write_char_stream(), and streamer_write_string_with_length().

Referenced by ipa_odr_summary_write(), lto_write_tree_1(), and output_gimple_stmt().

◆ streamer_write_string_with_length()

void streamer_write_string_with_length ( struct output_block * ob,
struct lto_output_stream * index_stream,
const char * s,
unsigned int len,
bool persistent )
Output STRING of LEN characters to the string table in OB. The
string might or might not include a trailing '\0'. Then put the
index onto the INDEX_STREAM. 
When PERSISTENT is set, the string S is supposed to not change during
duration of the OB and thus OB can keep pointer into it.   

References ggc_alloc(), string_slot::len, string_slot::s, streamer_string_index(), streamer_write_char_stream(), and streamer_write_uhwi_stream().

Referenced by streamer_write_string(), streamer_write_string_cst(), and write_identifier().

◆ streamer_write_uhwi()

◆ streamer_write_uhwi_stream()

◆ streamer_write_vrange()

void streamer_write_vrange ( struct output_block * ,
const class vrange &  )

◆ streamer_write_wide_int()

void streamer_write_wide_int ( struct output_block * ob,
const wide_int & val )

◆ streamer_write_widest_int()

void streamer_write_widest_int ( struct output_block * ob,
const widest_int & w )
Emit the physical representation of widest_int W to output block OB.   

References ggc_alloc(), i, string_slot::len, streamer_write_hwi(), and streamer_write_uhwi().

Referenced by output_cfg().

◆ streamer_write_zero()

void streamer_write_zero ( struct output_block * ob)
In data-streamer-out.cc   
Write a zero to the output stream.   

References output_block::main_stream, and streamer_write_char_stream().

Referenced by output_eh_lp(), output_eh_region(), output_ssa_names(), and stream_write_tree_ref().

Variable Documentation

◆ BITS_PER_BITPACK_WORD

unsigned const BITS_PER_BITPACK_WORD = HOST_BITS_PER_WIDE_INT
static
Generic streaming support for various data types.

   Copyright (C) 2011-2024 Free Software Foundation, Inc.
   Contributed by Diego Novillo <dnovillo@google.com>

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.   
Data structures used to pack values and bitflags into a vector of
words.  Used to stream values of a fixed number of bits in a space
efficient way.   

Referenced by bp_pack_value(), and bp_unpack_value().