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]

C++ PATCH to remove DECL_USE_VTT_PARM


The USE_VTT_PARM is redundant with the in_chrg parm; this patch removes
it.  This is needed for an upcoming patch to add DECL_VTT_PARM to
DECL_ARGUMENTS.

Tested x86 linux, applied to both trunk and branch.

2001-02-16  Jason Merrill  <jason@redhat.com>

	* cp-tree.h (DECL_USE_VTT_PARM): Remove.
	* decl2.c (maybe_retrofit_in_chrg): Don't create it.
	* optimize.c (maybe_clone_body): Don't substitute it.
	* call.c (build_new_method_call): Check in_chrg instead.
	* init.c (expand_virtual_init): Likewise.

Index: call.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/call.c,v
retrieving revision 1.256
diff -c -p -r1.256 call.c
*** call.c	2001/02/14 06:32:14	1.256
--- call.c	2001/02/16 21:08:34
*************** build_new_method_call (instance, name, a
*** 4426,4434 ****
  	     or destructor, then we fetch the VTT directly.
  	     Otherwise, we look it up using the VTT we were given.  */
  	  vtt = IDENTIFIER_GLOBAL_VALUE (get_vtt_name (current_class_type));
! 	  vtt = build_unary_op (ADDR_EXPR, vtt, /*noconvert=*/1);
! 	  vtt = build (COND_EXPR, TREE_TYPE (vtt), 
! 		       DECL_USE_VTT_PARM (current_function_decl),
  		       DECL_VTT_PARM (current_function_decl),
  		       vtt);
  	  if (TREE_VIA_VIRTUAL (basebinfo))
--- 4426,4435 ----
  	     or destructor, then we fetch the VTT directly.
  	     Otherwise, we look it up using the VTT we were given.  */
  	  vtt = IDENTIFIER_GLOBAL_VALUE (get_vtt_name (current_class_type));
! 	  vtt = decay_conversion (vtt);
! 	  vtt = build (COND_EXPR, TREE_TYPE (vtt),
! 		       build (EQ_EXPR, boolean_type_node,
! 			      current_in_charge_parm, integer_zero_node),
  		       DECL_VTT_PARM (current_function_decl),
  		       vtt);
  	  if (TREE_VIA_VIRTUAL (basebinfo))
*************** build_new_method_call (instance, name, a
*** 4436,4442 ****
  	  my_friendly_assert (BINFO_SUBVTT_INDEX (basebinfo), 20010110);
  	  sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt,
  			   BINFO_SUBVTT_INDEX (basebinfo));
- 	  sub_vtt = build_indirect_ref (sub_vtt, NULL);
  
  	  args = tree_cons (NULL_TREE, sub_vtt, args);
  	}
--- 4437,4442 ----
Index: cp-tree.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.575
diff -c -p -r1.575 cp-tree.h
*** cp-tree.h	2001/02/14 10:57:58	1.575
--- cp-tree.h	2001/02/16 21:08:41
*************** struct lang_decl
*** 1983,1995 ****
  #define DECL_VTT_PARM(NODE) \
    (DECL_LANG_SPECIFIC (NODE)->u2.vtt_parm)
  
- /* If there's a DECL_VTT_PARM, this is a magic variable that indicates
-    whether or not the VTT parm should be used.  In a subobject
-    constructor, `true' is substituted for this value; in a complete
-    object constructor, `false' is substituted instead.  */
- #define DECL_USE_VTT_PARM(NODE) \
-   (TREE_CHAIN (DECL_VTT_PARM (NODE)))
- 
  /* Non-zero if NODE is a FUNCTION_DECL for which a VTT parameter is
     required.  */
  #define DECL_NEEDS_VTT_PARM_P(NODE)			\
--- 1983,1988 ----
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.438
diff -c -p -r1.438 decl2.c
*** decl2.c	2001/02/14 10:49:26	1.438
--- decl2.c	2001/02/16 21:08:53
*************** maybe_retrofit_in_chrg (fn)
*** 980,988 ****
        DECL_VTT_PARM (fn) = build_artificial_parm (vtt_parm_identifier, 
  						  vtt_parm_type);
        DECL_CONTEXT (DECL_VTT_PARM (fn)) = fn;
-       DECL_USE_VTT_PARM (fn) = build_artificial_parm (NULL_TREE,
- 						      boolean_type_node);
-       DECL_CONTEXT (DECL_USE_VTT_PARM (fn)) = fn;
      }
  }
  
--- 980,985 ----
Index: init.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/init.c,v
retrieving revision 1.234
diff -c -p -r1.234 init.c
*** init.c	2001/02/14 10:57:59	1.234
--- init.c	2001/02/16 21:08:57
*************** expand_virtual_init (binfo, decl)
*** 872,878 ****
  	 the vtt_parm in the case of the non-subobject constructor.  */
        vtbl = build (COND_EXPR, 
  		    TREE_TYPE (vtbl), 
! 		    DECL_USE_VTT_PARM (current_function_decl),
  		    vtbl2, 
  		    vtbl);
      }
--- 872,879 ----
  	 the vtt_parm in the case of the non-subobject constructor.  */
        vtbl = build (COND_EXPR, 
  		    TREE_TYPE (vtbl), 
! 		    build (EQ_EXPR, boolean_type_node,
! 			   current_in_charge_parm, integer_zero_node),
  		    vtbl2, 
  		    vtbl);
      }
Index: optimize.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/optimize.c,v
retrieving revision 1.52
diff -c -p -r1.52 optimize.c
*** optimize.c	2001/02/16 12:46:21	1.52
--- optimize.c	2001/02/16 21:08:58
*************** maybe_clone_body (fn)
*** 990,998 ****
  		  splay_tree_insert (id.decl_map,
  				     (splay_tree_key) DECL_VTT_PARM (fn),
  				     (splay_tree_value) clone_parm);
- 		  splay_tree_insert (id.decl_map,
- 				     (splay_tree_key) DECL_USE_VTT_PARM (fn),
- 				     (splay_tree_value) boolean_true_node);
  		  clone_parm = TREE_CHAIN (clone_parm);
  		}
  	      /* Otherwise, map the VTT parameter to `NULL'.  */
--- 990,995 ----
*************** maybe_clone_body (fn)
*** 1001,1009 ****
  		  splay_tree_insert (id.decl_map,
  				     (splay_tree_key) DECL_VTT_PARM (fn),
  				     (splay_tree_value) null_pointer_node);
- 		  splay_tree_insert (id.decl_map,
- 				     (splay_tree_key) DECL_USE_VTT_PARM (fn),
- 				     (splay_tree_value) boolean_false_node);
  		}
  	    }
  	  /* Map other parameters to their equivalents in the cloned
--- 998,1003 ----

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