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: new PATCH for c++/16115 (invisible reference parms)


This followup patch removes some inliner code which is no longer necessary
now that we handle this in the front end.

2004-07-22  Jason Merrill  <jason@redhat.com>

	* integrate.c (copy_decl_for_inlining): Remove invisible reference
	handling.
	* tree-inline.c (setup_one_parameter): Likewise.

*** ./integrate.c.~1~	2004-07-14 16:52:35.000000000 -0400
--- ./integrate.c	2004-07-20 17:07:12.000000000 -0400
*************** copy_decl_for_inlining (tree decl, tree 
*** 116,151 ****
    /* Copy the declaration.  */
    if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL)
      {
!       tree type;
!       int invisiref = 0;
! 
!       /* See if the frontend wants to pass this by invisible reference.  */
!       if (TREE_CODE (decl) == PARM_DECL
! 	  && DECL_ARG_TYPE (decl) != TREE_TYPE (decl)
! 	  && POINTER_TYPE_P (DECL_ARG_TYPE (decl))
! 	  && TREE_TYPE (DECL_ARG_TYPE (decl)) == TREE_TYPE (decl))
! 	{
! 	  invisiref = 1;
! 	  type = DECL_ARG_TYPE (decl);
! 	}
!       else
! 	type = TREE_TYPE (decl);
  
        /* For a parameter or result, we must make an equivalent VAR_DECL, not a
  	 new PARM_DECL.  */
        copy = build_decl (VAR_DECL, DECL_NAME (decl), type);
!       if (!invisiref)
! 	{
! 	  TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl);
! 	  TREE_READONLY (copy) = TREE_READONLY (decl);
! 	  TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
! 	}
!       else
! 	{
! 	  TREE_ADDRESSABLE (copy) = 0;
! 	  TREE_READONLY (copy) = 1;
! 	  TREE_THIS_VOLATILE (copy) = 0;
! 	}
      }
    else
      {
--- 116,129 ----
    /* Copy the declaration.  */
    if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == RESULT_DECL)
      {
!       tree type = TREE_TYPE (decl);
  
        /* For a parameter or result, we must make an equivalent VAR_DECL, not a
  	 new PARM_DECL.  */
        copy = build_decl (VAR_DECL, DECL_NAME (decl), type);
!       TREE_ADDRESSABLE (copy) = TREE_ADDRESSABLE (decl);
!       TREE_READONLY (copy) = TREE_READONLY (decl);
!       TREE_THIS_VOLATILE (copy) = TREE_THIS_VOLATILE (decl);
      }
    else
      {
*** ./tree-inline.c.~1~	2004-07-17 12:24:04.000000000 -0400
--- ./tree-inline.c	2004-07-20 17:12:04.000000000 -0400
*************** setup_one_parameter (inline_data *id, tr
*** 693,699 ****
  {
    tree init_stmt;
    tree var;
-   tree var_sub;
  
    /* If the parameter is never assigned to, we may not need to
       create a new variable here at all.  Instead, we may be able
--- 693,698 ----
*************** setup_one_parameter (inline_data *id, tr
*** 724,746 ****
       function. */
    var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0));
  
-   /* See if the frontend wants to pass this by invisible reference.  If
-      so, our new VAR_DECL will have REFERENCE_TYPE, and we need to
-      replace uses of the PARM_DECL with dereferences.  */
-   if (TREE_TYPE (var) != TREE_TYPE (p)
-       && POINTER_TYPE_P (TREE_TYPE (var))
-       && TREE_TYPE (TREE_TYPE (var)) == TREE_TYPE (p))
-     {
-       insert_decl_map (id, var, var);
-       var_sub = build1 (INDIRECT_REF, TREE_TYPE (p), var);
-     }
-   else
-     var_sub = var;
- 
    /* Register the VAR_DECL as the equivalent for the PARM_DECL;
       that way, when the PARM_DECL is encountered, it will be
       automatically replaced by the VAR_DECL.  */
!   insert_decl_map (id, p, var_sub);
  
    /* Declare this new variable.  */
    TREE_CHAIN (var) = *vars;
--- 723,732 ----
       function. */
    var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0));
  
    /* Register the VAR_DECL as the equivalent for the PARM_DECL;
       that way, when the PARM_DECL is encountered, it will be
       automatically replaced by the VAR_DECL.  */
!   insert_decl_map (id, p, var);
  
    /* Declare this new variable.  */
    TREE_CHAIN (var) = *vars;

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