Commit 11315a95 by Richard Sandiford Committed by Richard Sandiford

varasm.c: Include rtl-iter.h.

gcc/
	* varasm.c: Include rtl-iter.h.
	(const_rtx_hash_1): Take a const_rtx rather than an rtx *.
	Remove the pointer to the cumulative hashval_t and just return
	the hash for this rtx instead.  Remove recursive CONST_VECTOR case.
	(const_rtx_hash): Use FOR_EACH_SUBRTX instead of for_each_rtx.
	Accumulate the hashval_ts here instead of const_rtx_hash_1.

From-SVN: r214665
parent 3b4459f9
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com> 2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* varasm.c: Include rtl-iter.h.
(const_rtx_hash_1): Take a const_rtx rather than an rtx *.
Remove the pointer to the cumulative hashval_t and just return
the hash for this rtx instead. Remove recursive CONST_VECTOR case.
(const_rtx_hash): Use FOR_EACH_SUBRTX instead of for_each_rtx.
Accumulate the hashval_ts here instead of const_rtx_hash_1.
2014-08-28 Richard Sandiford <rdsandiford@googlemail.com>
* var-tracking.c (add_uses): Take an rtx rather than an rtx *. * var-tracking.c (add_uses): Take an rtx rather than an rtx *.
Give real type of data parameter. Remove return value. Give real type of data parameter. Remove return value.
(add_uses_1): Use FOR_EACH_SUBRTX_VAR rather than for_each_rtx (add_uses_1): Use FOR_EACH_SUBRTX_VAR rather than for_each_rtx
...@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "hash-set.h" #include "hash-set.h"
#include "asan.h" #include "asan.h"
#include "basic-block.h" #include "basic-block.h"
#include "rtl-iter.h"
#ifdef XCOFF_DEBUGGING_INFO #ifdef XCOFF_DEBUGGING_INFO
#include "xcoffout.h" /* Needed for external data #include "xcoffout.h" /* Needed for external data
...@@ -3485,19 +3486,17 @@ const_desc_rtx_eq (const void *a, const void *b) ...@@ -3485,19 +3486,17 @@ const_desc_rtx_eq (const void *a, const void *b)
return rtx_equal_p (x->constant, y->constant); return rtx_equal_p (x->constant, y->constant);
} }
/* This is the worker function for const_rtx_hash, called via for_each_rtx. */ /* Hash one component of a constant. */
static int static hashval_t
const_rtx_hash_1 (rtx *xp, void *data) const_rtx_hash_1 (const_rtx x)
{ {
unsigned HOST_WIDE_INT hwi; unsigned HOST_WIDE_INT hwi;
enum machine_mode mode; enum machine_mode mode;
enum rtx_code code; enum rtx_code code;
hashval_t h, *hp; hashval_t h;
rtx x;
int i; int i;
x = *xp;
code = GET_CODE (x); code = GET_CODE (x);
mode = GET_MODE (x); mode = GET_MODE (x);
h = (hashval_t) code * 1048573 + mode; h = (hashval_t) code * 1048573 + mode;
...@@ -3543,14 +3542,6 @@ const_rtx_hash_1 (rtx *xp, void *data) ...@@ -3543,14 +3542,6 @@ const_rtx_hash_1 (rtx *xp, void *data)
h ^= fixed_hash (CONST_FIXED_VALUE (x)); h ^= fixed_hash (CONST_FIXED_VALUE (x));
break; break;
case CONST_VECTOR:
{
int i;
for (i = XVECLEN (x, 0); i-- > 0; )
h = h * 251 + const_rtx_hash_1 (&XVECEXP (x, 0, i), data);
}
break;
case SYMBOL_REF: case SYMBOL_REF:
h ^= htab_hash_string (XSTR (x, 0)); h ^= htab_hash_string (XSTR (x, 0));
break; break;
...@@ -3568,9 +3559,7 @@ const_rtx_hash_1 (rtx *xp, void *data) ...@@ -3568,9 +3559,7 @@ const_rtx_hash_1 (rtx *xp, void *data)
break; break;
} }
hp = (hashval_t *) data; return h;
*hp = *hp * 509 + h;
return 0;
} }
/* Compute a hash value for X, which should be a constant. */ /* Compute a hash value for X, which should be a constant. */
...@@ -3579,7 +3568,9 @@ static hashval_t ...@@ -3579,7 +3568,9 @@ static hashval_t
const_rtx_hash (rtx x) const_rtx_hash (rtx x)
{ {
hashval_t h = 0; hashval_t h = 0;
for_each_rtx (&x, const_rtx_hash_1, &h); subrtx_iterator::array_type array;
FOR_EACH_SUBRTX (iter, array, x, ALL)
h = h * 509 + const_rtx_hash_1 (*iter);
return h; return h;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment