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: [tree-ssa] Make tail-call work on SSA form


> On Tue, Nov 18, 2003 at 07:41:34PM +0100, Jan Hubicka wrote:
> > I've modified expander to always produce addressof in this case and testing
> > the patch right now.
> > I think in short term this is good fix and in mid term, we will get
> > scalar replacement.  THe idea of packing structures/arrays into
> > registers is strange anyway.
> 
> No, addressof is not a solution.  Indeed, I want it to go away entirely.

Of course.  It is one thing on my TODO after the tail calls :)
I am attaching the patch that makes the FIXME hacks go away and fixes
expander to always put variable into addressof (and soon into memory,
that I hope won't be problem after SRA as we won't get the decls for
completely replaces structures/arays expanded at all)

I fails as it is but with the two fixes to mustalias code I sent, it
pases testing on i386-linux, I will give this more testing once we
conclude something about the patch reversal.  This is just FYI.

Honza
> Let's leave this alone.  SRA is almost done.

2003-11-19  Jan Hubicka  <jh@suse.cz>

	* stmt.c (expand_decl): Always put structures into addressof.
	* tree-must-alias.c (tree_compute_must_alias): Kill FIXME hack
	regarding arrays/structures.
	(promote_var): Likewise.
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.267.2.40
diff -c -3 -p -r1.267.2.40 stmt.c
*** stmt.c	13 Nov 2003 02:37:59 -0000	1.267.2.40
--- stmt.c	18 Nov 2003 23:08:47 -0000
*************** expand_decl (tree decl)
*** 3933,3940 ****
  
        maybe_set_unchanging (DECL_RTL (decl), decl);
  
!       /* If something wants our address, try to use ADDRESSOF.  */
!       if (TREE_ADDRESSABLE (decl))
  	put_var_into_stack (decl, /*rescan=*/false);
      }
  
--- 3933,3943 ----
  
        maybe_set_unchanging (DECL_RTL (decl), decl);
  
!       /* If something wants our address, try to use ADDRESSOF. 
!          Always construct address for aggregates, as we may need
! 	 referencing field addressed by variable we can't do inside
! 	 register.  */
!       if (TREE_ADDRESSABLE (decl) || AGGREGATE_TYPE_P (type))
  	put_var_into_stack (decl, /*rescan=*/false);
      }
  
Index: tree-must-alias.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-must-alias.c,v
retrieving revision 1.1.2.8
diff -c -3 -p -r1.1.2.8 tree-must-alias.c
*** tree-must-alias.c	11 Nov 2003 18:04:46 -0000	1.1.2.8
--- tree-must-alias.c	18 Nov 2003 23:08:48 -0000
*************** tree_compute_must_alias (tree fndecl, sb
*** 87,101 ****
  
    /* Now traverse the original list of addressable variables and remove
       those whose addresses are not needed anymore.  */
!   for (i = 0; i < VARRAY_ACTIVE_SIZE (call_clobbered_vars); i++)
      {
!       tree var = VARRAY_TREE (call_clobbered_vars, i);
        
        /* We are only interested in disambiguating addressable locals.  */
        if (TREE_ADDRESSABLE (var)
- 	  /* FIXME Why exactly do we need to ignore pointers and arrays?  */
- 	  && !POINTER_TYPE_P (TREE_TYPE (var))
- 	  && TREE_CODE (TREE_TYPE (var)) != ARRAY_TYPE
  	  && decl_function_context (var) == current_function_decl
  	  && !DECL_NONLOCAL (var)
  	  && !TEST_BIT (addresses_needed, var_ann (var)->uid))
--- 87,98 ----
  
    /* Now traverse the original list of addressable variables and remove
       those whose addresses are not needed anymore.  */
!   for (i = 0; i < VARRAY_ACTIVE_SIZE (call_clobbered_vars); i++)
      {
!       tree var = VARRAY_TREE (call_clobbered_vars, i);
        
        /* We are only interested in disambiguating addressable locals.  */
        if (TREE_ADDRESSABLE (var)
  	  && decl_function_context (var) == current_function_decl
  	  && !DECL_NONLOCAL (var)
  	  && !TEST_BIT (addresses_needed, var_ann (var)->uid))
*************** promote_var (tree var, sbitmap vars_to_r
*** 197,206 ****
    int ix;
    var_ann_t ann = var_ann (var);
  
!   /* FIXME: Apparently we always need TREE_ADDRESSABLE for aggregate
!      types.  Is this a backend quirk or do we actually need these?  */
!   if (!AGGREGATE_TYPE_P (TREE_TYPE (var)))
!     TREE_ADDRESSABLE (var) = 0;
  
    /* All VAR's aliases need to be renamed.  */
    if (ann->may_aliases)
--- 197,203 ----
    int ix;
    var_ann_t ann = var_ann (var);
  
!   TREE_ADDRESSABLE (var) = 0;
  
    /* All VAR's aliases need to be renamed.  */
    if (ann->may_aliases)


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