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] new-abi rtti


Hi,
I've installed the attached which prevents unneeded emission of type info
objects, and separately makes use of TYPE_POLYMORPHIC_P.

booted and tested on i686-pc-linux-gnu (there should be no change in
old-abi functionality)

nathan
-- 
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-03-23  Nathan Sidwell  <nathan@codesourcery.com>

	* decl.c (vtype_decl_p): Use TYPE_POLYMORPHIC_P.
	
	* rtti.c (get_tinfo_decl): Set comdat linkage on new-abi
	tinfo object.
	(emit_tinfo_decl): Only emit polymorphic tinfo's when emitting
	vtable.

Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.572
diff -c -3 -p -r1.572 decl.c
*** decl.c	2000/03/21 16:12:24	1.572
--- decl.c	2000/03/23 09:01:03
*************** vtype_decl_p (t, data)
*** 1765,1773 ****
       void *data ATTRIBUTE_UNUSED;
  {
    return (TREE_CODE (t) == TYPE_DECL
! 	  && TREE_TYPE (t) != error_mark_node
! 	  && TYPE_LANG_SPECIFIC (TREE_TYPE (t))
! 	  && CLASSTYPE_VSIZE (TREE_TYPE (t)));
  }
  
  /* Return the declarations that are members of the namespace NS.  */
--- 1765,1772 ----
       void *data ATTRIBUTE_UNUSED;
  {
    return (TREE_CODE (t) == TYPE_DECL
! 	  && TREE_CODE (TREE_TYPE (t)) == RECORD_TYPE
! 	  && TYPE_POLYMORPHIC_P (TREE_TYPE (t)));
  }
  
  /* Return the declarations that are members of the namespace NS.  */
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/rtti.c,v
retrieving revision 1.72
diff -c -3 -p -r1.72 rtti.c
*** rtti.c	2000/03/21 16:12:24	1.72
--- rtti.c	2000/03/23 09:01:06
*************** get_tinfo_decl (type)
*** 413,418 ****
--- 413,419 ----
        TREE_STATIC (d) = 1;
        DECL_EXTERNAL (d) = 1;
        TREE_PUBLIC (d) = 1;
+       comdat_linkage (d);
        DECL_ASSEMBLER_NAME (d) = DECL_NAME (d);
        cp_finish_decl (d, NULL_TREE, NULL_TREE, 0);
  
*************** emit_tinfo_decl (decl_ptr, data)
*** 1918,1923 ****
--- 1918,1928 ----
    TREE_TYPE (DECL_NAME (tinfo_decl)) = NULL_TREE;
    
    if (!DECL_NEEDED_P (tinfo_decl))
+     return 0;
+   if (TREE_CODE (tinfo_type) == RECORD_TYPE && TYPE_POLYMORPHIC_P (tinfo_type)
+       && !CLASSTYPE_VTABLE_NEEDS_WRITING (tinfo_type))
+     /* A polymorphic type only needs its type_info emitted when the vtable
+        is.  */
      return 0;
    create_tinfo_types ();
    decl = synthesize_tinfo_var (tinfo_type, DECL_ASSEMBLER_NAME (tinfo_decl));

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