GCC Middle and Back End API Reference
alloc-pool.h
Go to the documentation of this file.
1 /* Functions to support a pool of allocatable objects
2  Copyright (C) 1997-2013 Free Software Foundation, Inc.
3  Contributed by Daniel Berlin <dan@cgsoftware.com>
4 
5 This file is part of GCC.
6 
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
11 
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
20 #ifndef ALLOC_POOL_H
21 #define ALLOC_POOL_H
22 
23 typedef unsigned long ALLOC_POOL_ID_TYPE;
24 
25 typedef struct alloc_pool_list_def
26 {
28 }
30 
31 typedef struct alloc_pool_def
32 {
33  const char *name;
34 #ifdef ENABLE_CHECKING
36 #endif
38 
39  /* These are the elements that have been allocated at least once and freed. */
41 
42  /* These are the elements that have not yet been allocated out of
43  the last block obtained from XNEWVEC. */
45 
46  /* The number of elements in the virgin_free_list that can be
47  allocated before needing another block. */
49 
51  size_t elts_free;
54  size_t block_size;
55  size_t elt_size;
56 }
57  *alloc_pool;
58 
59 extern alloc_pool create_alloc_pool (const char *, size_t, size_t);
60 extern void free_alloc_pool (alloc_pool);
61 extern void empty_alloc_pool (alloc_pool);
62 extern void free_alloc_pool_if_empty (alloc_pool *);
63 extern void *pool_alloc (alloc_pool) ATTRIBUTE_MALLOC;
64 extern void pool_free (alloc_pool, void *);
65 extern void dump_alloc_pool_statistics (void);
66 #endif