This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[c++ patch]: more abi-related simplification
- To: gcc-patches at gcc dot gnu dot org
- Subject: [c++ patch]: more abi-related simplification
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Tue, 24 Jul 2001 13:11:54 +0100
- CC: mark at codesourcery dot com
- Organization: Codesourcery LLC
Mark,
as we no longer have virtual base pointers in the object, we can
do some simplification in class.c.
booted & tested on i686-pc-linux-gnu, ok?
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
2001-07-24 Nathan Sidwell <nathan@codesourcery.com>
* class.c (build_vtbl_or_vbase_field): Remove, move into ...
(create_vtbl_ptr): ... here.
Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.396
diff -c -3 -p -r1.396 class.c
*** class.c 2001/07/21 09:42:17 1.396
--- class.c 2001/07/24 07:54:34
*************** static bool build_base_field PARAMS ((re
*** 146,153 ****
splay_tree, tree));
static bool build_base_fields PARAMS ((record_layout_info, int *,
splay_tree, tree));
- static tree build_vtbl_or_vbase_field PARAMS ((tree, tree, tree, tree, tree,
- int *));
static void check_methods PARAMS ((tree));
static void remove_zero_width_bit_fields PARAMS ((tree));
static void check_bases PARAMS ((tree, int *, int *, int *));
--- 146,151 ----
*************** check_field_decls (t, access_decls, empt
*** 3496,3538 ****
*access_decls = nreverse (*access_decls);
}
- /* Return a FIELD_DECL for a pointer-to-virtual-table or
- pointer-to-virtual-base. The NAME, ASSEMBLER_NAME, and TYPE of the
- field are as indicated. The CLASS_TYPE in which this field occurs
- is also indicated. FCONTEXT is the type that is needed for the debug
- info output routines. *EMPTY_P is set to a non-zero value by this
- function to indicate that a class containing this field is
- non-empty. */
-
- static tree
- build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext,
- empty_p)
- tree name;
- tree assembler_name;
- tree type;
- tree class_type;
- tree fcontext;
- int *empty_p;
- {
- tree field;
-
- /* This class is non-empty. */
- *empty_p = 0;
-
- /* Build the FIELD_DECL. */
- field = build_decl (FIELD_DECL, name, type);
- SET_DECL_ASSEMBLER_NAME (field, assembler_name);
- DECL_VIRTUAL_P (field) = 1;
- DECL_ARTIFICIAL (field) = 1;
- DECL_FIELD_CONTEXT (field) = class_type;
- DECL_FCONTEXT (field) = fcontext;
- DECL_ALIGN (field) = TYPE_ALIGN (type);
- DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (type);
-
- /* Return it. */
- return field;
- }
-
/* If TYPE is an empty class type, records its OFFSET in the table of
OFFSETS. */
--- 3606,3611 ----
*************** create_vtable_ptr (t, empty_p, vfuns_p,
*** 4490,4502 ****
bounds. That's better than using `void*' or some such; it's
cleaner, and it let's the alias analysis code know that these
stores cannot alias stores to void*! */
! TYPE_VFIELD (t)
! = build_vtbl_or_vbase_field (get_vfield_name (t),
! get_identifier (VFIELD_BASE),
! vtbl_ptr_type_node,
! t,
! t,
! empty_p);
if (CLASSTYPE_N_BASECLASSES (t))
/* If there were any baseclasses, they can't possibly be at
--- 4563,4583 ----
bounds. That's better than using `void*' or some such; it's
cleaner, and it let's the alias analysis code know that these
stores cannot alias stores to void*! */
! tree field;
!
! field = build_decl (FIELD_DECL, get_vfield_name (t), vtbl_ptr_type_node);
! SET_DECL_ASSEMBLER_NAME (field, get_identifier (VFIELD_BASE));
! DECL_VIRTUAL_P (field) = 1;
! DECL_ARTIFICIAL (field) = 1;
! DECL_FIELD_CONTEXT (field) = t;
! DECL_FCONTEXT (field) = t;
! DECL_ALIGN (field) = TYPE_ALIGN (vtbl_ptr_type_node);
! DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (vtbl_ptr_type_node);
!
! TYPE_VFIELD (t) = field;
!
! /* This class is non-empty. */
! *empty_p = 0;
if (CLASSTYPE_N_BASECLASSES (t))
/* If there were any baseclasses, they can't possibly be at
*************** create_vtable_ptr (t, empty_p, vfuns_p,
*** 4505,4511 ****
take work. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t) = 1;
! return TYPE_VFIELD (t);
}
return NULL_TREE;
--- 4586,4592 ----
take work. */
TYPE_BASE_CONVS_MAY_REQUIRE_CODE_P (t) = 1;
! return field;
}
return NULL_TREE;