GCC Middle and Back End API Reference
lto-section-in.c File Reference

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 ()
static void lto_append_data ()
const char * lto_get_section_data (struct lto_file_decl_data *file_data, enum lto_section_type section_type, const char *name, 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)
struct 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, struct lto_input_block *ib, const char *data, size_t len)
static hashval_t hash_name ()
static int eq_name ()
static void renaming_slot_free ()
htab_t lto_create_renaming_table ()
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 lto_delete_in_decl_state ()
hashval_t lto_hash_in_decl_state ()
int lto_eq_in_decl_state ()
struct lto_in_decl_statelto_get_function_in_decl_state (struct lto_file_decl_data *file_data, tree func)
void lto_section_overrun ()
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

static int eq_name ( )
static
Returns nonzero if P1 and P2 are equal.   

References lto_renaming_slot::new_name.

Referenced by lto_create_renaming_table().

static hashval_t hash_name ( )
static
Returns a hash code for P.   

References lto_renaming_slot::new_name.

Referenced by lto_create_renaming_table().

static void lto_append_data ( )
static
Compression callback, append LENGTH bytes from DATA to the buffer pointed
   to by OPAQUE.   

References buffer, lto_buffer::data, lto_buffer::length, and memcpy().

Referenced by lto_get_section_data().

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

struct 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 
)
read
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_get_section_data(), and lto_simple_header::main_size.

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

void lto_delete_in_decl_state ( )
Delete STATE and its components.  

References ggc_free(), LTO_N_DECL_STREAMS, lto_in_decl_state::streams, and lto_tree_ref_table::trees.

void lto_destroy_simple_input_block ( struct lto_file_decl_data file_data,
enum lto_section_type  section_type,
struct 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 free(), and lto_free_section_data().

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

int lto_eq_in_decl_state ( )
Return true if the fn_decl field of the lto_in_decl_state pointed to by
   P1 equals to the function decl P2.  

References lto_in_decl_state::fn_decl.

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 
)
Free the data found from the above call.  The first three
   parameters are the same as above.  DATA is the data to be freed and
   LEN is the length of that data.   

References lto_data_header::data, free(), free_section_f, and lto_data_header::len.

Referenced by cgraph_get_body(), copy_function(), inline_read_section(), input_cgraph_opt_section(), ipa_prop_read_section(), lto_destroy_simple_input_block(), lto_input_toplevel_asms(), and read_replacements_section().

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, lto_renaming_slot::old_name, and lto_file_decl_data::renaming_hash_table.

Referenced by cgraph_get_body(), and copy_function().

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

References lto_in_decl_state::fn_decl, and lto_file_decl_data::function_decl_states.

Referenced by copy_function(), and lto_read_body().

const char* lto_get_section_data ( struct lto_file_decl_data file_data,
enum lto_section_type  section_type,
const char *  name,
size_t *  len 
)
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, get_section_f, lto_data_header::len, len, lto_buffer::length, lto_append_data(), lto_end_uncompression(), lto_start_uncompression(), lto_stats, lto_uncompress_block(), and lto_stats_d::section_size.

Referenced by cgraph_get_body(), copy_function(), inline_read_summary(), input_cgraph_opt_summary(), ipa_prop_read_all_agg_replacement(), ipa_prop_read_jump_functions(), lto_create_simple_input_block(), and lto_input_toplevel_asms().

hashval_t lto_hash_in_decl_state ( )
Hashtable helpers. lto_in_decl_states are hash by their function decls.  

References lto_in_decl_state::fn_decl.

struct lto_in_decl_state* lto_new_in_decl_state ( void  )
read
Input decl state object.                                                   
Return a newly created in-decl state object.  
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 lto_renaming_slot::new_name, lto_renaming_slot::old_name, and lto_file_decl_data::renaming_hash_table.

void lto_section_overrun ( )
Report read pass end of the section.   

References fatal_error(), lto_input_block::len, and lto_input_block::p.

Referenced by streamer_read_uchar(), and streamer_read_uhwi().

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 free_section_f, and get_section_f.

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

Referenced by bp_unpack_int_in_range(), and streamer_read_hwi_in_range().

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

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

Referenced by lto_create_renaming_table().


Variable Documentation

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

lto_free_section_data_f* free_section_f
static
lto_get_section_data_f* get_section_f
static
const char* lto_section_name[LTO_N_SECTION_TYPES]
Initial value:
{
"decls",
"function_body",
"statics",
"symtab",
"refs",
"asm",
"jmpfuncs",
"pureconst",
"reference",
"profile",
"symbol_nodes",
"opts",
"cgraphopt",
"inline",
"ipcp_trans"
}
@verbatim Input functions for reading LTO sections.

Copyright (C) 2009-2013 Free Software Foundation, Inc. Contributed by Kenneth Zadeck zadec.nosp@m.k@na.nosp@m.tural.nosp@m.brid.nosp@m.ge.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/.

Section names.  These must correspond to the values of
   enum lto_section_type.   

Referenced by lto_get_section_name(), and print_lto_report().