From 6d8eb96b448df0073941f48e8d0c6ded834b5da6 Mon Sep 17 00:00:00 2001
From: Andi Kleen <ak@linux.intel.com>
Date: Fri, 25 Jul 2014 13:39:05 +0000
Subject: Add an abstract incremental hash data type

Some files in gcc, like lto or tree, do large scale incremential hashing.
The current jhash implementation of this could be likely improved
by using an incremential hash that does not do a full rehashing
for every new value added.

This patch adds a new "inchash" class that abstracts the internal
state of the hash. This makes it easier to plug in new hashes
and also cleans up the code a bit.

Right now it is just implemented in the same way as the old
iterative hash in tree.c. The previous iterative hash code
from tree.c moved into a new separate file. Also I fixed up all
users to include the new header.

It should not really significantly change any hashing by itself,
it's mostly a cleanup at this point.

v2: Remove begin. Add commutative interface.
Add merge hash interface.  Add add_flag.

gcc/:

2014-07-25  Andi Kleen  <ak@linux.intel.com>

	* Makefile.in (OBJS): Add inchash.o.
	(PLUGIN_HEADERS): Add inchash.h.
	* ipa-devirt.c: Include inchash.h.
	* lto-streamer-out.c: Dito.
	* tree-ssa-dom.c: Dito.
	* tree-ssa-pre.c: Dito.
	* tree-ssa-sccvn.c: Dito.
	* tree-ssa-tail-merge.c: Dito.
	* asan.c: Dito.
	* tree.c (iterative_hash_hashval_t): Move to ...
	(iterative_hash_host_wide_int): Move to ...
	* inchash.c: Here. New file.
	* tree.h (iterative_hash_hashval_t): Move to ...
	(iterative_hash_host_wide_int): Move to ...
	* inchash.h: Here. New file.

gcc/lto/:

2014-07-25  Andi Kleen  <ak@linux.intel.com>

	* lto.c: Include inchash.h

From-SVN: r213054
---
 gcc/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'gcc/Makefile.in')

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 187e6b6..4c578b3 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1268,6 +1268,7 @@ OBJS = \
 	hwint.o \
 	ifcvt.o \
 	ree.o \
+	inchash.o \
 	incpath.o \
 	init-regs.o \
 	internal-fn.o \
@@ -3162,7 +3163,7 @@ PLUGIN_HEADERS = $(TREE_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
   tree-parloops.h tree-ssa-address.h tree-ssa-coalesce.h tree-ssa-dom.h \
   tree-ssa-loop.h tree-ssa-loop-ivopts.h tree-ssa-loop-manip.h \
   tree-ssa-loop-niter.h tree-ssa-ter.h tree-ssa-threadedge.h \
-  tree-ssa-threadupdate.h
+  tree-ssa-threadupdate.h inchash.h
 
 # generate the 'build fragment' b-header-vars
 s-header-vars: Makefile
-- 
cgit v1.1