GCC Middle and Back End API Reference
lto-streamer-in.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "cfghooks.h"
#include "tree-pass.h"
#include "ssa.h"
#include "gimple-streamer.h"
#include "toplev.h"
#include "gimple-iterator.h"
#include "tree-cfg.h"
#include "tree-into-ssa.h"
#include "tree-dfa.h"
#include "tree-ssa.h"
#include "except.h"
#include "cgraph.h"
#include "cfgloop.h"
#include "debug.h"
#include "alloc-pool.h"
Include dependency graph for lto-streamer-in.cc:

Data Structures

struct  string_pair_map
 
struct  string_pair_map_hasher
 

Macros

#define INCLUDE_MEMORY
 
#define FIXUP_EH_REGION(r)
 
#define FIXUP_EH_LP(p)
 
#define STMT_UID_NOT_IN_RANGE(uid)
 

Functions

void lto_tag_check_set (enum LTO_tags actual, int ntags,...)
 
void lto_input_data_block (class lto_input_block *ib, void *addr, size_t length)
 
static char * relative_path_prefix (const char *data_wd, const char *cwd)
 
static const char * canon_relative_path_prefix (const char *data_wd, const char *cwd)
 
static const char * canon_relative_file_name (const char *relative_prefix, const char *string)
 
static const char * canon_file_name (const char *relative_prefix, const char *string)
 
void lto_input_location (location_t *loc, struct bitpack_d *bp, class data_in *data_in)
 
tree lto_input_tree_ref (class lto_input_block *ib, class data_in *data_in, struct function *fn, enum LTO_tags tag)
 
tree lto_input_var_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data)
 
tree lto_input_fn_decl_ref (lto_input_block *ib, lto_file_decl_data *file_data)
 
static struct eh_catch_dlto_input_eh_catch_list (class lto_input_block *ib, class data_in *data_in, eh_catch *last_p)
 
static eh_region input_eh_region (class lto_input_block *ib, class data_in *data_in, int ix)
 
static eh_landing_pad input_eh_lp (class lto_input_block *ib, class data_in *data_in, int ix)
 
static void fixup_eh_region_pointers (struct function *fn, HOST_WIDE_INT root_region)
 
void lto_init_eh (void)
 
static void input_eh_regions (class lto_input_block *ib, class data_in *data_in, struct function *fn)
 
static basic_block make_new_block (struct function *fn, unsigned int index)
 
static void input_cfg (class lto_input_block *ib, class data_in *data_in, struct function *fn)
 
static void input_ssa_names (class lto_input_block *ib, class data_in *data_in, struct function *fn)
 
static void fixup_call_stmt_edges_1 (struct cgraph_node *node, gimple **stmts, struct function *fn)
 
static void fixup_call_stmt_edges (struct cgraph_node *orig, gimple **stmts)
 
static void input_struct_function_base (struct function *fn, class data_in *data_in, class lto_input_block *ib)
 
static tree streamer_read_chain (class lto_input_block *ib, class data_in *data_in)
 
static void input_function (tree fn_decl, class data_in *data_in, class lto_input_block *ib, class lto_input_block *ib_cfg, cgraph_node *node)
 
static void input_constructor (tree var, class data_in *data_in, class lto_input_block *ib)
 
static void lto_read_body_or_constructor (struct lto_file_decl_data *file_data, struct symtab_node *node, const char *data, enum lto_section_type section_type)
 
void lto_input_function_body (struct lto_file_decl_data *file_data, struct cgraph_node *node, const char *data)
 
void lto_input_variable_constructor (struct lto_file_decl_data *file_data, struct varpool_node *node, const char *data)
 
static void lto_read_tree_1 (class lto_input_block *ib, class data_in *data_in, tree expr)
 
static tree lto_read_tree (class lto_input_block *ib, class data_in *data_in, enum LTO_tags tag, hashval_t hash)
 
hashval_t lto_input_scc (class lto_input_block *ib, class data_in *data_in, unsigned *len, unsigned *entry_len, bool shared_scc)
 
tree stream_read_tree_ref (lto_input_block *ib, data_in *data_in)
 
tree lto_input_tree_1 (class lto_input_block *ib, class data_in *data_in, enum LTO_tags tag, hashval_t hash)
 
tree lto_input_tree (class lto_input_block *ib, class data_in *data_in)
 
void lto_input_toplevel_asms (struct lto_file_decl_data *file_data, int order_base)
 
void lto_input_mode_table (struct lto_file_decl_data *file_data)
 
void lto_reader_init (void)
 
void lto_free_file_name_hash (void)
 
class data_inlto_data_in_create (struct lto_file_decl_data *file_data, const char *strings, unsigned len, vec< ld_plugin_symbol_resolution_t > resolutions)
 
void lto_data_in_delete (class data_in *data_in)
 

Variables

static struct object_allocator< struct string_slot > * string_slot_allocator
 
static hash_table< string_slot_hasher > * file_name_hash_table
 
static struct obstack file_name_obstack
 
static struct object_allocator< struct string_pair_map > * string_pair_map_allocator
 
static hash_table< string_pair_map_hasher > * path_name_pair_hash_table
 
vec< dref_entrydref_queue
 

Macro Definition Documentation

◆ FIXUP_EH_LP

#define FIXUP_EH_LP ( p)
Value:
(p) = (*lp_array)[(HOST_WIDE_INT) (intptr_t) (p)]

Referenced by fixup_eh_region_pointers().

◆ FIXUP_EH_REGION

#define FIXUP_EH_REGION ( r)
Value:
(r) = (*eh_array)[(HOST_WIDE_INT) (intptr_t) (r)]
poly_int< N, C > r
Definition poly-int.h:774

Referenced by fixup_eh_region_pointers().

◆ INCLUDE_MEMORY

#define INCLUDE_MEMORY
Read the GIMPLE representation from a file stream.

   Copyright (C) 2009-2024 Free Software Foundation, Inc.
   Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
   Re-implemented 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/>.   

◆ STMT_UID_NOT_IN_RANGE

#define STMT_UID_NOT_IN_RANGE ( uid)
Value:
(gimple_stmt_max_uid (fn) < uid || uid == 0)
unsigned int gimple_stmt_max_uid(struct function *fn)
Definition gimple.h:1658

Referenced by fixup_call_stmt_edges_1().

Function Documentation

◆ canon_file_name()

static const char * canon_file_name ( const char * relative_prefix,
const char * string )
static
Lookup STRING in file_name_hash_table.  If found, return the existing
string, otherwise insert STRING as the canonical version.
If STRING is a relative pathname and RELATIVE_PREFIX is non-NULL, use
canon_relative_file_name instead.   

References canon_relative_file_name(), file_name_hash_table, file_name_obstack, hash_table< Descriptor, Lazy, Allocator >::find_slot(), string_slot::len, NULL, string_slot::s, and string_slot_allocator.

Referenced by lto_location_cache::input_location_and_block().

◆ canon_relative_file_name()

static const char * canon_relative_file_name ( const char * relative_prefix,
const char * string )
static
Look up the pair of RELATIVE_PREFIX and STRING strings in a hash table.
If found, return the concatenation of those from the hash table,
otherwise concatenate them.   

References inchash::hash::add_ptr(), inchash::hash::end(), file_name_obstack, string_pair_map::hash, inchash::hash::merge_hash(), NULL, path_name_pair_hash_table, string_pair_map::prefix, string_pair_map::str1, string_pair_map::str2, string_pair_map::str3, and string_pair_map_allocator.

Referenced by canon_file_name().

◆ canon_relative_path_prefix()

static const char * canon_relative_path_prefix ( const char * data_wd,
const char * cwd )
static

◆ fixup_call_stmt_edges()

static void fixup_call_stmt_edges ( struct cgraph_node * orig,
gimple ** stmts )
static

◆ fixup_call_stmt_edges_1()

static void fixup_call_stmt_edges_1 ( struct cgraph_node * node,
gimple ** stmts,
struct function * fn )
static

◆ fixup_eh_region_pointers()

static void fixup_eh_region_pointers ( struct function * fn,
HOST_WIDE_INT root_region )
static
After reading the EH regions, pointers to peer and children regions
are region numbers.  This converts all these region numbers into
real pointers into the rematerialized regions for FN.  ROOT_REGION
is the region number for the root EH region in FN.   

References function::eh, FIXUP_EH_LP, FIXUP_EH_REGION, FOR_EACH_VEC_ELT, gcc_assert, i, eh_landing_pad_d::index, eh_status::lp_array, eh_landing_pad_d::next_lp, NULL, r, eh_landing_pad_d::region, eh_status::region_array, and eh_status::region_tree.

Referenced by input_eh_regions().

◆ input_cfg()

◆ input_constructor()

static void input_constructor ( tree var,
class data_in * data_in,
class lto_input_block * ib )
static
Read the body of function FN_DECL from DATA_IN using input block IB.   

References DECL_INITIAL, and stream_read_tree.

Referenced by lto_read_body_or_constructor().

◆ input_eh_lp()

static eh_landing_pad input_eh_lp ( class lto_input_block * ib,
class data_in * data_in,
int ix )
static

◆ input_eh_region()

◆ input_eh_regions()

◆ input_function()

static void input_function ( tree fn_decl,
class data_in * data_in,
class lto_input_block * ib,
class lto_input_block * ib_cfg,
cgraph_node * node )
static
Read the body of function FN_DECL from DATA_IN using input block IB.   

References lto_location_cache::apply_location_cache(), as_a(), bb_seq(), CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, cgraph_node::count_materialization_scale, DECL_ARGUMENTS, decl_debug_args_insert(), DECL_INITIAL, DECL_RESULT, DECL_SAVED_TREE, DECL_STRUCT_FUNCTION, ei_edge(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, execute_all_ipa_stmt_fixups(), fixup_call_stmt_edges(), FOR_ALL_BB_FN, free(), free_dominance_info(), gcc_assert, gimple_block(), gimple_call_internal_fn(), gimple_call_internal_p(), gimple_call_set_internal_fn(), gimple_debug_inline_entry_p(), gimple_debug_nonbind_marker_p(), gimple_register_cfg_hooks(), gimple_set_body(), gimple_set_uid(), gimple_stmt_max_uid(), gimple_uid(), gsi_end_p(), gsi_next(), gsi_remove(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), i, inc_gimple_stmt_max_uid(), inlined_function_outer_scope_p(), input_bb(), input_cfg(), input_eh_regions(), input_ssa_names(), input_struct_function_base(), is_gimple_call(), is_gimple_debug(), data_in::location_cache, LTO_function, lto_tag_check(), MAY_HAVE_DEBUG_BIND_STMTS, MAY_HAVE_DEBUG_MARKER_STMTS, NULL_TREE, pop_cfun(), push_struct_function(), release_defs(), SANITIZE_ADDRESS, SANITIZE_ALIGNMENT, SANITIZE_BOUNDS, SANITIZE_NULL, SANITIZE_OBJECT_SIZE, SANITIZE_POINTER_OVERFLOW, SANITIZE_THREAD, SANITIZE_VPTR, set_gimple_stmt_max_uid(), stream_read_tree, streamer_read_chain(), streamer_read_record_start(), streamer_read_uhwi(), unlink_stmt_vdef(), update_max_bb_count(), update_stmt(), and vec_safe_grow().

Referenced by lto_read_body_or_constructor().

◆ input_ssa_names()

static void input_ssa_names ( class lto_input_block * ib,
class data_in * data_in,
struct function * fn )
static

◆ input_struct_function_base()

◆ lto_data_in_create()

class data_in * lto_data_in_create ( struct lto_file_decl_data * file_data,
const char * strings,
unsigned len,
vec< ld_plugin_symbol_resolution_t > resolutions )

◆ lto_data_in_delete()

◆ lto_free_file_name_hash()

void lto_free_file_name_hash ( void )
Free hash table used to stream in location file names.   

References file_name_hash_table, NULL, path_name_pair_hash_table, string_pair_map_allocator, and string_slot_allocator.

◆ lto_init_eh()

void lto_init_eh ( void )
Initialize EH support.   

References init_eh().

◆ lto_input_data_block()

void lto_input_data_block ( class lto_input_block * ib,
void * addr,
size_t length )
Read LENGTH bytes from STREAM to ADDR.   

References i, and streamer_read_uchar().

◆ lto_input_eh_catch_list()

static struct eh_catch_d * lto_input_eh_catch_list ( class lto_input_block * ib,
class data_in * data_in,
eh_catch * last_p )
static
Read and return a double-linked list of catch handlers from input
block IB, using descriptors in DATA_IN.   

References add_type_for_runtime(), eh_catch_d::filter_list, ggc_cleared_alloc(), eh_catch_d::label, LTO_eh_catch, lto_tag_check_range(), NULL, eh_catch_d::prev_catch, stream_read_tree, streamer_read_record_start(), TREE_CHAIN, TREE_VALUE, and eh_catch_d::type_list.

Referenced by input_eh_region().

◆ lto_input_fn_decl_ref()

tree lto_input_fn_decl_ref ( lto_input_block * ib,
lto_file_decl_data * file_data )

◆ lto_input_function_body()

void lto_input_function_body ( struct lto_file_decl_data * file_data,
struct cgraph_node * node,
const char * data )
Read the body of NODE using DATA.  FILE_DATA holds the global
decls and types.   

References lto_read_body_or_constructor(), and LTO_section_function_body.

Referenced by cgraph_node::get_untransformed_body().

◆ lto_input_location()

void lto_input_location ( location_t * loc,
struct bitpack_d * bp,
class data_in * data_in )
Read a location bitpack from input block IB and either update *LOC directly
or add it to the location cache.
It is neccesary to call apply_location_cache to get *LOC updated.   

References lto_location_cache::input_location(), and data_in::location_cache.

Referenced by lto_streamer_hooks_init().

◆ lto_input_mode_table()

◆ lto_input_scc()

hashval_t lto_input_scc ( class lto_input_block * ib,
class data_in * data_in,
unsigned * len,
unsigned * entry_len,
bool shared_scc )

◆ lto_input_toplevel_asms()

◆ lto_input_tree()

◆ lto_input_tree_1()

◆ lto_input_tree_ref()

tree lto_input_tree_ref ( class lto_input_block * ib,
class data_in * data_in,
struct function * fn,
enum LTO_tags tag )
Read a reference to a tree node from DATA_IN using input block IB.
TAG is the expected node that should be found in IB, if TAG belongs
to one of the indexable trees, expect to read a reference index to
be looked up in one of the symbol tables, otherwise read the pysical
representation of the tree using stream_read_tree.  FN is the
function scope for the read tree.   

References lto_file_decl_data::current_decl_state, data_in::file_data, gcc_assert, gcc_checking_assert, LTO_DECL_STREAM, LTO_global_stream_ref, LTO_ssa_name_ref, NULL_TREE, SSANAMES, streamer_read_uhwi(), and lto_in_decl_state::streams.

Referenced by lto_input_tree_1().

◆ lto_input_var_decl_ref()

◆ lto_input_variable_constructor()

void lto_input_variable_constructor ( struct lto_file_decl_data * file_data,
struct varpool_node * node,
const char * data )
Read the body of NODE using DATA.  FILE_DATA holds the global
decls and types.   

References lto_read_body_or_constructor(), and LTO_section_function_body.

Referenced by varpool_node::get_constructor().

◆ lto_read_body_or_constructor()

◆ lto_read_tree()

static tree lto_read_tree ( class lto_input_block * ib,
class data_in * data_in,
enum LTO_tags tag,
hashval_t hash )
static
Read the physical representation of a tree node with tag TAG from
input block IB using the per-file context in DATA_IN.   

References lto_read_tree_1(), data_in::reader_cache, streamer_alloc_tree(), and streamer_tree_cache_append().

Referenced by lto_input_tree_1().

◆ lto_read_tree_1()

◆ lto_reader_init()

void lto_reader_init ( void )

◆ lto_tag_check_set()

void lto_tag_check_set ( enum LTO_tags actual,
int ntags,
... )
Check that tag ACTUAL has one of the given values.  NUM_TAGS is the
number of valid tag values to check.   

References ap, i, internal_error(), and lto_tag_name().

Referenced by input_bb().

◆ make_new_block()

static basic_block make_new_block ( struct function * fn,
unsigned int index )
static
Make a new basic block with index INDEX in function FN.   

References alloc_block(), basic_block_def::index, n_basic_blocks_for_fn, and SET_BASIC_BLOCK_FOR_FN.

Referenced by input_cfg().

◆ relative_path_prefix()

static char * relative_path_prefix ( const char * data_wd,
const char * cwd )
static
Compute the relative path to get to DATA_WD (absolute directory name)
from CWD (another absolute directory name).  E.g. for
DATA_WD of "/tmp/foo/bar" and CWD of "/tmp/baz/qux" return
"../../foo/bar".  Returned string should be freed by the caller.
Return NULL if absolute file name needs to be used.   

References DIR_SEPARATOR, i, and NULL.

Referenced by canon_relative_path_prefix().

◆ stream_read_tree_ref()

◆ streamer_read_chain()

static tree streamer_read_chain ( class lto_input_block * ib,
class data_in * data_in )
static
Read a chain of tree nodes from input block IB.  DATA_IN contains
tables and descriptors for the file being read.   

References NULL_TREE, stream_read_tree, and TREE_CHAIN.

Referenced by input_function().

Variable Documentation

◆ dref_queue

vec<dref_entry> dref_queue
Queue of acummulated decl -> DIE mappings.  Similar to locations those
are only applied to prevailing tree nodes during tree merging.   

Referenced by lto_input_tree(), and lto_read_tree_1().

◆ file_name_hash_table

hash_table<string_slot_hasher>* file_name_hash_table
static
The table to hold the file names.   

Referenced by canon_file_name(), lto_free_file_name_hash(), and lto_reader_init().

◆ file_name_obstack

struct obstack file_name_obstack
static
The table to hold the relative pathname prefixes.   
This obstack holds file names used in locators. Line map datastructures
points here and thus it needs to be kept allocated as long as linemaps
exists.   

Referenced by canon_file_name(), canon_relative_file_name(), canon_relative_path_prefix(), and lto_reader_init().

◆ path_name_pair_hash_table

hash_table<string_pair_map_hasher>* path_name_pair_hash_table
static
The table to hold the pairs of pathnames and corresponding
resulting pathname.  Used for both mapping of get_src_pwd ()
and recorded source working directory to relative path prefix
from current working directory to the recorded one, and for
mapping of that relative path prefix and some relative path
to those concatenated.   

Referenced by canon_relative_file_name(), canon_relative_path_prefix(), and lto_free_file_name_hash().

◆ string_pair_map_allocator

struct object_allocator< struct string_pair_map >* string_pair_map_allocator
static
Allocator used to hold string pair map entries for line map streaming.   

Referenced by canon_relative_file_name(), canon_relative_path_prefix(), and lto_free_file_name_hash().

◆ string_slot_allocator

struct object_allocator< struct string_slot >* string_slot_allocator
static
Allocator used to hold string slot entries for line map streaming.   

Referenced by canon_file_name(), lto_free_file_name_hash(), and lto_reader_init().