]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Directly operate on CONST_VECTOR encoding
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jan 2018 21:39:33 +0000 (21:39 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 3 Jan 2018 21:39:33 +0000 (21:39 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256192 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cse.c
gcc/cselib.c
gcc/expmed.c

index 7aa0920fc653608809e0710b5b7a5de5f5ae3ea0..0ce136fc7a1a132ecb36309b3585555362e8f44f 100644 (file)
@@ -1,3 +1,10 @@
+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>
            Jeff Law  <law@redhat.com>
 
index 81a401563272187130166b8679962fc0b95b4ef4..fcfbba092834414bc2b3948d059547d085d7f8db 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -2353,11 +2353,11 @@ hash_rtx_cb (const_rtx x, machine_mode mode,
        int units;
        rtx elt;
 
-       units = CONST_VECTOR_NUNITS (x);
+       units = const_vector_encoded_nelts (x);
 
        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),
                                  do_not_record_p, hash_arg_in_memory_p,
                                  have_reg_qty, cb);
index 41e4317e337ecde4979ffe8c9a8f8423b4be1147..ca4a53a87337093daa61ec8b20b69d4c94b7d1de 100644 (file)
@@ -1163,11 +1163,11 @@ cselib_hash_rtx (rtx x, int create, machine_mode memmode)
        int units;
        rtx elt;
 
-       units = CONST_VECTOR_NUNITS (x);
+       units = const_vector_encoded_nelts (x);
 
        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);
          }
 
index 60848fa5d237b7087c4b2e5d765fedb7674302a1..be6a13854e62aaac3be3c41597fa887917cf8fc4 100644 (file)
@@ -5273,13 +5273,14 @@ make_tree (tree type, rtx x)
 
     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);
-       int i;
 
        /* Build a tree with vector elements.  */
-       tree_vector_builder elts (type, units, 1);
-       for (i = 0; i < units; ++i)
+       tree_vector_builder elts (type, npatterns, nelts_per_pattern);
+       unsigned int count = elts.encoded_nelts ();
+       for (unsigned int i = 0; i < count; ++i)
          {
            rtx elt = CONST_VECTOR_ELT (x, i);
            elts.quick_push (make_tree (itype, elt));