GCC Middle and Back End API Reference
alloc-pool.c File Reference

Data Structures

struct  allocation_object_def
struct  alloc_pool_descriptor
struct  alloc_pool_hasher
struct  output_info

Typedefs

typedef struct
allocation_object_def 
allocation_object

Functions

static struct
alloc_pool_descriptor
allocate_pool_descriptor ()
alloc_pool create_alloc_pool ()
void empty_alloc_pool ()
void free_alloc_pool ()
void free_alloc_pool_if_empty ()
void * pool_alloc ()
void pool_free ()
int print_alloc_pool_statistics (alloc_pool_descriptor **slot, struct output_info *i)
void dump_alloc_pool_statistics ()

Variables

static ALLOC_POOL_ID_TYPE last_id
static hash_table
< alloc_pool_hasher
alloc_pool_hash

Typedef Documentation

   The internal allocation object.  

Function Documentation

static struct alloc_pool_descriptor* allocate_pool_descriptor ( )
staticread
   For given name, return descriptor, create new if needed.  

References allocation_object_def::data.

Referenced by free_alloc_pool().

alloc_pool create_alloc_pool ( )
   Create a pool of things of size SIZE, with NUM in each block we
   allocate.  
     Make size large enough to store the list header.  
     Now align the size to a multiple of 4.  
     Add the aligned size of ID.  
     Um, we can't really allocate 0 elements per block.  
     Allocate memory for the pool structure.  
     Now init the various pieces of our pool structure.  
     List header size should be a multiple of 8.  
     Increase the last used ID and use it for this pool.
     ID == 0 is used for free elements of pool so skip it.  

Referenced by copy_reference(), emit_notes_for_changes(), ira_free_allocno_updated_costs(), and print_allocno_prefs().

void dump_alloc_pool_statistics ( void  )
   Output per-alloc_pool memory usage statistics.  
void empty_alloc_pool ( )
   Free all memory allocated for the given memory pool.  
     Free each block allocated to the pool.  

References free(), and memset().

void free_alloc_pool ( )
   Free all memory allocated for the given memory pool and the pool itself.  
     First empty the pool.  
     Lastly, free the pool.  

References allocate_pool_descriptor(), alloc_pool_descriptor::allocated, alloc_pool_descriptor::current, alloc_pool_def::elt_size, alloc_pool_def::name, and alloc_pool_descriptor::peak.

Referenced by debug(), fp_setter_insn(), ira_finish_live_range_list(), lra_set_used_insn_alternative_by_uid(), and process_scc().

void free_alloc_pool_if_empty ( )
   Frees the alloc_pool, if it is empty and zero *POOL in this case.  

References alloc_pool_def::block_size, and alloc_pool_def::virgin_elts_remaining.

Referenced by et_free_tree().

void* pool_alloc ( )
   Allocates one element from the pool specified.  
     If there are no more free elements, make some more!.  
             Make the block.  
             Throw it on the block list.  
             Make the block available for allocation.  
             Also update the number of elements we have free/allocated, and
             increment the allocated block count.  
         We now know that we can take the first elt off the virgin list and
         put it on the returned list. 
         Mark the element to be free.  
     Pull the first free element from the free list, and return it.  
     Set the ID for element.  

Referenced by account_time_size(), asan_mem_ref_init(), build_access_from_expr_1(), canonicalize_values_star(), create_live_range(), dv_from_value(), free_live_range_list(), initialize_lra_reg_info_element(), insert_aux(), ipa_free_all_edge_args(), ipa_free_node_params_substructures(), ira_create_object(), lra_update_dups(), record_store(), remove_from_deps_list(), set_cond_stmt_execution_predicate(), vn_nary_op_insert_into(), and vt_find_locations().

int print_alloc_pool_statistics ( alloc_pool_descriptor **  slot,
struct output_info i 
)
   Called via hash_table.traverse.  Output alloc_pool descriptor pointed out by
   SLOT and update statistics.  

Variable Documentation

hash_table<alloc_pool_hasher> alloc_pool_hash
static
   Hashtable mapping alloc_pool names to descriptors.  
ALLOC_POOL_ID_TYPE last_id
static
   Last used ID.