GCC Middle and Back End API Reference
data-streamer.h File Reference
#include "vec.h"
#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)
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_gcov_count (struct output_block *, gcov_type)
void streamer_write_string (struct output_block *, struct lto_output_stream *, const char *, bool)
unsigned streamer_string_index (struct output_block *, const char *, unsigned int, 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)
const char * string_for_index (struct data_in *, unsigned int, unsigned int *)
const char * streamer_read_string (struct data_in *, struct lto_input_block *)
const char * streamer_read_indexed_string (struct data_in *, struct lto_input_block *, unsigned int *)
const char * bp_unpack_indexed_string (struct data_in *, struct bitpack_d *, unsigned int *)
const char * bp_unpack_string (struct data_in *, struct bitpack_d *)
unsigned HOST_WIDE_INT streamer_read_uhwi (struct lto_input_block *)
HOST_WIDE_INT streamer_read_hwi (struct lto_input_block *)
gcov_type streamer_read_gcov_count (struct lto_input_block *)
static struct bitpack_d bitpack_create ()
static void bp_pack_value ()
static void streamer_write_bitpack ()
static struct bitpack_d streamer_read_bitpack ()
static bitpack_word_t bp_unpack_value ()
static void streamer_write_char_stream ()
static unsigned char streamer_read_uchar ()
static void streamer_write_hwi_in_range (struct lto_output_stream *obs, HOST_WIDE_INT min, HOST_WIDE_INT max, HOST_WIDE_INT val)
static HOST_WIDE_INT streamer_read_hwi_in_range (struct lto_input_block *ib, const char *purpose, HOST_WIDE_INT min, HOST_WIDE_INT max)
static void bp_pack_int_in_range (struct bitpack_d *bp, HOST_WIDE_INT min, HOST_WIDE_INT max, HOST_WIDE_INT val)
static HOST_WIDE_INT bp_unpack_int_in_range (struct bitpack_d *bp, const char *purpose, HOST_WIDE_INT min, HOST_WIDE_INT max)
static void streamer_write_record_start ()
static enum LTO_tags streamer_read_record_start ()

Variables

static unsigned const BITS_PER_BITPACK_WORD = HOST_BITS_PER_WIDE_INT

Macro Definition Documentation

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

Output VAL of type "enum enum_name" into BP. Assume range 0...ENUM_LAST - 1.

Referenced by pack_ts_fixed_cst_value_fields().

#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)

Input enum of type "enum enum_name" from BP. Assume range 0...ENUM_LAST - 1.

Referenced by unpack_ts_fixed_cst_value_fields().

#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)

Input enum of type "enum enum_name" from IB. Assume range 0...ENUM_LAST - 1.

#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_symtab_encoder_in_partition_p(), and output_eh_regions().


Typedef Documentation

typedef unsigned HOST_WIDE_INT bitpack_word_t

Function Documentation

static struct bitpack_d bitpack_create ( )
staticread

Returns a new bit-packing context for bit-packing into S.

References BITS_PER_BITPACK_WORD, gcc_checking_assert, bitpack_d::pos, and bitpack_d::word.

static void bp_pack_int_in_range ( struct bitpack_d bp,
HOST_WIDE_INT  min,
HOST_WIDE_INT  max,
HOST_WIDE_INT  val 
)
inlinestatic

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_unpack_value(), floor_log2(), gcc_checking_assert, HOST_WIDE_INT, and lto_value_range_error().

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.

Referenced by pack_ts_block_value_fields().

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.

static void bp_pack_value ( )
inlinestatic

Pack the NBITS bit sized value VAL into the bit-packing context BP.

Verify that VAL fits in the NBITS.

 If val does not fit into the current bitpack word switch to the
 next one.   

References bitpack_d::stream, and streamer_write_uhwi_stream().

Referenced by bp_pack_var_len_int(), bp_pack_var_len_unsigned(), lto_output_varpool_node(), pack_ts_base_value_fields(), pack_ts_fixed_cst_value_fields(), pack_ts_int_cst_value_fields(), and streamer_read_hwi_in_range().

void bp_pack_var_len_int ( struct bitpack_d ,
HOST_WIDE_INT   
)
void bp_pack_var_len_unsigned ( struct bitpack_d ,
unsigned  HOST_WIDE_INT 
)
const char* bp_unpack_indexed_string ( struct 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_indexed_string(), and lto_input_block::len.

Referenced by bp_unpack_indexed_string().

static HOST_WIDE_INT bp_unpack_int_in_range ( struct bitpack_d bp,
const char *  purpose,
HOST_WIDE_INT  min,
HOST_WIDE_INT  max 
)
inlinestatic

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.

const char* bp_unpack_string ( struct data_in ,
struct bitpack_d  
)
static bitpack_word_t bp_unpack_value ( )
inlinestatic

Unpacks NBITS bits from the bit-packing context BP and returns them.

If there are not continuous nbits in the current bitpack word switch to the next one.

Referenced by bp_pack_int_in_range(), bp_unpack_var_len_int(), bp_unpack_var_len_unsigned(), unpack_ts_block_value_fields(), unpack_ts_decl_wrtl_value_fields(), unpack_ts_fixed_cst_value_fields(), unpack_ts_function_decl_value_fields(), and unpack_ts_int_cst_value_fields().

HOST_WIDE_INT bp_unpack_var_len_int ( struct bitpack_d )
unsigned HOST_WIDE_INT bp_unpack_var_len_unsigned ( struct bitpack_d )
static struct bitpack_d streamer_read_bitpack ( )
staticread

Returns a new bit-packing context for bit-unpacking from IB.

References bitpack_d::stream, streamer_read_uhwi(), and bitpack_d::word.

Referenced by input_phi().

gcov_type streamer_read_gcov_count ( struct lto_input_block )
HOST_WIDE_INT streamer_read_hwi ( struct lto_input_block )
static HOST_WIDE_INT streamer_read_hwi_in_range ( struct lto_input_block ib,
const char *  purpose,
HOST_WIDE_INT  min,
HOST_WIDE_INT  max 
)
inlinestatic

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 bp_pack_value(), floor_log2(), gcc_checking_assert, and HOST_WIDE_INT.

const char* streamer_read_indexed_string ( struct data_in data_in,
struct 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.

static enum LTO_tags streamer_read_record_start ( )
inlinestatic

Return the next tag in the input block IB.

Referenced by lto_init_eh(), lto_input_eh_catch_list(), lto_input_function_body(), and lto_read_tree_1().

const char* streamer_read_string ( struct data_in ,
struct lto_input_block  
)
static unsigned char streamer_read_uchar ( )
inlinestatic

Read byte from the input block.

Referenced by lto_read_tree_1().

unsigned HOST_WIDE_INT streamer_read_uhwi ( struct lto_input_block )
unsigned streamer_string_index ( struct output_block ob,
const char *  s,
unsigned int  len,
bool  persistent 
)

Routines for saving various data types to a file stream. This deals with various data types like strings, integers, enums, etc.

Copyright (C) 2011-2013 Free Software Foundation, Inc. Contributed by Diego Novillo dnovi.nosp@m.llo@.nosp@m.googl.nosp@m.e.co.nosp@m.m

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/. Return index used to reference STRING of LEN characters in 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 hash_table< Descriptor, Allocator >::find_slot(), string_slot::len, lto_output_data_stream(), NULL, output_block::obstack, string_slot::s, string_slot::slot_num, streamer_write_uhwi_stream(), output_block::string_hash_table, output_block::string_stream, and lto_output_stream::total_size.

Referenced by streamer_write_string_with_length().

static void streamer_write_bitpack ( )
inlinestatic

Finishes bit-packing of BP.

static void streamer_write_char_stream ( )
inlinestatic

Write a character to the output block.

No space left.

 Write the actual character.   

References lto_input_block::data, lto_input_block::len, lto_section_overrun(), and lto_input_block::p.

Referenced by streamer_write_string_with_length().

void streamer_write_gcov_count ( struct output_block ,
gcov_type   
)
void streamer_write_gcov_count_stream ( struct lto_output_stream ,
gcov_type   
)
void streamer_write_hwi ( struct output_block ,
HOST_WIDE_INT   
)
static void streamer_write_hwi_in_range ( struct lto_output_stream obs,
HOST_WIDE_INT  min,
HOST_WIDE_INT  max,
HOST_WIDE_INT  val 
)
inlinestatic

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, HOST_WIDE_INT, lto_value_range_error(), and streamer_read_uhwi().

void streamer_write_hwi_stream ( struct lto_output_stream ,
HOST_WIDE_INT   
)
static void streamer_write_record_start ( )
inlinestatic

Output the start of a record with TAG to output block OB.

Referenced by lto_output_tree(), and output_eh_try_list().

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.

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 streamer_string_index(), streamer_write_char_stream(), and streamer_write_uhwi_stream().

Referenced by streamer_write_string_cst(), and write_identifier().

void streamer_write_uhwi ( struct output_block ,
unsigned  HOST_WIDE_INT 
)
void streamer_write_uhwi_stream ( struct lto_output_stream obs,
unsigned HOST_WIDE_INT  work 
)

Write an unsigned HOST_WIDE_INT value WORK to OBS.

More bytes to follow.

           More bytes to follow.   

Referenced by bp_pack_value(), streamer_string_index(), streamer_write_string_with_length(), and streamer_write_zero().

void streamer_write_zero ( struct output_block )
const char* string_for_index ( struct data_in ,
unsigned  int,
unsigned int *   
)

Variable Documentation

unsigned const BITS_PER_BITPACK_WORD = HOST_BITS_PER_WIDE_INT
static

Generic streaming support for various data types.

Copyright (C) 2011-2013 Free Software Foundation, Inc. Contributed by Diego Novillo dnovi.nosp@m.llo@.nosp@m.googl.nosp@m.e.co.nosp@m.m

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 bitpack_create().