This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Graphite] Fix type problems in loop ivs.


On Thu, Mar 11, 2010 at 09:16, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Thu, Mar 11, 2010 at 2:54 PM, Sebastian Pop <sebpop@gmail.com> wrote:
>> On Thu, Mar 11, 2010 at 04:48, Richard Guenther
>> <richard.guenther@gmail.com> wrote:
>>> Java indeed fails to initialize most of the common trees.
>>> I suggest to use ssizetype if long_long_type_node is NULL.
>>
>> Here is the fix. ?Does this look good?
>
> Hm. ?I don't like the #define. ?And Java doesn't initialize
> long_integer_type_node either, so I think the patch won't fix
> the bootstrap issue. ?Basically the C kind types are not
> really supposed to be used in the middle-end.
>
> What you probably want is to use
> smallest_mode_for_size (type_precision + 1, MODE_INT)
> and fail if that returns BLKmode (ugh, it doesn't ...).
> From the modes precision then build a type using
> build_nonstandard_integer_type. And possibly you
> want to restrict yourself to maximum BITS_PER_WORD
> size to avoid long long or TImode arithmetic.
>

Sorry for having neglected this issue so long.
Here is the patch that fixes this induction variable type computation.
Ok for trunk after the automatic tests in the graphite branch?

Thanks,
Sebastian
From 9143a7912763ddd2b0fa639d54dbc2c8d9cac7e0 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Tue, 1 Jun 2010 18:03:35 -0500
Subject: [PATCH] Use smallest_mode_for_size for computing the precision types of new graphite IVs.

---
 gcc/graphite-clast-to-gimple.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index b0e1a94..3240c37 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -478,6 +478,7 @@ gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
   bool unsigned_p = true;
   int precision, prec_up, prec_int;
   tree type;
+  enum machine_mode mode;
 
   gcc_assert (value_le (low, up));
 
@@ -490,7 +491,16 @@ gcc_type_for_interval (mpz_t low, mpz_t up, tree old_type)
   prec_int = precision_for_interval (low, up);
   precision = prec_up > prec_int ? prec_up : prec_int;
 
-  type = lang_hooks.types.type_for_size (precision, unsigned_p);
+  if (precision > BITS_PER_WORD)
+    {
+      gloog_error = true;
+      return integer_type_node;
+    }
+
+  mode = smallest_mode_for_size (precision, MODE_INT);
+  precision = GET_MODE_PRECISION (mode);
+  type = build_nonstandard_integer_type (precision, unsigned_p);
+
   if (!type)
     {
       gloog_error = true;
-- 
1.7.0.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]