middle-end/111975 - dump -> GIMPLE FE roundtrip improvements
Checks
Commit Message
The following improves the manual work needed to make a -gimple dump
valid input to the GIMPLE FE. First of all it recognizes the 'sizetype'
tree and dumps it as __SIZETYPE__, then it changes dumping vector types
without name from 'vector(n) T' to 'T [[gnu::vector_size(n')]]' which
we can parse in most relevant contexts (and that's shorter than
using __attribute__). Third it avoids a NULL_TREE TMR_STEP when
it would be one, an optimization that's re-done when generating RTL.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
OK?
Thanks,
Richard.
PR middle-end/111975
* tree-pretty-print.cc (dump_generic_node): Dump
sizetype as __SIZETYPE__ with TDF_GIMPLE.
Dump unnamed vector types as T [[gnu::vector_size(n)]] with
TDF_GIMPLE.
* tree-ssa-address.cc (create_mem_ref_raw): Never generate
a NULL STEP when INDEX is specified.
---
gcc/tree-pretty-print.cc | 25 +++++++++++++++++++------
gcc/tree-ssa-address.cc | 3 ---
2 files changed, 19 insertions(+), 9 deletions(-)
@@ -2002,7 +2002,9 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
}
else if (tclass == tcc_type)
{
- if (TYPE_NAME (node))
+ if ((flags & TDF_GIMPLE) && node == sizetype)
+ pp_string (pp, "__SIZETYPE__");
+ else if (TYPE_NAME (node))
{
if (TREE_CODE (TYPE_NAME (node)) == IDENTIFIER_NODE)
pp_tree_identifier (pp, TYPE_NAME (node));
@@ -2014,11 +2016,22 @@ dump_generic_node (pretty_printer *pp, tree node, int spc, dump_flags_t flags,
}
else if (TREE_CODE (node) == VECTOR_TYPE)
{
- pp_string (pp, "vector");
- pp_left_paren (pp);
- pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
- pp_string (pp, ") ");
- dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ if (flags & TDF_GIMPLE)
+ {
+ dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ pp_string (pp, " [[gnu::vector_size(");
+ pp_wide_integer
+ (pp, tree_to_poly_uint64 (TYPE_SIZE_UNIT (node)));
+ pp_string (pp, ")]]");
+ }
+ else
+ {
+ pp_string (pp, "vector");
+ pp_left_paren (pp);
+ pp_wide_integer (pp, TYPE_VECTOR_SUBPARTS (node));
+ pp_string (pp, ") ");
+ dump_generic_node (pp, TREE_TYPE (node), spc, flags, false);
+ }
}
else if (TREE_CODE (node) == INTEGER_TYPE)
{
@@ -369,9 +369,6 @@ create_mem_ref_raw (tree type, tree alias_ptr_type, struct mem_address *addr,
&& !valid_mem_ref_p (TYPE_MODE (type), TYPE_ADDR_SPACE (type), addr))
return NULL_TREE;
- if (addr->step && integer_onep (addr->step))
- addr->step = NULL_TREE;
-
if (addr->offset)
addr->offset = fold_convert (alias_ptr_type, addr->offset);
else