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: [PATCH, TREE_LIST removal] remove calls to build_constructor_from_list from coverage.c


On Wed, May 12, 2010 at 08:59:23AM +0200, Steven Bosscher wrote:
> On Wed, May 12, 2010 at 4:31 AM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> >> Please track revisions you port in http://gcc.gnu.org/PR43977.
> >
> > Ack, will do.  I see that you already tackled this bit.
> 
> Well, I tried, but not one patch bootstrapped without changes. And my
> only fast development machine is broken at the moment so I haven't
> made much progress these last few days.
> 
> Anyway, the coverage.c changes are r114291, r114400, and r114401. Are
> you going to take care of these three?

Yup, I'll take care of those.


> > Pushing the computation of TREE_CONSTANT down into build_constructor
> > seems reasonable enough--eventually build_constructor_from_list will go
> > away and we'd have to compute it there anyway.

This change fixes a lot of test failures caused by ported_batch1.diff.
The c-common.c changes caused bootstrap issues even with this change and
tree-vect-stmts.c needed some tweaks to avoid sign warnings.  I can
commit the tree-vect-stmts.c changes if you like.

> > Index: tree.c
> > ===================================================================
> > --- tree.c      (revision 159280)
> > +++ tree.c      (working copy)
> > @@ -1332,8 +1332,19 @@ tree
> >  build_constructor (tree type, VEC(constructor_elt,gc) *vals)
> >  {
> >   tree c = make_node (CONSTRUCTOR);
> > +  unsigned int i;
> > +  constructor_elt *elt;
> > +  bool constant_p = true;
> > +
> >   TREE_TYPE (c) = type;
> >   CONSTRUCTOR_ELTS (c) = vals;
> > +
> > +  for (i = 0; VEC_iterate (constructor_elt, vals, i, elt); i++)
> > +    if (!TREE_CONSTANT (elt->value))
> > +      constant_p = false;
> 
> add a "break" here.

Done.

Regstrapped on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

        * tree.c (build_constructor): Compute TREE_CONSTANT for the
        resultant constructor.
        (build_constructor_single): Don't set TREE_CONSTANT.
        (build_constructor_from_list): Don't compute TREE_CONSTANT.

Index: tree.c
===================================================================
--- tree.c	(revision 159280)
+++ tree.c	(working copy)
@@ -1332,8 +1332,22 @@ tree
 build_constructor (tree type, VEC(constructor_elt,gc) *vals)
 {
   tree c = make_node (CONSTRUCTOR);
+  unsigned int i;
+  constructor_elt *elt;
+  bool constant_p = true;
+
   TREE_TYPE (c) = type;
   CONSTRUCTOR_ELTS (c) = vals;
+
+  for (i = 0; VEC_iterate (constructor_elt, vals, i, elt); i++)
+    if (!TREE_CONSTANT (elt->value))
+      {
+	constant_p = false;
+	break;
+      }
+
+  TREE_CONSTANT (c) = constant_p;
+
   return c;
 }
 
@@ -1344,16 +1358,13 @@ build_constructor_single (tree type, tre
 {
   VEC(constructor_elt,gc) *v;
   constructor_elt *elt;
-  tree t;
 
   v = VEC_alloc (constructor_elt, gc, 1);
   elt = VEC_quick_push (constructor_elt, v, NULL);
   elt->index = index;
   elt->value = value;
 
-  t = build_constructor (type, v);
-  TREE_CONSTANT (t) = TREE_CONSTANT (value);
-  return t;
+  return build_constructor (type, v);
 }
 
 
@@ -1362,27 +1373,17 @@ build_constructor_single (tree type, tre
 tree
 build_constructor_from_list (tree type, tree vals)
 {
-  tree t, val;
+  tree t;
   VEC(constructor_elt,gc) *v = NULL;
-  bool constant_p = true;
 
   if (vals)
     {
       v = VEC_alloc (constructor_elt, gc, list_length (vals));
       for (t = vals; t; t = TREE_CHAIN (t))
-	{
-	  constructor_elt *elt = VEC_quick_push (constructor_elt, v, NULL);
-	  val = TREE_VALUE (t);
-	  elt->index = TREE_PURPOSE (t);
-	  elt->value = val;
-	  if (!TREE_CONSTANT (val))
-	    constant_p = false;
-	}
+	CONSTRUCTOR_APPEND_ELT (v, TREE_PURPOSE (t), TREE_VALUE (t));
     }
 
-  t = build_constructor (type, v);
-  TREE_CONSTANT (t) = constant_p;
-  return t;
+  return build_constructor (type, v);
 }
 
 /* Return a new FIXED_CST node whose type is TYPE and value is F.  */


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