aboutsummaryrefslogtreecommitdiff
path: root/gcc/print-tree.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-07 18:42:41 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-07 18:42:41 +0000
commit63570af0b58a3c354723bc78b75d76dbb0750f47 (patch)
tree7b1f2b8c0da2c3908d22d25dcea31ceacd492de2 /gcc/print-tree.c
parent44e1aae4dbd8198a26ab0ec5958e073e2c9cc772 (diff)
downloadgcc-63570af0b58a3c354723bc78b75d76dbb0750f47.zip
gcc-63570af0b58a3c354723bc78b75d76dbb0750f47.tar.gz
gcc-63570af0b58a3c354723bc78b75d76dbb0750f47.tar.bz2
Make more use of VECTOR_CST_ENCODED_ELT
This patch makes various bits of code operate directly on the new VECTOR_CST encoding, instead of using VECTOR_CST_ELT on all elements of the vector. Previous patches handled operations that produce a new VECTOR_CST, while this patch handles things like predicates. It also makes print_node dump the encoding instead of the full vector that the encoding represents. 2017-12-07 Richard Sandiford <richard.sandiford@linaro.org> gcc/ * tree-vector-builder.h (tree_vector_builder::binary_encoded_nelts): Declare. * tree-vector-builder.c (tree_vector_builder::binary_encoded_nelts): New function. * fold-const.c (negate_expr_p): Likewise. (operand_equal_p, fold_checksum_tree): Likewise. * tree-loop-distribution.c (const_with_all_bytes_same): Likewise. * tree.c (integer_zerop, integer_onep, integer_all_onesp, real_zerop) (real_onep, real_minus_onep, add_expr, initializer_zerop): Likewise. (uniform_vector_p): Likewise. * varasm.c (const_hash_1, compare_constant): Likewise. * tree-ssa-ccp.c: Include tree-vector-builder.h. (valid_lattice_transition): Operate directly on the VECTOR_CST encoding. * ipa-icf.c: Include tree-vector-builder.h. (sem_variable::equals): Operate directly on the VECTOR_CST encoding. * print-tree.c (print_node): Print encoding of VECTOR_CSTs. From-SVN: r255480
Diffstat (limited to 'gcc/print-tree.c')
-rw-r--r--gcc/print-tree.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 3a0f85d..2139a72 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -761,24 +761,18 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
case VECTOR_CST:
{
- /* Big enough for 2 UINT_MAX plus the string below. */
+ /* Big enough for UINT_MAX plus the string below. */
char buf[32];
- unsigned i;
- for (i = 0; i < VECTOR_CST_NELTS (node); ++i)
+ fprintf (file, " npatterns:%u nelts-per-pattern:%u",
+ VECTOR_CST_NPATTERNS (node),
+ VECTOR_CST_NELTS_PER_PATTERN (node));
+ unsigned int count = vector_cst_encoded_nelts (node);
+ for (unsigned int i = 0; i < count; ++i)
{
- unsigned j;
- /* Coalesce the output of identical consecutive elements. */
- for (j = i + 1; j < VECTOR_CST_NELTS (node); j++)
- if (VECTOR_CST_ELT (node, j) != VECTOR_CST_ELT (node, i))
- break;
- j--;
- if (i == j)
- sprintf (buf, "elt:%u: ", i);
- else
- sprintf (buf, "elt:%u...%u: ", i, j);
- print_node (file, buf, VECTOR_CST_ELT (node, i), indent + 4);
- i = j;
+ sprintf (buf, "elt:%u: ", i);
+ print_node (file, buf, VECTOR_CST_ENCODED_ELT (node, i),
+ indent + 4);
}
}
break;