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]

[PATCH][5/n] Remove mark_symbols_for_renaming


This tackles thunks.  Easiest would be to not claim we are in SSA
form (we are not) and just go into SSA ... but well.  This makes
us use helpers properly.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-05-15  Richard Guenther  <rguenther@suse.de>

	* cgraphunit.c (thunk_adjust): Use make_rename_temp.
	(assemble_thunk): Likewise.  Manually rename and register
	function arguments.

Index: gcc/cgraphunit.c
===================================================================
*** gcc/cgraphunit.c	(revision 187503)
--- gcc/cgraphunit.c	(working copy)
*************** thunk_adjust (gimple_stmt_iterator * bsi
*** 1264,1288 ****
  	}
  
        vtabletmp =
! 	create_tmp_var (build_pointer_type
! 			(build_pointer_type (vtable_entry_type)), "vptr");
  
        /* The vptr is always at offset zero in the object.  */
        stmt = gimple_build_assign (vtabletmp,
  				  build1 (NOP_EXPR, TREE_TYPE (vtabletmp),
  					  ptr));
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-       mark_symbols_for_renaming (stmt);
-       find_referenced_vars_in (stmt);
  
        /* Form the vtable address.  */
!       vtabletmp2 = create_tmp_var (TREE_TYPE (TREE_TYPE (vtabletmp)),
! 				   "vtableaddr");
        stmt = gimple_build_assign (vtabletmp2,
  				  build_simple_mem_ref (vtabletmp));
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-       mark_symbols_for_renaming (stmt);
-       find_referenced_vars_in (stmt);
  
        /* Find the entry with the vcall offset.  */
        stmt = gimple_build_assign (vtabletmp2,
--- 1264,1284 ----
  	}
  
        vtabletmp =
! 	make_rename_temp (build_pointer_type
! 			  (build_pointer_type (vtable_entry_type)), "vptr");
  
        /* The vptr is always at offset zero in the object.  */
        stmt = gimple_build_assign (vtabletmp,
  				  build1 (NOP_EXPR, TREE_TYPE (vtabletmp),
  					  ptr));
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
        /* Form the vtable address.  */
!       vtabletmp2 = make_rename_temp (TREE_TYPE (TREE_TYPE (vtabletmp)),
! 				     "vtableaddr");
        stmt = gimple_build_assign (vtabletmp2,
  				  build_simple_mem_ref (vtabletmp));
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
        /* Find the entry with the vcall offset.  */
        stmt = gimple_build_assign (vtabletmp2,
*************** thunk_adjust (gimple_stmt_iterator * bsi
*** 1292,1304 ****
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
        /* Get the offset itself.  */
!       vtabletmp3 = create_tmp_var (TREE_TYPE (TREE_TYPE (vtabletmp2)),
! 				   "vcalloffset");
        stmt = gimple_build_assign (vtabletmp3,
  				  build_simple_mem_ref (vtabletmp2));
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
-       mark_symbols_for_renaming (stmt);
-       find_referenced_vars_in (stmt);
  
        /* Adjust the `this' pointer.  */
        ptr = fold_build_pointer_plus_loc (input_location, ptr, vtabletmp3);
--- 1288,1298 ----
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
        /* Get the offset itself.  */
!       vtabletmp3 = make_rename_temp (TREE_TYPE (TREE_TYPE (vtabletmp2)),
! 				     "vcalloffset");
        stmt = gimple_build_assign (vtabletmp3,
  				  build_simple_mem_ref (vtabletmp2));
        gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
        /* Adjust the `this' pointer.  */
        ptr = fold_build_pointer_plus_loc (input_location, ptr, vtabletmp3);
*************** thunk_adjust (gimple_stmt_iterator * bsi
*** 1316,1336 ****
          ptrtmp = ptr;
        else
          {
!           ptrtmp = create_tmp_var (TREE_TYPE (ptr), "ptr");
            stmt = gimple_build_assign (ptrtmp, ptr);
  	  gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
- 	  mark_symbols_for_renaming (stmt);
- 	  find_referenced_vars_in (stmt);
  	}
        ptr = fold_build_pointer_plus_hwi_loc (input_location,
  					     ptrtmp, fixed_offset);
      }
  
    /* Emit the statement and gimplify the adjustment expression.  */
!   ret = create_tmp_var (TREE_TYPE (ptr), "adjusted_this");
    stmt = gimple_build_assign (ret, ptr);
-   mark_symbols_for_renaming (stmt);
-   find_referenced_vars_in (stmt);
    gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
    return ret;
--- 1310,1326 ----
          ptrtmp = ptr;
        else
          {
!           ptrtmp = make_rename_temp (TREE_TYPE (ptr), "ptr");
            stmt = gimple_build_assign (ptrtmp, ptr);
  	  gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  	}
        ptr = fold_build_pointer_plus_hwi_loc (input_location,
  					     ptrtmp, fixed_offset);
      }
  
    /* Emit the statement and gimplify the adjustment expression.  */
!   ret = make_rename_temp (TREE_TYPE (ptr), "adjusted_this");
    stmt = gimple_build_assign (ret, ptr);
    gsi_insert_after (bsi, stmt, GSI_NEW_STMT);
  
    return ret;
*************** assemble_thunk (struct cgraph_node *node
*** 1434,1440 ****
  	      BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
  	    }
  	  else
!             restmp = create_tmp_var_raw (restype, "retval");
  	}
  
        for (arg = a; arg; arg = DECL_CHAIN (arg))
--- 1424,1430 ----
  	      BLOCK_VARS (DECL_INITIAL (current_function_decl)) = restmp;
  	    }
  	  else
!             restmp = make_rename_temp (restype, "retval");
  	}
  
        for (arg = a; arg; arg = DECL_CHAIN (arg))
*************** assemble_thunk (struct cgraph_node *node
*** 1447,1463 ****
  				      virtual_offset));
        else
          VEC_quick_push (tree, vargs, a);
        for (i = 1, arg = DECL_CHAIN (a); i < nargs; i++, arg = DECL_CHAIN (arg))
!         VEC_quick_push (tree, vargs, arg);
        call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
        VEC_free (tree, heap, vargs);
        gimple_call_set_from_thunk (call, true);
        if (restmp)
          gimple_call_set_lhs (call, restmp);
        gsi_insert_after (&bsi, call, GSI_NEW_STMT);
-       mark_symbols_for_renaming (call);
-       find_referenced_vars_in (call);
-       update_stmt (call);
  
        if (restmp && !this_adjusting)
          {
--- 1437,1458 ----
  				      virtual_offset));
        else
          VEC_quick_push (tree, vargs, a);
+       add_referenced_var (a);
+       if (is_gimple_reg (a))
+ 	mark_sym_for_renaming (a);
        for (i = 1, arg = DECL_CHAIN (a); i < nargs; i++, arg = DECL_CHAIN (arg))
! 	{
! 	  add_referenced_var (arg);
! 	  if (is_gimple_reg (arg))
! 	    mark_sym_for_renaming (arg);
! 	  VEC_quick_push (tree, vargs, arg);
! 	}
        call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
        VEC_free (tree, heap, vargs);
        gimple_call_set_from_thunk (call, true);
        if (restmp)
          gimple_call_set_lhs (call, restmp);
        gsi_insert_after (&bsi, call, GSI_NEW_STMT);
  
        if (restmp && !this_adjusting)
          {


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