* config/xtensa/predicates.md (call expander): Update for
[official-gcc.git] / gcc / pointer-set.h
blobfc5921218721f899edeb7bb32cd3c1b79f316e99
1 /* Set operations on pointers
2 Copyright (C) 2004-2014 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef POINTER_SET_H
21 #define POINTER_SET_H
24 /* A pointer set is represented as a simple open-addressing hash
25 table. Simplifications: The hash code is based on the value of the
26 pointer, not what it points to. The number of buckets is always a
27 power of 2. Null pointers are a reserved value. Deletion is not
28 supported (yet). There is no mechanism for user control of hash
29 function, equality comparison, initial size, or resizing policy. */
31 struct pointer_set_t
33 size_t log_slots;
34 size_t n_slots; /* n_slots = 2^log_slots */
35 size_t n_elements;
36 const void **slots;
39 struct pointer_set_t *pointer_set_create (void);
40 void pointer_set_destroy (struct pointer_set_t *pset);
41 int pointer_set_contains (const struct pointer_set_t *pset, const void *p);
42 int pointer_set_insert (struct pointer_set_t *pset, const void *p);
43 void pointer_set_traverse (const struct pointer_set_t *,
44 bool (*) (const void *, void *),
45 void *);
46 bool pointer_set_lookup (const pointer_set_t *, const void *, size_t *);
49 struct pointer_map_t;
50 pointer_map_t *pointer_map_create (void);
51 void pointer_map_destroy (pointer_map_t *pmap);
53 void **pointer_map_contains (const pointer_map_t *pmap, const void *p);
54 void **pointer_map_insert (pointer_map_t *pmap, const void *p);
55 void pointer_map_traverse (const pointer_map_t *,
56 bool (*) (const void *, void **, void *), void *);
59 #endif /* POINTER_SET_H */