GCC Middle and Back End API Reference
lto-compress.c File Reference
#include "config.h"
#include "system.h"
#include <zlib.h>
#include "coretypes.h"
#include "tree.h"
#include "gimple.h"
#include "diagnostic-core.h"
#include "langhooks.h"
#include "lto-streamer.h"
#include "lto-compress.h"
Include dependency graph for lto-compress.c:

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

Append NUM_CHARS from address BASE to STREAM.

Referenced by lto_start_compression().

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::callback, and lto_new_compression_stream().

void lto_end_compression ( )

Finalize STREAM compression, and free stream allocations.

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.

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.

Referenced by lto_destroy_compression_stream().

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.

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 gcc_assert, lto_compression_stream::is_compression, lto_append_to_compression_stream(), lto_stats, and lto_stats_d::num_output_il_bytes.

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.

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.

References gcc_assert.

static void lto_zfree ( )
static

For zlib, free memory at ADDRESS, OPAQUE is unused.


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_compress_block(), and lto_uncompress_block().