Commit 16c78b66 by Richard Sandiford Committed by Richard Sandiford

Directly operate on CONST_VECTOR encoding

This patch makes some pieces of code operate directly on the new
CONST_VECTOR encoding.

2018-01-03  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
	* cse.c (hash_rtx_cb): Hash only the encoded elements.
	* cselib.c (cselib_hash_rtx): Likewise.
	* expmed.c (make_tree): Build VECTOR_CSTs directly from the
	CONST_VECTOR encoding.

From-SVN: r256192
parent 4bfb8e11
2018-01-03 Richard Sandiford <richard.sandiford@linaro.org>
* cse.c (hash_rtx_cb): Hash only the encoded elements.
* cselib.c (cselib_hash_rtx): Likewise.
* expmed.c (make_tree): Build VECTOR_CSTs directly from the
CONST_VECTOR encoding.
2017-01-03 Jakub Jelinek <jakub@redhat.com> 2017-01-03 Jakub Jelinek <jakub@redhat.com>
Jeff Law <law@redhat.com> Jeff Law <law@redhat.com>
......
...@@ -2353,11 +2353,11 @@ hash_rtx_cb (const_rtx x, machine_mode mode, ...@@ -2353,11 +2353,11 @@ hash_rtx_cb (const_rtx x, machine_mode mode,
int units; int units;
rtx elt; rtx elt;
units = CONST_VECTOR_NUNITS (x); units = const_vector_encoded_nelts (x);
for (i = 0; i < units; ++i) for (i = 0; i < units; ++i)
{ {
elt = CONST_VECTOR_ELT (x, i); elt = CONST_VECTOR_ENCODED_ELT (x, i);
hash += hash_rtx_cb (elt, GET_MODE (elt), hash += hash_rtx_cb (elt, GET_MODE (elt),
do_not_record_p, hash_arg_in_memory_p, do_not_record_p, hash_arg_in_memory_p,
have_reg_qty, cb); have_reg_qty, cb);
......
...@@ -1163,11 +1163,11 @@ cselib_hash_rtx (rtx x, int create, machine_mode memmode) ...@@ -1163,11 +1163,11 @@ cselib_hash_rtx (rtx x, int create, machine_mode memmode)
int units; int units;
rtx elt; rtx elt;
units = CONST_VECTOR_NUNITS (x); units = const_vector_encoded_nelts (x);
for (i = 0; i < units; ++i) for (i = 0; i < units; ++i)
{ {
elt = CONST_VECTOR_ELT (x, i); elt = CONST_VECTOR_ENCODED_ELT (x, i);
hash += cselib_hash_rtx (elt, 0, memmode); hash += cselib_hash_rtx (elt, 0, memmode);
} }
......
...@@ -5273,13 +5273,14 @@ make_tree (tree type, rtx x) ...@@ -5273,13 +5273,14 @@ make_tree (tree type, rtx x)
case CONST_VECTOR: case CONST_VECTOR:
{ {
int units = CONST_VECTOR_NUNITS (x); unsigned int npatterns = CONST_VECTOR_NPATTERNS (x);
unsigned int nelts_per_pattern = CONST_VECTOR_NELTS_PER_PATTERN (x);
tree itype = TREE_TYPE (type); tree itype = TREE_TYPE (type);
int i;
/* Build a tree with vector elements. */ /* Build a tree with vector elements. */
tree_vector_builder elts (type, units, 1); tree_vector_builder elts (type, npatterns, nelts_per_pattern);
for (i = 0; i < units; ++i) unsigned int count = elts.encoded_nelts ();
for (unsigned int i = 0; i < count; ++i)
{ {
rtx elt = CONST_VECTOR_ELT (x, i); rtx elt = CONST_VECTOR_ELT (x, i);
elts.quick_push (make_tree (itype, elt)); elts.quick_push (make_tree (itype, elt));
......
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