GCC Middle and Back End API Reference
lto-section-in.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "rtl.h"
#include "tree.h"
#include "gimple.h"
#include "cgraph.h"
#include "lto-streamer.h"
#include "lto-compress.h"
Include dependency graph for lto-section-in.cc:

Data Structures

struct  lto_buffer
 
struct  lto_data_header
 
struct  lto_renaming_slot
 

Functions

void lto_set_in_hooks (struct lto_file_decl_data **data, lto_get_section_data_f *get_f, lto_free_section_data_f *free_f)
 
struct lto_file_decl_data ** lto_get_file_decl_data (void)
 
static void lto_append_data (const char *data, unsigned length, void *opaque)
 
const char * lto_get_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, int order, size_t *len, bool decompress)
 
const char * lto_get_summary_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, size_t *len)
 
const char * lto_get_raw_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, int order, size_t *len)
 
void lto_free_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, const char *data, size_t len, bool decompress)
 
void lto_free_raw_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, const char *data, size_t len)
 
class lto_input_blocklto_create_simple_input_block (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char **datar, size_t *len)
 
void lto_destroy_simple_input_block (struct lto_file_decl_data *file_data, enum lto_section_type section_type, class lto_input_block *ib, const char *data, size_t len)
 
static hashval_t hash_name (const void *p)
 
static int eq_name (const void *p1, const void *p2)
 
static void renaming_slot_free (void *slot)
 
htab_t lto_create_renaming_table (void)
 
void lto_record_renamed_decl (struct lto_file_decl_data *decl_data, const char *old_name, const char *new_name)
 
const char * lto_get_decl_name_mapping (struct lto_file_decl_data *decl_data, const char *name)
 
struct lto_in_decl_statelto_new_in_decl_state (void)
 
void lto_delete_in_decl_state (struct lto_in_decl_state *state)
 
struct lto_in_decl_statelto_get_function_in_decl_state (struct lto_file_decl_data *file_data, tree func)
 
void lto_free_function_in_decl_state (struct lto_in_decl_state *state)
 
void lto_free_function_in_decl_state_for_node (symtab_node *node)
 
void lto_section_overrun (class lto_input_block *ib)
 
void lto_value_range_error (const char *purpose, HOST_WIDE_INT val, HOST_WIDE_INT min, HOST_WIDE_INT max)
 

Variables

const char * lto_section_name [LTO_N_SECTION_TYPES]
 
static struct lto_file_decl_data ** file_decl_data
 
static lto_get_section_data_fget_section_f
 
static lto_free_section_data_ffree_section_f
 

Function Documentation

◆ eq_name()

static int eq_name ( const void * p1,
const void * p2 )
static
Returns nonzero if P1 and P2 are equal.   

References lto_renaming_slot::new_name.

Referenced by lto_create_renaming_table().

◆ hash_name()

static hashval_t hash_name ( const void * p)
static
Returns a hash code for P.   

References lto_renaming_slot::new_name.

Referenced by lto_create_renaming_table().

◆ lto_append_data()

static void lto_append_data ( const char * data,
unsigned length,
void * opaque )
static
Compression callback, append LENGTH bytes from DATA to the buffer pointed
to by OPAQUE.   

References lto_buffer::data, and lto_buffer::length.

Referenced by lto_get_section_data().

◆ lto_create_renaming_table()

htab_t lto_create_renaming_table ( void )
Create an empty hash table for recording declaration renamings.   

References eq_name(), hash_name(), and renaming_slot_free().

◆ lto_create_simple_input_block()

class lto_input_block * lto_create_simple_input_block ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
const char ** datar,
size_t * len )
Load a section of type SECTION_TYPE from FILE_DATA, parse the
header and then return an input block pointing to the section.  The
raw pointer to the section is returned in DATAR and LEN.  These are
used to free the section.  Return NULL if the section is not present.   

References lto_input_block::file_data, header, lto_input_block::len, lto_get_section_data(), and NULL.

Referenced by input_offload_tables(), input_symtab(), ipa_profile_read_summary(), ipa_reference_read_optimization_summary(), and pure_const_read_summary().

◆ lto_delete_in_decl_state()

void lto_delete_in_decl_state ( struct lto_in_decl_state * state)
Delete STATE and its components.  

References ggc_free(), i, LTO_N_DECL_STREAMS, and vec_free().

◆ lto_destroy_simple_input_block()

void lto_destroy_simple_input_block ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
class lto_input_block * ib,
const char * data,
size_t len )
Close the section returned from a call to
LTO_CREATE_SIMPLE_INPUT_BLOCK.  IB is the input block returned from
that call.  The FILE_DATA and SECTION_TYPE are the same as what was
passed to that call and the DATA and LEN are what was returned from
that call.   

References lto_free_section_data(), and NULL.

Referenced by input_offload_tables(), input_symtab(), ipa_profile_read_summary(), ipa_reference_read_optimization_summary(), and pure_const_read_summary().

◆ lto_free_function_in_decl_state()

void lto_free_function_in_decl_state ( struct lto_in_decl_state * state)
Free decl_states.   

References ggc_free(), i, LTO_N_DECL_STREAMS, and vec_free().

Referenced by lto_free_function_in_decl_state_for_node().

◆ lto_free_function_in_decl_state_for_node()

◆ lto_free_raw_section_data()

void lto_free_raw_section_data ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
const char * name,
const char * data,
size_t len )
Free data allocated by lto_get_raw_section_data.   

References free_section_f, and lto_data_header::len.

Referenced by copy_function_or_variable().

◆ lto_free_section_data()

void lto_free_section_data ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
const char * name,
const char * data,
size_t len,
bool decompress )

◆ lto_get_decl_name_mapping()

const char * lto_get_decl_name_mapping ( struct lto_file_decl_data * decl_data,
const char * name )
Given a string NAME, return the string that it has been mapped to
by lto_record_renamed_decl.  If NAME was not renamed, it is
returned unchanged.  DECL_DATA holds the renaming hash table to use.   

References lto_renaming_slot::new_name, and lto_file_decl_data::renaming_hash_table.

Referenced by copy_function_or_variable(), varpool_node::get_constructor(), and cgraph_node::get_untransformed_body().

◆ lto_get_file_decl_data()

◆ lto_get_function_in_decl_state()

struct lto_in_decl_state * lto_get_function_in_decl_state ( struct lto_file_decl_data * file_data,
tree func )
Search the in-decl state of a function FUNC contained in the file
associated with FILE_DATA.  Return NULL if not found.   

References hash_table< Descriptor, Lazy, Allocator >::find_slot(), lto_in_decl_state::fn_decl, lto_file_decl_data::function_decl_states, and NULL.

Referenced by copy_function_or_variable(), varpool_node::get_constructor(), cgraph_node::get_untransformed_body(), and lto_read_body_or_constructor().

◆ lto_get_raw_section_data()

const char * lto_get_raw_section_data ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
const char * name,
int order,
size_t * len )
Get the section data without any header parsing or uncompression.   

References get_section_f, and lto_data_header::len.

Referenced by copy_function_or_variable().

◆ lto_get_section_data()

const char * lto_get_section_data ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
const char * name,
int order,
size_t * len,
bool decompress )
Return a char pointer to the start of a data stream for an LTO pass
or function.  FILE_DATA indicates where to obtain the data.
SECTION_TYPE is the type of information to be obtained.  NAME is
the name of the function and is only used when finding a function
body; otherwise it is NULL.  LEN is the size of the data
returned.   

References lto_buffer::data, lto_data_header::data, lto_section::get_compression(), get_section_f, header, lto_data_header::len, lto_buffer::length, lto_append_data(), lto_end_uncompression(), lto_file_decl_data::lto_section_header, LTO_section_lto, lto_start_uncompression(), lto_stats, lto_uncompress_block(), NULL, and lto_stats_d::section_size.

Referenced by varpool_node::get_constructor(), cgraph_node::get_untransformed_body(), lto_create_simple_input_block(), and lto_get_summary_section_data().

◆ lto_get_summary_section_data()

const char * lto_get_summary_section_data ( struct lto_file_decl_data * file_data,
enum lto_section_type section_type,
size_t * len )
Return a char pointer to the start of a data stream for an LTO pass.
FILE_DATA indicates where to obtain the data.
SECTION_TYPE is the type of information to be obtained.
LEN is the size of the data returned.   

References lto_data_header::len, lto_get_section_data(), and NULL.

Referenced by input_cgraph_opt_summary(), ipa_fn_summary_read(), ipa_odr_summary_read(), ipa_prop_read_jump_functions(), ipcp_read_transformation_summaries(), lto_input_mode_table(), lto_input_toplevel_asms(), and ipa_icf::sem_item_optimizer::read_summary().

◆ lto_new_in_decl_state()

struct lto_in_decl_state * lto_new_in_decl_state ( void )
Input decl state object.                                                   
Return a newly created in-decl state object.  

References ggc_cleared_alloc().

◆ lto_record_renamed_decl()

void lto_record_renamed_decl ( struct lto_file_decl_data * decl_data,
const char * old_name,
const char * new_name )
Record a declaration name mapping OLD_NAME -> NEW_NAME.  DECL_DATA
holds the renaming hash table to use.   

References gcc_unreachable, lto_renaming_slot::new_name, NULL, lto_renaming_slot::old_name, and lto_file_decl_data::renaming_hash_table.

◆ lto_section_overrun()

void lto_section_overrun ( class lto_input_block * ib)

◆ lto_set_in_hooks()

void lto_set_in_hooks ( struct lto_file_decl_data ** data,
lto_get_section_data_f * get_f,
lto_free_section_data_f * free_f )
This is called from the lto front end to set up the hooks that are
used by the ipa passes to get the data that they will
deserialize.   

References file_decl_data, free_section_f, and get_section_f.

◆ lto_value_range_error()

void lto_value_range_error ( const char * purpose,
HOST_WIDE_INT val,
HOST_WIDE_INT min,
HOST_WIDE_INT max )
Report out of range value.   

References fatal_error(), and input_location.

Referenced by bp_unpack_int_in_range(), and streamer_read_hwi_in_range().

◆ renaming_slot_free()

static void renaming_slot_free ( void * slot)
static
Free a renaming table entry.   

References CONST_CAST, free(), lto_renaming_slot::new_name, and lto_renaming_slot::old_name.

Referenced by lto_create_renaming_table().

Variable Documentation

◆ file_decl_data

struct lto_file_decl_data** file_decl_data
static
Hooks so that the ipa passes can call into the lto front end to get
sections.   

Referenced by lto_get_file_decl_data(), and lto_set_in_hooks().

◆ free_section_f

◆ get_section_f

◆ lto_section_name

const char* lto_section_name[LTO_N_SECTION_TYPES]
Initial value:
=
{
"decls",
"function_body",
"statics",
"symtab",
"ext_symtab",
"refs",
"asm",
"jmpfuncs",
"pureconst",
"reference",
"profile",
"symbol_nodes",
"opts",
"cgraphopt",
"inline",
"ipcp_trans",
"icf",
"offload_table",
"mode_table",
"lto",
"ipa_sra",
"odr_types",
"ipa_modref",
}
Input functions for reading LTO sections.

   Copyright (C) 2009-2024 Free Software Foundation, Inc.
   Contributed by Kenneth Zadeck <zadeck@naturalbridge.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/>.   
Section names.  These must correspond to the values of
enum lto_section_type.   

Referenced by create_output_block(), lto_get_section_name(), lto_write_tree_1(), print_lto_report(), and streamer_write_tree_header().