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

Functions

static void lto_append_data ()
void lto_begin_section ()
void lto_end_section ()
void lto_write_stream ()
void lto_append_block ()
void lto_output_data_stream (struct lto_output_stream *obs, const void *data, size_t len)
bool lto_output_decl_index (struct lto_output_stream *obs, struct lto_tree_ref_encoder *encoder, tree name, unsigned int *this_index)
void lto_output_field_decl_index (struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
void lto_output_fn_decl_index (struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
void lto_output_namespace_decl_index (struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
void lto_output_var_decl_index (struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
void lto_output_type_decl_index (struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree decl)
void lto_output_type_ref_index (struct lto_out_decl_state *decl_state, struct lto_output_stream *obs, tree ref)
struct lto_simple_output_blocklto_create_simple_output_block ()
void lto_destroy_simple_output_block ()
struct lto_out_decl_statelto_new_out_decl_state ()
void lto_delete_out_decl_state ()
struct lto_out_decl_statelto_get_out_decl_state ()
void lto_push_out_decl_state ()
struct lto_out_decl_statelto_pop_out_decl_state ()
void lto_record_function_out_decl_state (tree fn_decl, struct lto_out_decl_state *state)

Variables

static vec
< lto_out_decl_state_ptr
decl_state_stack
vec< lto_out_decl_state_ptrlto_function_decl_states
static struct
lto_compression_stream
compression_stream = NULL

Function Documentation

void lto_append_block ( )
   Adds a new block to output stream OBS.  
         This is the first time the stream has been written
         into.  
         Get a new block that is twice as big as the last block
         and link it into the list.  
         The first bytes of the block are reserved as a pointer to
         the next block.  Set the chain of the full block to the
         pointer to the new block.  
     Set the place for the next char at the first position after the
     chain to the next block.  
     Null out the newly allocated block's pointer to the next block.  

Referenced by streamer_write_gcov_count().

static void lto_append_data ( )
static
   Flush compressed stream data function, sends NUM_CHARS from CHARS
   to the append lang hook, OPAQUE is currently always NULL.  
void lto_begin_section ( )
   Begin a new output section named NAME. If COMPRESS is true, zlib compress
   the section. 
     FIXME lto: for now, suppress compression if the lang_hook that appends
     data is anything other than assembler output.  The effect here is that
     we get compression of IL only in non-ltrans object files.  

Referenced by lto_output_type_ref_index(), and write_symbol().

struct lto_simple_output_block* lto_create_simple_output_block ( )
read
   Create the output block and return it.  

Referenced by remove_node_data().

void lto_delete_out_decl_state ( )
   Delete STATE and components.  
void lto_destroy_simple_output_block ( )
   Produce a simple section for one of the ipa passes.  
     Write the header which says how to decode the pieces of the
     t.  
     Put back the assembly section that was there before we started
     writing lto info.  
void lto_end_section ( void  )
   End the current output section.  

Referenced by write_symbol().

struct lto_out_decl_state* lto_get_out_decl_state ( void  )
read
   Get the currently used lto_out_decl_state structure. 

References lto_out_decl_state::streams, and lto_tree_ref_encoder::tree_hash_table.

struct lto_out_decl_state* lto_new_out_decl_state ( void  )
read
   Return a new lto_out_decl_state. 
void lto_output_data_stream ( struct lto_output_stream obs,
const void *  data,
size_t  len 
)
   Write raw DATA of length LEN to the output block OB.  
         No space left.  
         Determine how many bytes to copy in this loop.  
         Copy the data and do bookkeeping.  

Referenced by lto_output(), and streamer_string_index().

bool lto_output_decl_index ( struct lto_output_stream obs,
struct lto_tree_ref_encoder encoder,
tree  name,
unsigned int *  this_index 
)
   Lookup NAME in ENCODER.  If NAME is not found, create a new entry in
   ENCODER for NAME with the next available index of ENCODER,  then
   print the index to OBS.  True is returned if NAME was added to
   ENCODER.  The resulting index is stored in THIS_INDEX.

   If OBS is NULL, the only action is to add NAME to the encoder. 

Referenced by lto_output_field_decl_index(), lto_output_fn_decl_index(), and lto_output_namespace_decl_index().

void lto_output_field_decl_index ( struct lto_out_decl_state decl_state,
struct lto_output_stream obs,
tree  decl 
)
void lto_output_fn_decl_index ( struct lto_out_decl_state decl_state,
struct lto_output_stream obs,
tree  decl 
)
   Output a function DECL to OBS.  

References LTO_DECL_STREAM_VAR_DECL, lto_output_decl_index(), and lto_out_decl_state::streams.

void lto_output_namespace_decl_index ( struct lto_out_decl_state decl_state,
struct lto_output_stream obs,
tree  decl 
)
   Output a namespace DECL to OBS.  

References LTO_DECL_STREAM_TYPE_DECL, lto_output_decl_index(), and lto_out_decl_state::streams.

void lto_output_type_decl_index ( struct lto_out_decl_state decl_state,
struct lto_output_stream obs,
tree  decl 
)
   Output a type DECL to OBS.  
void lto_output_type_ref_index ( struct lto_out_decl_state decl_state,
struct lto_output_stream obs,
tree  ref 
)
void lto_output_var_decl_index ( struct lto_out_decl_state decl_state,
struct lto_output_stream obs,
tree  decl 
)
   Output a static or extern var DECL to OBS.  

Referenced by write_node_summary_p().

struct lto_out_decl_state* lto_pop_out_decl_state ( void  )
read
   Pop the currently used out-decl state from top of stack. 
void lto_push_out_decl_state ( )
   Push STATE to top of out decl stack. 
void lto_record_function_out_decl_state ( tree  fn_decl,
struct lto_out_decl_state state 
)
   Record STATE after it has been used in serializing the body of
   FN_DECL.  STATE should no longer be used by the caller.  The ownership
   of it is taken over from this point.  
     Strip all hash tables to save some memory. 
void lto_write_stream ( )
   Write all of the chars in OBS to the assembler.  Recycle the blocks
   in obs as this is being done.  
         If this is not the last block, it is full.  If it is the last
         block, left_in_block indicates how many chars are unoccupied in
         this block; subtract from num_chars to obtain occupancy.  
         FIXME lto: WPA mode uses an ELF function as a lang_hook to append
         output data.  This hook is not happy with the way that compression
         blocks up output differently to the way it's blocked here.  So for
         now, we don't compress WPA output.  

References lang_hooks_for_lto::append_data, lto_output_stream::left_in_block, lang_hooks::lto, lto_compress_block(), and lto_char_ptr_base::ptr.

Referenced by write_symbol().


Variable Documentation

struct lto_compression_stream* compression_stream = NULL
static
   Pointer to the current compression stream.  
vec<lto_out_decl_state_ptr> decl_state_stack
static
@verbatim 

Functions for writing 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/.

vec<lto_out_decl_state_ptr> lto_function_decl_states
   List of out decl states used by functions.  We use this to
   generate the decl directory later.