GCC Middle and Back End API Reference
lto-section-in.c File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "gimple.h"
#include "expr.h"
#include "flags.h"
#include "params.h"
#include "input.h"
#include "hashtab.h"
#include "basic-block.h"
#include "function.h"
#include "ggc.h"
#include "diagnostic-core.h"
#include "except.h"
#include "vec.h"
#include "timevar.h"
#include "lto-streamer.h"
#include "lto-compress.h"
Include dependency graph for lto-section-in.c:

Data Structures

struct  lto_buffer
struct  lto_data_header

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_free_function_in_decl_state ()
void lto_free_function_in_decl_state_for_node ()
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.

static hashval_t hash_name ( )
static

References CONST_CAST.

static void lto_append_data ( )
static

Compression callback, append LENGTH bytes from DATA to the buffer pointed to by OPAQUE.

htab_t lto_create_renaming_table ( void  )

Create an empty hash table for recording declaration renamings.

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.

Referenced by ipa_profile_read_summary().

void lto_delete_in_decl_state ( )

Delete STATE and its components.

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.

Referenced by ipa_profile_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 ggc_free(), LTO_N_DECL_STREAMS, lto_in_decl_state::streams, and lto_tree_ref_table::trees.

void lto_free_function_in_decl_state ( )

Free decl_states.

void lto_free_function_in_decl_state_for_node ( )

Free decl_states associated with NODE. This makes it possible to furhter release trees needed by the NODE's body.

References fatal_error().

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.

FIXME lto: WPA mode does not write compressed sections, so for now suppress uncompression mapping if flag_ltrans.

 The underlying data address has been extracted from the mapping header.
 Free that, then free the allocated uncompression buffer.   

References free_section_f.

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.

struct lto_file_decl_data** lto_get_file_decl_data ( void  )
read

Return an array of file decl datas for all of the files passed to this compilation.

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

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.

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.

FIXME lto: WPA mode does not write compressed sections, so for now suppress uncompression if flag_ltrans.

 Create a mapping header containing the underlying data and length,
 and prepend this to the uncompression buffer.  The uncompressed data
 then follows, and a pointer to the start of the uncompressed data is
 returned.   
hashval_t lto_hash_in_decl_state ( )

Hashtable helpers. lto_in_decl_states are hash by their function decls.

struct lto_in_decl_state* lto_new_in_decl_state ( void  )
read
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_file_decl_data::renaming_hash_table.

void lto_section_overrun ( )

Report read pass end of the section.

Referenced by streamer_write_char_stream().

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.

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.

Referenced by bp_pack_int_in_range(), and streamer_write_hwi_in_range().

static void renaming_slot_free ( )
static

Free a renaming table entry.

References NULL, and lto_file_decl_data::renaming_hash_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.

lto_free_section_data_f* free_section_f
static

Referenced by lto_free_section_data().

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"
}

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.