]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/alloc-pool.h
Remove trailing white spaces.
[thirdparty/gcc.git] / gcc / alloc-pool.h
CommitLineData
7f22efe1 1/* Functions to support a pool of allocatable objects
6fb5fa3c 2 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2007
76abd4c6 3 Free Software Foundation, Inc.
7f22efe1 4 Contributed by Daniel Berlin <dan@cgsoftware.com>
76abd4c6 5
7f22efe1
DB
6This file is part of GCC.
7
8GCC is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
9dcd6f09 10the Free Software Foundation; either version 3, or (at your option)
7f22efe1
DB
11any later version.
12
13GCC is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
9dcd6f09
NC
19along with GCC; see the file COPYING3. If not see
20<http://www.gnu.org/licenses/>. */
7f22efe1
DB
21#ifndef ALLOC_POOL_H
22#define ALLOC_POOL_H
23
76abd4c6
JZ
24typedef unsigned long ALLOC_POOL_ID_TYPE;
25
7f22efe1
DB
26typedef struct alloc_pool_list_def
27{
28 struct alloc_pool_list_def *next;
29}
30 *alloc_pool_list;
31
32typedef struct alloc_pool_def
33{
1e0f41c9 34 const char *name;
76abd4c6
JZ
35#ifdef ENABLE_CHECKING
36 ALLOC_POOL_ID_TYPE id;
37#endif
7f22efe1 38 size_t elts_per_block;
6fb5fa3c
DB
39
40 /* These are the elements that have been allocated at least once and freed. */
41 alloc_pool_list returned_free_list;
42
43 /* These are the elements that have not yet been allocated out of
44 the last block obtained from XNEWVEC. */
45 char* virgin_free_list;
46
47 /* The number of elements in the virgin_free_list that can be
b8698a0f 48 allocated before needing another block. */
6fb5fa3c
DB
49 size_t virgin_elts_remaining;
50
7f22efe1
DB
51 size_t elts_allocated;
52 size_t elts_free;
53 size_t blocks_allocated;
54 alloc_pool_list block_list;
55 size_t block_size;
56 size_t elt_size;
57}
58 *alloc_pool;
59
4682ae04
AJ
60extern alloc_pool create_alloc_pool (const char *, size_t, size_t);
61extern void free_alloc_pool (alloc_pool);
27fa4044 62extern void empty_alloc_pool (alloc_pool);
5a6ccafd 63extern void free_alloc_pool_if_empty (alloc_pool *);
4682ae04
AJ
64extern void *pool_alloc (alloc_pool);
65extern void pool_free (alloc_pool, void *);
1e0f41c9 66extern void dump_alloc_pool_statistics (void);
7f22efe1 67#endif