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]

Minor fixes to type remapping in tree-inline.c


Tested on x86_64-linux-gnu.

2004-06-24  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* tree-inline.c (remap_type): Arrange to have just one pointer type
	for each type, mode, and 'can alias' value.
	(setup_one_parameter): Remap type when making VAR_DECL for PARM_DECL.
	(estimate_num_insns_1): Minor code reformatting.
	(inline_forbidden_p_1): Likewise; add; missing return statement.

*** tree-inline.c	25 Jun 2004 02:00:16 -0000	1.114
--- tree-inline.c	25 Jun 2004 19:08:09 -0000
*************** remap_type (tree type, inline_data *id)
*** 251,256 ****
      }
    
!   /* We do need a copy.  build and register it now.  */
!   new = copy_node (type);
    insert_decl_map (id, type, new);
  
--- 251,276 ----
      }
    
!   /* We do need a copy.  build and register it now.  If this is a pointer or
!      reference type, remap the designated type and make a new pointer or
!      reference type.  */
!   if (TREE_CODE (type) == POINTER_TYPE)
!     {
!       new = build_pointer_type_for_mode (remap_type (TREE_TYPE (type), id),
! 					 TYPE_MODE (type),
! 					 TYPE_REF_CAN_ALIAS_ALL (type));
!       insert_decl_map (id, type, new);
!       return new;
!     }
!   else if (TREE_CODE (type) == REFERENCE_TYPE)
!     {
!       new = build_reference_type_for_mode (remap_type (TREE_TYPE (type), id),
! 					    TYPE_MODE (type),
! 					    TYPE_REF_CAN_ALIAS_ALL (type));
!       insert_decl_map (id, type, new);
!       return new;
!     }
!   else
!     new = copy_node (type);
! 
    insert_decl_map (id, type, new);
  
*************** remap_type (tree type, inline_data *id)
*** 291,307 ****
        return new;
      
-     case POINTER_TYPE:
-       TREE_TYPE (new) = t = remap_type (TREE_TYPE (new), id);
-       TYPE_NEXT_PTR_TO (new) = TYPE_POINTER_TO (t);
-       TYPE_POINTER_TO (t) = new;
-       return new;
- 
-     case REFERENCE_TYPE:
-       TREE_TYPE (new) = t = remap_type (TREE_TYPE (new), id);
-       TYPE_NEXT_REF_TO (new) = TYPE_REFERENCE_TO (t);
-       TYPE_REFERENCE_TO (t) = new;
-       return new;
- 
-     case METHOD_TYPE:
      case FUNCTION_TYPE:
        TREE_TYPE (new) = remap_type (TREE_TYPE (new), id);
--- 311,314 ----
*************** setup_one_parameter (inline_data *id, tr
*** 734,739 ****
      }
  
!   /* Make an equivalent VAR_DECL.  */
    var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0));
  
    /* See if the frontend wants to pass this by invisible reference.  If
--- 741,747 ----
      }
  
!   /* Make an equivalent VAR_DECL with the remapped type.  */
    var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0));
+   TREE_TYPE (var) = remap_type (TREE_TYPE (var), id);
  
    /* See if the frontend wants to pass this by invisible reference.  If
*************** inline_forbidden_p_1 (tree *nodep, int *
*** 1049,1052 ****
--- 1057,1061 ----
  	    = N_("%Jfunction '%F' can never be inlined "
  		 "because it receives a non-local goto");
+ 	  return node;
  	}
        break;
*************** inline_forbidden_p (tree fndecl)
*** 1085,1090 ****
  {
    location_t saved_loc = input_location;
!   tree ret = walk_tree_without_duplicates
! 		(&DECL_SAVED_TREE (fndecl), inline_forbidden_p_1, fndecl);
    input_location = saved_loc;
    return ret;
--- 1094,1100 ----
  {
    location_t saved_loc = input_location;
!   tree ret = walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl),
! 					   inline_forbidden_p_1, fndecl);
! 
    input_location = saved_loc;
    return ret;
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 1181,1187 ****
       be majorized by amount of operations among them we count later
       and are common target of CSE and similar optimizations.  */
!   if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
!       || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
      return NULL;
    switch (TREE_CODE (x))
      { 
--- 1191,1198 ----
       be majorized by amount of operations among them we count later
       and are common target of CSE and similar optimizations.  */
!   else if (TREE_CODE_CLASS (TREE_CODE (x)) == 'c'
! 	   || TREE_CODE_CLASS (TREE_CODE (x)) == 'r')
      return NULL;
+ 
    switch (TREE_CODE (x))
      { 


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