remove pointer-set.[ch]

gcc/

	* Makefile.in: Remove references to pointer-set.c and pointer-set.h.
	* alias.c, cfgexpand.c, cgraphbuild.c,
	config/aarch64/aarch64-builtins.c, config/aarch64/aarch64.c,
	config/alpha/alpha.c, config/darwin.c, config/i386/i386.c,
	config/i386/winnt.c, config/ia64/ia64.c, config/m32c/m32c.c,
	config/mep/mep.c, config/mips/mips.c, config/rs6000/rs6000.c,
	config/s390/s390.c, config/sh/sh.c, config/sparc/sparc.c,
	config/spu/spu.c, config/stormy16/stormy16.c, config/tilegx/tilegx.c,
	config/tilepro/tilepro.c, config/xtensa/xtensa.c, dominance.c,
	dse.c, except.c, gengtype.c, gimple-expr.c,
	gimple-ssa-strength-reduction.c, gimplify.c, ifcvt.c,
	ipa-visibility.c, lto-streamer.h, omp-low.c, predict.c, stmt.c,
	tree-affine.c, tree-cfg.c, tree-eh.c, tree-inline.c, tree-nested.c,
	tree-scalar-evolution.c, tree-ssa-loop-im.c, tree-ssa-loop-niter.c,
	tree-ssa-phiopt.c, tree-ssa-structalias.c, tree-ssa-uninit.c,
	tree-ssa.c, tree.c, var-tracking.c, varpool.c: Remove includes of
	pointer-set.h.
	* pointer-set.c: Remove file.
	* pointer-set.h: Remove file.

gcc/c-family/

	* c-gimplify.c, cilk.c: Remove includes of pointer-set.h.

gcc/c/

	* c-typeck.c: Remove include of pointer-set.h.

gcc/cp/

	* class.c, cp-gimplify.c, decl.c, decl2.c, error.c, method.c,
	optimize.c, pt.c, semantics.c: Remove includes of pointer-set.h.

From-SVN: r213738
This commit is contained in:
Trevor Saunders 2014-08-07 20:52:50 +00:00 committed by Trevor Saunders
parent 4e48c10968
commit 9f25a338f9
75 changed files with 39 additions and 402 deletions

View File

@ -1,3 +1,25 @@
2014-08-07 Trevor Saunders <tsaunders@mozilla.com>
* Makefile.in: Remove references to pointer-set.c and pointer-set.h.
* alias.c, cfgexpand.c, cgraphbuild.c,
config/aarch64/aarch64-builtins.c, config/aarch64/aarch64.c,
config/alpha/alpha.c, config/darwin.c, config/i386/i386.c,
config/i386/winnt.c, config/ia64/ia64.c, config/m32c/m32c.c,
config/mep/mep.c, config/mips/mips.c, config/rs6000/rs6000.c,
config/s390/s390.c, config/sh/sh.c, config/sparc/sparc.c,
config/spu/spu.c, config/stormy16/stormy16.c, config/tilegx/tilegx.c,
config/tilepro/tilepro.c, config/xtensa/xtensa.c, dominance.c,
dse.c, except.c, gengtype.c, gimple-expr.c,
gimple-ssa-strength-reduction.c, gimplify.c, ifcvt.c,
ipa-visibility.c, lto-streamer.h, omp-low.c, predict.c, stmt.c,
tree-affine.c, tree-cfg.c, tree-eh.c, tree-inline.c, tree-nested.c,
tree-scalar-evolution.c, tree-ssa-loop-im.c, tree-ssa-loop-niter.c,
tree-ssa-phiopt.c, tree-ssa-structalias.c, tree-ssa-uninit.c,
tree-ssa.c, tree.c, var-tracking.c, varpool.c: Remove includes of
pointer-set.h.
* pointer-set.c: Remove file.
* pointer-set.h: Remove file.
2014-08-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/arm/arm.md (*cmov<mode>): Set type attribute to fcsel.

View File

@ -892,7 +892,7 @@ TREE_H = tree.h $(TREE_CORE_H) tree-check.h
REGSET_H = regset.h $(BITMAP_H) hard-reg-set.h
BASIC_BLOCK_H = basic-block.h $(PREDICT_H) $(VEC_H) $(FUNCTION_H) \
cfg-flags.def cfghooks.h
GIMPLE_H = gimple.h gimple.def gsstruct.def pointer-set.h $(VEC_H) \
GIMPLE_H = gimple.h gimple.def gsstruct.def $(VEC_H) \
$(GGC_H) $(BASIC_BLOCK_H) $(TREE_H) tree-ssa-operands.h \
tree-ssa-alias.h $(INTERNAL_FN_H) $(HASH_TABLE_H) is-a.h
GCOV_IO_H = gcov-io.h gcov-iov.h auto-host.h gcov-counter.def
@ -950,7 +950,7 @@ TREE_INLINE_H = tree-inline.h
REAL_H = real.h $(MACHMODE_H)
LTO_STREAMER_H = lto-streamer.h $(LINKER_PLUGIN_API_H) $(TARGET_H) \
$(CGRAPH_H) $(VEC_H) $(HASH_TABLE_H) $(TREE_H) $(GIMPLE_H) \
$(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h pointer-set.h
$(GCOV_IO_H) $(DIAGNOSTIC_H) alloc-pool.h
IPA_PROP_H = ipa-prop.h $(TREE_H) $(VEC_H) $(CGRAPH_H) $(GIMPLE_H) alloc-pool.h
BITMAP_H = bitmap.h $(HASHTAB_H) statistics.h
GCC_PLUGIN_H = gcc-plugin.h highlev-plugin-common.h plugin.def \
@ -1329,7 +1329,6 @@ OBJS = \
opts-global.o \
passes.o \
plugin.o \
pointer-set.o \
postreload-gcse.o \
postreload.o \
predict.o \
@ -3140,7 +3139,7 @@ installdirs:
$(mkinstalldirs) $(DESTDIR)$(man7dir)
PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) pointer-set.h $(HASH_TABLE_H) \
toplev.h $(DIAGNOSTIC_CORE_H) $(BASIC_BLOCK_H) $(HASH_TABLE_H) \
tree-ssa-alias.h $(INTERNAL_FN_H) gimple-fold.h tree-eh.h gimple-expr.h \
gimple.h is-a.h $(TREE_PASS_H) $(GCC_PLUGIN_H) \
$(GGC_H) $(TREE_DUMP_H) $(PRETTY_PRINT_H) $(OPTS_H) $(PARAMS_H) \

View File

@ -42,7 +42,6 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "df.h"
#include "tree-ssa-alias.h"
#include "pointer-set.h"
#include "internal-fn.h"
#include "gimple-expr.h"
#include "is-a.h"

View File

@ -1,3 +1,7 @@
2014-08-07 Trevor Saunders <tsaunders@mozilla.com>
* c-gimplify.c, cilk.c: Remove includes of pointer-set.h.
2014-08-03 Marek Polacek <polacek@redhat.com>
* c-common.c (check_case_value): Add location_t parameter. Use it.

View File

@ -46,7 +46,6 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "cilk.h"
#include "c-ubsan.h"
#include "pointer-set.h"
/* The gimplification pass converts the language-dependent trees
(ld-trees) emitted by the parser into language-independent trees

View File

@ -27,7 +27,6 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "calls.h"
#include "langhooks.h"
#include "pointer-set.h"
#include "gimple-expr.h"
#include "gimplify.h"
#include "tree-iterator.h"

View File

@ -1,3 +1,7 @@
2014-08-07 Trevor Saunders <tsaunders@mozilla.com>
* c-typeck.c: Remove include of pointer-set.h.
2014-08-07 Marek Polacek <polacek@redhat.com>
* c-typeck.c (pointer_diff): Remove P - (P + CST) optimization.

View File

@ -40,7 +40,6 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "tree-iterator.h"
#include "bitmap.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "gimple-expr.h"
#include "gimplify.h"

View File

@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "bitmap.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "tree-eh.h"

View File

@ -23,7 +23,6 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -33,7 +33,6 @@
#include "langhooks.h"
#include "diagnostic-core.h"
#include "optabs.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -46,7 +46,6 @@
#include "recog.h"
#include "langhooks.h"
#include "diagnostic-core.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -51,7 +51,6 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "langhooks.h"
#include "splay-tree.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -48,7 +48,6 @@ along with GCC; see the file COPYING3. If not see
#include "df.h"
#include "debug.h"
#include "obstack.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -52,7 +52,6 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "reload.h"
#include "cgraph.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -37,7 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "ggc.h"
#include "target.h"
#include "except.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -53,7 +53,6 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "hash-table.h"
#include "langhooks.h"
#include "pointer-set.h"
#include "vec.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"

View File

@ -48,7 +48,6 @@
#include "target-def.h"
#include "tm_p.h"
#include "langhooks.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -51,7 +51,6 @@ along with GCC; see the file COPYING3. If not see
#include "target-def.h"
#include "langhooks.h"
#include "df.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -54,7 +54,6 @@ along with GCC; see the file COPYING3. If not see
#include "common/common-target.h"
#include "langhooks.h"
#include "sched-int.h"
#include "pointer-set.h"
#include "vec.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"

View File

@ -56,7 +56,6 @@
#include "reload.h"
#include "cfgloop.h"
#include "sched-int.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -52,7 +52,6 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "langhooks.h"
#include "optabs.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -56,7 +56,6 @@ along with GCC; see the file COPYING3. If not see
#include "sched-int.h"
#include "params.h"
#include "ggc.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -50,7 +50,6 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "target-def.h"
#include "common/common-target.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "basic-block.h"

View File

@ -49,7 +49,6 @@
#include "sched-int.h"
#include "params.h"
#include "machmode.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -47,7 +47,6 @@
#include "target-def.h"
#include "tm_p.h"
#include "langhooks.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -40,7 +40,6 @@
#include "dwarf2.h"
#include "timevar.h"
#include "tree.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -41,7 +41,6 @@
#include "dwarf2.h"
#include "timevar.h"
#include "tree.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -50,7 +50,6 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
#include "target-def.h"
#include "langhooks.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -1,3 +1,8 @@
2014-08-07 Trevor Saunders <tsaunders@mozilla.com>
* class.c, cp-gimplify.c, decl.c, decl2.c, error.c, method.c,
optimize.c, pt.c, semantics.c: Remove includes of pointer-set.h.
2014-08-07 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51312

View File

@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "stor-layout.h"
#include "attribs.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "cp-tree.h"
#include "flags.h"

View File

@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see
#include "cp-tree.h"
#include "c-family/c-common.h"
#include "tree-iterator.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -55,7 +55,6 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "debug.h"
#include "timevar.h"
#include "pointer-set.h"
#include "splay-tree.h"
#include "plugin.h"
#include "cgraph.h"

View File

@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "stor-layout.h"
#include "calls.h"
#include "pointer-set.h"
#include "flags.h"
#include "cp-tree.h"
#include "decl.h"

View File

@ -31,7 +31,6 @@ along with GCC; see the file COPYING3. If not see
#include "intl.h"
#include "cxx-pretty-print.h"
#include "tree-pretty-print.h"
#include "pointer-set.h"
#include "c-family/c-objc.h"
#include "ubsan.h"

View File

@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "common/common-target.h"
#include "diagnostic.h"
#include "cgraph.h"
#include "pointer-set.h"
/* Various flags to control the mangling process. */

View File

@ -35,7 +35,6 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks.h"
#include "diagnostic-core.h"
#include "dumpfile.h"
#include "pointer-set.h"
#include "tree-iterator.h"
#include "cgraph.h"

View File

@ -34,7 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "stor-layout.h"
#include "intl.h"
#include "pointer-set.h"
#include "flags.h"
#include "cp-tree.h"
#include "c-family/c-common.h"

View File

@ -44,7 +44,6 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "tree-iterator.h"
#include "target.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "gimplify.h"
#include "bitmap.h"

View File

@ -44,7 +44,6 @@
#include "et-forest.h"
#include "timevar.h"
#include "hash-map.h"
#include "pointer-set.h"
#include "graphds.h"
#include "bitmap.h"

View File

@ -47,7 +47,6 @@ along with GCC; see the file COPYING3. If not see
#include "dbgcnt.h"
#include "target.h"
#include "params.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"

View File

@ -139,7 +139,6 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h"
#include "tree-pretty-print.h"
#include "tree-pass.h"
#include "pointer-set.h"
#include "cfgloop.h"
#include "builtins.h"

View File

@ -1825,7 +1825,7 @@ open_base_files (void)
"tree.h", "rtl.h", "wide-int.h", "function.h", "insn-config.h", "expr.h",
"hard-reg-set.h", "basic-block.h", "cselib.h", "insn-addr.h",
"optabs.h", "libfuncs.h", "debug.h", "ggc.h", "cgraph.h",
"pointer-set.h", "hash-table.h", "vec.h", "ggc.h", "basic-block.h",
"hash-table.h", "vec.h", "ggc.h", "basic-block.h",
"tree-ssa-alias.h", "internal-fn.h", "gimple-fold.h", "tree-eh.h",
"gimple-expr.h", "is-a.h",
"gimple.h", "gimple-iterator.h", "gimple-ssa.h", "tree-cfg.h",

View File

@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -37,7 +37,6 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "tree.h"
#include "pointer-set.h"
#include "hash-map.h"
#include "hash-table.h"
#include "basic-block.h"

View File

@ -26,7 +26,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "expr.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"

View File

@ -41,7 +41,6 @@
#include "tree-pass.h"
#include "df.h"
#include "vec.h"
#include "pointer-set.h"
#include "dbgcnt.h"
#ifndef HAVE_conditional_move

View File

@ -79,7 +79,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "cgraph.h"
#include "tree-pass.h"
#include "pointer-set.h"
#include "calls.h"
#include "gimple-expr.h"
#include "varasm.h"

View File

@ -32,7 +32,6 @@ along with GCC; see the file COPYING3. If not see
#include "alloc-pool.h"
#include "gcov-io.h"
#include "diagnostic.h"
#include "pointer-set.h"
/* Define when debugging the LTO streamer. This causes the writer
to output the numeric value for the memory address of the tree node

View File

@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "stringpool.h"
#include "stor-layout.h"
#include "rtl.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -1,271 +0,0 @@
/* Set operations on pointers
Copyright (C) 2004-2014 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "pointer-set.h"
/* Use the multiplicative method, as described in Knuth 6.4, to obtain
a hash code for P in the range [0, MAX). MAX == 2^LOGMAX.
Summary of this method: Multiply p by some number A that's
relatively prime to 2^sizeof(size_t). The result is two words.
Discard the most significant word, and return the most significant
N bits of the least significant word. As suggested by Knuth, our
choice for A is the integer part of (ULONG_MAX + 1.0) / phi, where phi
is the golden ratio.
We don't need to do anything special for full-width multiplication
because we're only interested in the least significant word of the
product, and unsigned arithmetic in C is modulo the word size. */
static inline size_t
hash1 (const void *p, unsigned long max, unsigned long logmax)
{
#if HOST_BITS_PER_LONG == 32
const unsigned long A = 0x9e3779b9u;
#elif HOST_BITS_PER_LONG == 64
const unsigned long A = 0x9e3779b97f4a7c16ul;
#else
const unsigned long A
= (ULONG_MAX + 1.0L) * 0.6180339887498948482045868343656381177203L;
#endif
const unsigned long shift = HOST_BITS_PER_LONG - logmax;
return ((A * (uintptr_t) p) >> shift) & (max - 1);
}
/* Allocate an empty pointer set. */
struct pointer_set_t *
pointer_set_create (void)
{
struct pointer_set_t *result = XNEW (struct pointer_set_t);
result->n_elements = 0;
result->log_slots = 8;
result->n_slots = (size_t) 1 << result->log_slots;
result->slots = XCNEWVEC (const void *, result->n_slots);
return result;
}
/* Reclaims all memory associated with PSET. */
void
pointer_set_destroy (struct pointer_set_t *pset)
{
XDELETEVEC (pset->slots);
XDELETE (pset);
}
/* Lookup the slot for the pointer P and return true if it exists,
otherwise return false in which case *IX points to the slot that
would be used on insertion. */
bool
pointer_set_lookup (const pointer_set_t *pset, const void *p, size_t *ix)
{
size_t n = hash1 (p, pset->n_slots, pset->log_slots);
while (true)
{
if (pset->slots[n] == p)
{
*ix = n;
return true;
}
else if (pset->slots[n] == 0)
{
*ix = n;
return false;
}
else
{
++n;
if (n == pset->n_slots)
n = 0;
}
}
}
/* Returns nonzero if PSET contains P. P must be nonnull.
Collisions are resolved by linear probing. */
int
pointer_set_contains (const struct pointer_set_t *pset, const void *p)
{
size_t n;
return pointer_set_lookup (pset, p, &n);
}
/* Inserts P into PSET if it wasn't already there. Returns nonzero
if it was already there. P must be nonnull. */
int
pointer_set_insert (struct pointer_set_t *pset, const void *p)
{
size_t n;
/* For simplicity, expand the set even if P is already there. This can be
superfluous but can happen at most once. */
if (pset->n_elements > pset->n_slots / 4)
{
size_t old_n_slots = pset->n_slots;
const void **old_slots = pset->slots;
pset->log_slots = pset->log_slots + 1;
pset->n_slots = pset->n_slots * 2;
pset->slots = XCNEWVEC (const void *, pset->n_slots);
size_t i;
for (i = 0; i < old_n_slots; ++i)
{
const void *value = old_slots[i];
pointer_set_lookup (pset, value, &n);
pset->slots[n] = value;
}
XDELETEVEC (old_slots);
}
if (pointer_set_lookup (pset, p, &n))
return 1;
pset->slots[n] = p;
++pset->n_elements;
return 0;
}
/* Pass each pointer in PSET to the function in FN, together with the fixed
parameter DATA. If FN returns false, the iteration stops. */
void pointer_set_traverse (const struct pointer_set_t *pset,
bool (*fn) (const void *, void *), void *data)
{
size_t i;
for (i = 0; i < pset->n_slots; ++i)
if (pset->slots[i] && !fn (pset->slots[i], data))
break;
}
/* A pointer map is represented the same way as a pointer_set, so
the hash code is based on the address of the key, rather than
its contents. Null keys are a reserved value. Deletion is not
supported (yet). There is no mechanism for user control of hash
function, equality comparison, initial size, or resizing policy. */
struct pointer_map_t
{
pointer_set_t pset;
void **values;
};
/* Allocate an empty pointer map. */
struct pointer_map_t *
pointer_map_create (void)
{
struct pointer_map_t *result = XNEW (struct pointer_map_t);
result->pset.n_elements = 0;
result->pset.log_slots = 8;
result->pset.n_slots = (size_t) 1 << result->pset.log_slots;
result->pset.slots = XCNEWVEC (const void *, result->pset.n_slots);
result->values = XCNEWVEC (void *, result->pset.n_slots);
return result;
}
/* Reclaims all memory associated with PMAP. */
void pointer_map_destroy (struct pointer_map_t *pmap)
{
XDELETEVEC (pmap->pset.slots);
XDELETEVEC (pmap->values);
XDELETE (pmap);
}
/* Returns a pointer to the value to which P maps, if PMAP contains P. P
must be nonnull. Return NULL if PMAP does not contain P.
Collisions are resolved by linear probing. */
void **
pointer_map_contains (const struct pointer_map_t *pmap, const void *p)
{
size_t n;
if (pointer_set_lookup (&pmap->pset, p, &n))
return &pmap->values[n];
else
return NULL;
}
/* Inserts P into PMAP if it wasn't already there. Returns a pointer
to the value. P must be nonnull. */
void **
pointer_map_insert (struct pointer_map_t *pmap, const void *p)
{
size_t n;
/* For simplicity, expand the map even if P is already there. This can be
superfluous but can happen at most once. */
if (pmap->pset.n_elements > pmap->pset.n_slots / 4)
{
size_t old_n_slots = pmap->pset.n_slots;
const void **old_keys = pmap->pset.slots;
void **old_values = pmap->values;
pmap->pset.log_slots = pmap->pset.log_slots + 1;
pmap->pset.n_slots = pmap->pset.n_slots * 2;
pmap->pset.slots = XCNEWVEC (const void *, pmap->pset.n_slots);
pmap->values = XCNEWVEC (void *, pmap->pset.n_slots);
size_t i;
for (i = 0; i < old_n_slots; ++i)
if (old_keys[i])
{
const void *key = old_keys[i];
pointer_set_lookup (&pmap->pset, key, &n);
pmap->pset.slots[n] = key;
pmap->values[n] = old_values[i];
}
XDELETEVEC (old_keys);
XDELETEVEC (old_values);
}
if (!pointer_set_lookup (&pmap->pset, p, &n))
{
++pmap->pset.n_elements;
pmap->pset.slots[n] = p;
}
return &pmap->values[n];
}
/* Pass each pointer in PMAP to the function in FN, together with the pointer
to the value and the fixed parameter DATA. If FN returns false, the
iteration stops. */
void pointer_map_traverse (const struct pointer_map_t *pmap,
bool (*fn) (const void *, void **, void *), void *data)
{
size_t i;
for (i = 0; i < pmap->pset.n_slots; ++i)
if (pmap->pset.slots[i]
&& !fn (pmap->pset.slots[i], &pmap->values[i], data))
break;
}

View File

@ -1,59 +0,0 @@
/* Set operations on pointers
Copyright (C) 2004-2014 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#ifndef POINTER_SET_H
#define POINTER_SET_H
/* A pointer set is represented as a simple open-addressing hash
table. Simplifications: The hash code is based on the value of the
pointer, not what it points to. The number of buckets is always a
power of 2. Null pointers are a reserved value. Deletion is not
supported (yet). There is no mechanism for user control of hash
function, equality comparison, initial size, or resizing policy. */
struct pointer_set_t
{
size_t log_slots;
size_t n_slots; /* n_slots = 2^log_slots */
size_t n_elements;
const void **slots;
};
struct pointer_set_t *pointer_set_create (void);
void pointer_set_destroy (struct pointer_set_t *pset);
int pointer_set_contains (const struct pointer_set_t *pset, const void *p);
int pointer_set_insert (struct pointer_set_t *pset, const void *p);
void pointer_set_traverse (const struct pointer_set_t *,
bool (*) (const void *, void *),
void *);
bool pointer_set_lookup (const pointer_set_t *, const void *, size_t *);
struct pointer_map_t;
pointer_map_t *pointer_map_create (void);
void pointer_map_destroy (pointer_map_t *pmap);
void **pointer_map_contains (const pointer_map_t *pmap, const void *p);
void **pointer_map_insert (pointer_map_t *pmap, const void *p);
void pointer_map_traverse (const pointer_map_t *,
bool (*) (const void *, void **, void *), void *);
#endif /* POINTER_SET_H */

View File

@ -51,7 +51,6 @@ along with GCC; see the file COPYING3. If not see
#include "params.h"
#include "target.h"
#include "cfgloop.h"
#include "pointer-set.h"
#include "hash-map.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -48,7 +48,6 @@ along with GCC; see the file COPYING3. If not see
#include "optabs.h"
#include "target.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -11,7 +11,6 @@
#include "stringpool.h"
#include "toplev.h"
#include "basic-block.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -9,7 +9,6 @@
#include "tree.h"
#include "toplev.h"
#include "basic-block.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -8,7 +8,6 @@
#include "tree.h"
#include "toplev.h"
#include "basic-block.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -6,7 +6,6 @@
#include "tree.h"
#include "tm.h"
#include "toplev.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -11,7 +11,6 @@
#include "stringpool.h"
#include "toplev.h"
#include "basic-block.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -14,7 +14,6 @@
#include "stringpool.h"
#include "toplev.h"
#include "basic-block.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "vec.h"
#include "ggc.h"

View File

@ -23,7 +23,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "expr.h"
#include "tree-pretty-print.h"
#include "pointer-set.h"
#include "tree-affine.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"

View File

@ -33,7 +33,6 @@ along with GCC; see the file COPYING3. If not see
#include "flags.h"
#include "function.h"
#include "gimple-pretty-print.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-fold.h"

View File

@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "function.h"
#include "except.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -36,7 +36,6 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "tree-iterator.h"
#include "intl.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-fold.h"

View File

@ -28,7 +28,6 @@
#include "function.h"
#include "tree-dump.h"
#include "tree-inline.h"
#include "pointer-set.h"
#include "basic-block.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -280,7 +280,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-ssa.h"
#include "cfgloop.h"
#include "tree-chrec.h"
#include "pointer-set.h"
#include "tree-affine.h"
#include "tree-scalar-evolution.h"
#include "dumpfile.h"

View File

@ -25,7 +25,6 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "gimple-pretty-print.h"
#include "pointer-set.h"
#include "hash-map.h"
#include "hash-table.h"
#include "tree-ssa-alias.h"

View File

@ -29,7 +29,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "intl.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"

View File

@ -28,7 +28,6 @@ along with GCC; see the file COPYING3. If not see
#include "tm_p.h"
#include "basic-block.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"

View File

@ -30,7 +30,6 @@
#include "tree.h"
#include "stor-layout.h"
#include "stmt.h"
#include "pointer-set.h"
#include "hash-table.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"

View File

@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. If not see
#include "gimple-pretty-print.h"
#include "bitmap.h"
#include "hash-set.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"

View File

@ -30,7 +30,6 @@ along with GCC; see the file COPYING3. If not see
#include "basic-block.h"
#include "function.h"
#include "gimple-pretty-print.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-fold.h"

View File

@ -52,7 +52,6 @@ along with GCC; see the file COPYING3. If not see
#include "tree-iterator.h"
#include "basic-block.h"
#include "bitmap.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "internal-fn.h"
#include "gimple-expr.h"

View File

@ -93,7 +93,6 @@
#include "tree.h"
#include "varasm.h"
#include "stor-layout.h"
#include "pointer-set.h"
#include "hash-map.h"
#include "hash-table.h"
#include "basic-block.h"

View File

@ -34,7 +34,6 @@ along with GCC; see the file COPYING3. If not see
#include "output.h"
#include "gimple-expr.h"
#include "flags.h"
#include "pointer-set.h"
#include "tree-ssa-alias.h"
#include "gimple.h"
#include "lto-streamer.h"