This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][GIMPLE FE] Add parsing of MEM_REFs
On Fri, 13 Jan 2017, Richard Biener wrote:
> On Fri, 13 Jan 2017, Jakub Jelinek wrote:
>
> > On Fri, Jan 13, 2017 at 09:15:22AM +0100, Richard Biener wrote:
> > > > @@ -1710,6 +1716,24 @@ dump_generic_node (pretty_printer *pp, t
> > > > print_hex (val, pp_buffer (pp)->digit_buffer);
> > > > pp_string (pp, pp_buffer (pp)->digit_buffer);
> > > > }
> > > > + if ((flags & TDF_GIMPLE)
> > > > + && (POINTER_TYPE_P (TREE_TYPE (node))
> > > > + || (TYPE_PRECISION (TREE_TYPE (node))
> > > > + < TYPE_PRECISION (integer_type_node))
> > > > + || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
> > > > + {
> > > > + if (TYPE_UNSIGNED (TREE_TYPE (node)))
> > > > + pp_character (pp, 'u');
> > > > + if (TYPE_PRECISION (TREE_TYPE (node))
> > > > + == TYPE_PRECISION (unsigned_type_node))
> > > > + ;
> > > > + else if (TYPE_PRECISION (TREE_TYPE (node))
> > > > + == TYPE_PRECISION (long_unsigned_type_node))
> > > > + pp_character (pp, 'l');
> > > > + else if (TYPE_PRECISION (TREE_TYPE (node))
> > > > + == TYPE_PRECISION (long_long_unsigned_type_node))
> > > > + pp_string (pp, "ll");
> > > > + }
> >
> > Not sure if I understand this. The outer if condition says that only the
> > sub-int or strange precision or pointer types do that, but then
> > you compare the precisions against long and long long. That will be
> > true only for pointers. Don't you want the u/l/ll/ul/ull suffixes emitted
> > for integers even when they have normal precision and _Literal is not used?
> > Or is that handled somewhere else?
>
> Oops, you are right - it shouldn't be the same condition that controls
> whether to add _Literal (type). It should be the inverse. Maybe
> we need to add suffixes anyway even for say 61bit precision constants
> to avoid warnings from libcpp.
>
> I'll fix it up after testing a few cases.
Fixed as follows, bootstrapped / tested on x86_64-unknown-linux-gnu
and committed with the GIMPLE_NOP parsing from the other patch.
Richard.
2017-01-13 Richard Biener <rguenther@suse.de>
* tree-pretty-print.c (dump_generic_node): Fix inverted condition
for dumping GIMPLE INTEGER_CSTs.
Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c (revision 244393)
+++ gcc/tree-pretty-print.c (working copy)
@@ -1717,10 +1717,10 @@ dump_generic_node (pretty_printer *pp, t
pp_string (pp, pp_buffer (pp)->digit_buffer);
}
if ((flags & TDF_GIMPLE)
- && (POINTER_TYPE_P (TREE_TYPE (node))
- || (TYPE_PRECISION (TREE_TYPE (node))
- < TYPE_PRECISION (integer_type_node))
- || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
+ && ! (POINTER_TYPE_P (TREE_TYPE (node))
+ || (TYPE_PRECISION (TREE_TYPE (node))
+ < TYPE_PRECISION (integer_type_node))
+ || exact_log2 (TYPE_PRECISION (TREE_TYPE (node))) == -1))
{
if (TYPE_UNSIGNED (TREE_TYPE (node)))
pp_character (pp, 'u');