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

Data Structures

struct  lto_compression_stream

Functions

static void * lto_zalloc ()
static void lto_zfree ()
static int lto_normalized_zlib_level ()
static struct
lto_compression_stream
lto_new_compression_stream (void(*callback)(const char *, unsigned, void *), void *opaque, bool is_compression)
static void lto_append_to_compression_stream (struct lto_compression_stream *stream, const char *base, size_t num_chars)
static void lto_destroy_compression_stream ()
struct lto_compression_streamlto_start_compression (void(*callback)(const char *, unsigned, void *), void *opaque)
void lto_compress_block (struct lto_compression_stream *stream, const char *base, size_t num_chars)
void lto_end_compression ()
struct lto_compression_streamlto_start_uncompression (void(*callback)(const char *, unsigned, void *), void *opaque)
void lto_uncompress_block (struct lto_compression_stream *stream, const char *base, size_t num_chars)
void lto_end_uncompression ()

Variables

static const size_t Z_BUFFER_LENGTH = 4096
static const size_t MIN_STREAM_ALLOCATION = 1024

Function Documentation

static void lto_append_to_compression_stream ( struct lto_compression_stream stream,
const char *  base,
size_t  num_chars 
)
static
void lto_compress_block ( struct lto_compression_stream stream,
const char *  base,
size_t  num_chars 
)
static void lto_destroy_compression_stream ( )
static
Free the buffer and memory associated with STREAM.   

References lto_compression_stream::buffer, and free().

Referenced by lto_end_compression(), and lto_end_uncompression().

void lto_end_uncompression ( )
Finalize STREAM uncompression, and free stream allocations.

   Because of the way LTO IL streams are compressed, there may be several
   concatenated compressed segments in the accumulated data, so for this
   function we iterate decompressions until no data remains.   

References lto_compression_stream::buffer, lto_compression_stream::bytes, lto_compression_stream::callback, free(), internal_error(), lto_compression_stream::is_compression, lto_destroy_compression_stream(), lto_stats, lto_zalloc(), lto_zfree(), lto_stats_d::num_uncompressed_il_bytes, lto_compression_stream::opaque, and Z_BUFFER_LENGTH.

Referenced by lto_get_section_data().

static struct lto_compression_stream* lto_new_compression_stream ( void(*)(const char *, unsigned, void *)  callback,
void *  opaque,
bool  is_compression 
)
staticread
Create a new compression stream, with CALLBACK flush function passed
   OPAQUE token, IS_COMPRESSION indicates if compressing or uncompressing.   

References lto_compression_stream::callback, lto_compression_stream::is_compression, memset(), and lto_compression_stream::opaque.

Referenced by lto_start_compression(), and lto_start_uncompression().

static int lto_normalized_zlib_level ( )
static
Return a zlib compression level that zlib will not reject.  Normalizes
   the compression level from the command line flag, clamping non-default
   values to the appropriate end of their valid range.   

Referenced by lto_end_compression().

struct lto_compression_stream* lto_start_compression ( void(*)(const char *, unsigned, void *)  callback,
void *  opaque 
)
read
Return a new compression stream, with CALLBACK flush function passed
   OPAQUE token.   

References lto_compression_stream::callback, and lto_new_compression_stream().

Referenced by lto_begin_section().

struct lto_compression_stream* lto_start_uncompression ( void(*)(const char *, unsigned, void *)  callback,
void *  opaque 
)
read
Return a new uncompression stream, with CALLBACK flush function passed
   OPAQUE token.   

References lto_compression_stream::callback, and lto_new_compression_stream().

Referenced by lto_get_section_data().

void lto_uncompress_block ( struct lto_compression_stream stream,
const char *  base,
size_t  num_chars 
)
static void* lto_zalloc ( )
static
For zlib, allocate SIZE count of ITEMS and return the address, OPAQUE
   is unused.   

Referenced by lto_end_compression(), and lto_end_uncompression().

static void lto_zfree ( )
static
For zlib, free memory at ADDRESS, OPAQUE is unused.   

References free().

Referenced by lto_end_compression(), and lto_end_uncompression().


Variable Documentation

const size_t MIN_STREAM_ALLOCATION = 1024
static
const size_t Z_BUFFER_LENGTH = 4096
static
Overall compression constants for zlib.   

Referenced by lto_end_compression(), and lto_end_uncompression().