[C++ patch] Fix one of PPC bootstrap problems

Jan Hubicka jh@suse.cz
Tue Sep 9 20:54:00 GMT 2003


> On Sun, 2003-09-07 at 13:40, Jan Hubicka wrote:
> > > On Sun, 2003-09-07 at 13:08, Richard Henderson wrote:
> > > > On Sun, Sep 07, 2003 at 12:30:07PM -0700, Mark Mitchell wrote:
> > > > > Please package that up into a macro -- I suggested the name
> > > > > VAR_FINALIZED_P, and use it in place of the tests that you added.
> > > > 
> > > > Or a function.  Using a macro is probably premature optimization.
> > > 
> > > Sure.
> > 
> > Where should such a function sit?  toplevel tree.c didn't look very
> > right as it is related only to unit-at-a-time backends, perhaps cgraph.c
> > or somewhere in cp tree?
> 
> If it's only needed in the C++ front end at this point, that's where it
> should go.  If it's needed more widely, it can be moved later.

Does this look fine?
Testing is still in progress but I don't expect surprises this time..

Tue Sep  9 22:51:54 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* decl2.c (var_finalized_p): new variable.
	(maybe_emit_vtables, write_out_vars, finish_file): Use it.
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.670
diff -c -3 -p -r1.670 decl2.c
*** decl2.c	8 Sep 2003 18:46:15 -0000	1.670
--- decl2.c	9 Sep 2003 20:38:50 -0000
*************** import_export_class (tree ctype)
*** 1621,1626 ****
--- 1621,1636 ----
      }
  }
  
+ /* Return true when the variable has been already expanded.  */
+ static bool
+ var_finalized_p (tree var)
+ {
+   if (flag_unit_at_a_time)
+     return TREE_ASM_WRITTEN (var);
+   else
+     return cgraph_varpool_node (var)->finalized;
+ }
+ 
  /* If necessary, write out the vtables for the dynamic class CTYPE.
     Returns true if any vtables were emitted.  */
  
*************** maybe_emit_vtables (tree ctype)
*** 1634,1642 ****
    /* If the vtables for this class have already been emitted there is
       nothing more to do.  */
    primary_vtbl = CLASSTYPE_VTABLES (ctype);
!   if (TREE_ASM_WRITTEN (primary_vtbl)
!       || (flag_unit_at_a_time
! 	  && cgraph_varpool_node (primary_vtbl)->finalized))
      return false;
    /* Ignore dummy vtables made by get_vtable_decl.  */
    if (TREE_TYPE (primary_vtbl) == void_type_node)
--- 1644,1650 ----
    /* If the vtables for this class have already been emitted there is
       nothing more to do.  */
    primary_vtbl = CLASSTYPE_VTABLES (ctype);
!   if (var_finalized_p (var))
      return false;
    /* Ignore dummy vtables made by get_vtable_decl.  */
    if (TREE_TYPE (primary_vtbl) == void_type_node)
*************** write_out_vars (tree vars)
*** 2454,2462 ****
    tree v;
  
    for (v = vars; v; v = TREE_CHAIN (v))
!     if (! TREE_ASM_WRITTEN (TREE_VALUE (v))
!         && (!flag_unit_at_a_time
! 	    || !cgraph_varpool_node (TREE_VALUE (v))->finalized))
        rest_of_decl_compilation (TREE_VALUE (v), 0, 1, 1);
  }
  
--- 2462,2468 ----
    tree v;
  
    for (v = vars; v; v = TREE_CHAIN (v))
!     if (!var_finalized_p (TREE_VALUE (v)))
        rest_of_decl_compilation (TREE_VALUE (v), 0, 1, 1);
  }
  
*************** finish_file ()
*** 2879,2887 ****
        for (i = 0; i < pending_statics_used; ++i) 
  	{
  	  tree decl = VARRAY_TREE (pending_statics, i);
! 	  if (TREE_ASM_WRITTEN (decl)
! 	      || (flag_unit_at_a_time
! 		  && cgraph_varpool_node (decl)->finalized))
  	    continue;
  	  import_export_decl (decl);
  	  if (DECL_NOT_REALLY_EXTERN (decl) && ! DECL_IN_AGGR_P (decl))
--- 2885,2891 ----
        for (i = 0; i < pending_statics_used; ++i) 
  	{
  	  tree decl = VARRAY_TREE (pending_statics, i);
! 	  if (var_finalized_p_(decl))
  	    continue;
  	  import_export_decl (decl);
  	  if (DECL_NOT_REALLY_EXTERN (decl) && ! DECL_IN_AGGR_P (decl))



More information about the Gcc-patches mailing list