GCC Middle and Back End API Reference
lto-compress.cc File Reference
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "tree.h"
#include "gimple.h"
#include "cgraph.h"
#include "lto-streamer.h"
#include <zlib.h>
#include "lto-compress.h"
#include "timevar.h"
Include dependency graph for lto-compress.cc:

Data Structures

struct  lto_compression_stream
 

Functions

static void * lto_zalloc (void *opaque, unsigned items, unsigned size)
 
static void lto_zfree (void *opaque, void *address)
 
static int lto_normalized_zlib_level (void)
 
static void lto_destroy_compression_stream (struct lto_compression_stream *stream)
 
static struct lto_compression_streamlto_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)
 
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)
 
static void lto_compression_zlib (struct lto_compression_stream *stream)
 
void lto_end_compression (struct lto_compression_stream *stream)
 
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)
 
static void lto_uncompression_zlib (struct lto_compression_stream *stream)
 
void lto_end_uncompression (struct lto_compression_stream *stream, lto_compression compression)
 

Variables

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

Function Documentation

◆ lto_append_to_compression_stream()

static void lto_append_to_compression_stream ( struct lto_compression_stream * stream,
const char * base,
size_t num_chars )
static

◆ lto_compress_block()

void lto_compress_block ( struct lto_compression_stream * stream,
const char * base,
size_t num_chars )

◆ lto_compression_zlib()

◆ lto_destroy_compression_stream()

static void lto_destroy_compression_stream ( struct lto_compression_stream * stream)
static
Free the buffer and memory associated with STREAM.   

References lto_compression_stream::buffer, and free().

Referenced by lto_compression_zlib(), and lto_uncompression_zlib().

◆ lto_end_compression()

void lto_end_compression ( struct lto_compression_stream * stream)

References lto_compression_zlib().

Referenced by lto_end_section().

◆ lto_end_uncompression()

void lto_end_uncompression ( struct lto_compression_stream * stream,
lto_compression compression )

◆ lto_new_compression_stream()

static struct lto_compression_stream * lto_new_compression_stream ( void(* callback )(const char *, unsigned, void *),
void * opaque,
bool is_compression )
static
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, and lto_compression_stream::opaque.

Referenced by lto_start_compression(), and lto_start_uncompression().

◆ lto_normalized_zlib_level()

static int lto_normalized_zlib_level ( void )
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_compression_zlib().

◆ lto_start_compression()

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

References lto_compression_stream::callback, lto_new_compression_stream(), and lto_compression_stream::opaque.

Referenced by lto_begin_section().

◆ lto_start_uncompression()

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

References lto_compression_stream::callback, lto_new_compression_stream(), and lto_compression_stream::opaque.

Referenced by lto_get_section_data().

◆ lto_uncompress_block()

void lto_uncompress_block ( struct lto_compression_stream * stream,
const char * base,
size_t num_chars )

◆ lto_uncompression_zlib()

◆ lto_zalloc()

static void * lto_zalloc ( void * opaque,
unsigned items,
unsigned size )
static
For zlib, allocate SIZE count of ITEMS and return the address, OPAQUE
is unused.   

References gcc_assert.

Referenced by lto_compression_zlib(), and lto_uncompression_zlib().

◆ lto_zfree()

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

References free(), and gcc_assert.

Referenced by lto_compression_zlib(), and lto_uncompression_zlib().

Variable Documentation

◆ MIN_STREAM_ALLOCATION

const size_t MIN_STREAM_ALLOCATION = 1024
static

◆ Z_BUFFER_LENGTH

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

Referenced by lto_compression_zlib(), and lto_uncompression_zlib().