diff options
author | Jakub Jelinek <jakub@redhat.com> | 2000-06-14 07:30:09 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2000-06-14 07:30:09 +0200 |
commit | 11cf4d1831071d23c84e1add8a2d3fbdd360a82e (patch) | |
tree | 48e491d0a3752df2f9332542b6e3fd795956e7c0 /gcc/cp | |
parent | 51d0e20cae600863c06b07134419166632180a80 (diff) | |
download | gcc-11cf4d1831071d23c84e1add8a2d3fbdd360a82e.zip gcc-11cf4d1831071d23c84e1add8a2d3fbdd360a82e.tar.gz gcc-11cf4d1831071d23c84e1add8a2d3fbdd360a82e.tar.bz2 |
tree.h (TYPE_USER_ALIGN, [...]): Define.
* tree.h (TYPE_USER_ALIGN, DECL_USER_ALIGN): Define.
(struct tree_type, struct tree_decl): Add user_align member.
* stor-layout.c (layout_decl): Set DECL_USER_ALIGN.
(place_union_field): If BIGGEST_FIELD_ALIGNMENT is defined
and DECL_USER_ALIGN 0, cap alignment to this value.
(place_field): Likewise.
(finalize_type_size): Set TYPE_USER_ALIGN.
(layout_type): Likewise.
(initialize_sizetypes): Likewise.
* c-common.c (decl_attributes): Set TYPE_USER_ALIGN resp.
DECL_USER_ALIGN to 1.
* c-decl.c (duplicate_decls): Set DECL_USER_ALIGN.
(xfer_tag): Set TYPE_USER_ALIGN.
(finish_struct): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
(finish_enum): Likewise.
* stmt.c (expand_decl): Set DECL_USER_ALIGN.
(expand_anon_union_decl): Likewise.
* tree.c (make_node): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
(build_index_type): Set TYPE_USER_ALIGN.
(build_range_type): Likewise.
(build_common_tree_nodes_2): Likewise.
* tm.texi (BIGGEST_FIELD_ALIGNMENT): Document the changed meaning.
ch/:
* decl.c (init_decl_processing): Set TYPE_USER_ALIGN.
(layout_enum): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
* typeck.c (layout_chill_range_type): Set TYPE_USER_ALIGN.
(apply_chill_field_layout): Set DECL_USER_ALIGN.
(layout_chill_struct_type): Set TYPE_USER_ALIGN.
cp/:
* class.c (build_secondary_vtable): Set DECL_USER_ALIGN.
(check_bitfield_decl, check_field_decl): Likewise.
(build_vtbl_or_vbase_field, build_base_field): Likewise.
(layout_class_type): Set DECL_USER_ALIGN resp. CLASSTYPE_USER_ALIGN.
* decl.c (record_unknown_type): Set TYPE_USER_ALIGN.
(xfer_tag, finish_enum): Likewise.
* decl2.c (finish_builtin_type): Likewise.
* init.c (init_init_processing): Likewise.
* pt.c (instantiate_class_template): Likewise.
* rtti.c (get_tinfo_decl, synthesize_tinfo_fn): Set DECL_USER_ALIGN.
* cp-tree.h (struct lang_type): Add user_align member.
(CLASSTYPE_USER_ALIGN): Define.
f/:
* com.c (ffecom_transform_common_): Set DECL_USER_ALIGN.
(ffecom_transform_equiv_, ffecom_decl_field): Likewise.
(ffecom_init_0): Set DECL_USER_ALIGN resp. TYPE_USER_ALIGN.
(duplicate_decls): Set DECL_USER_ALIGN.
java/:
* typeck.c (build_java_array_type): Set TYPE_USER_ALIGN.
* parse.y (java_complete_class): Set DECL_USER_ALIGN.
* parse.c: Rebuilt.
From-SVN: r34541
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/cp/class.c | 16 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 4 | ||||
-rw-r--r-- | gcc/cp/decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 1 | ||||
-rw-r--r-- | gcc/cp/init.c | 1 | ||||
-rw-r--r-- | gcc/cp/pt.c | 1 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 2 |
8 files changed, 40 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 76bb5ee..ff78949 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,18 @@ +2000-06-13 Jakub Jelinek <jakub@redhat.com> + + * class.c (build_secondary_vtable): Set DECL_USER_ALIGN. + (check_bitfield_decl, check_field_decl): Likewise. + (build_vtbl_or_vbase_field, build_base_field): Likewise. + (layout_class_type): Set DECL_USER_ALIGN resp. CLASSTYPE_USER_ALIGN. + * decl.c (record_unknown_type): Set TYPE_USER_ALIGN. + (xfer_tag, finish_enum): Likewise. + * decl2.c (finish_builtin_type): Likewise. + * init.c (init_init_processing): Likewise. + * pt.c (instantiate_class_template): Likewise. + * rtti.c (get_tinfo_decl, synthesize_tinfo_fn): Set DECL_USER_ALIGN. + * cp-tree.h (struct lang_type): Add user_align member. + (CLASSTYPE_USER_ALIGN): Define. + Tue Jun 13 15:48:03 2000 Maciej W. Rozycki <macro@ds2.pg.gda.pl> * Make-lang.in (c++.install-common): Install g++-cross in diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 4d9d399..5d8390f 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -984,6 +984,7 @@ build_secondary_vtable (binfo, for_type) new_decl = build_vtable (for_type, name, TREE_TYPE (orig_decl)); DECL_ALIGN (new_decl) = DECL_ALIGN (orig_decl); + DECL_USER_ALIGN (new_decl) = DECL_USER_ALIGN (orig_decl); BINFO_VTABLE (binfo) = pushdecl_top_level (new_decl); #ifdef GATHER_STATISTICS @@ -3225,8 +3226,11 @@ check_bitfield_decl (field) #endif #ifdef PCC_BITFIELD_TYPE_MATTERS if (PCC_BITFIELD_TYPE_MATTERS) - DECL_ALIGN (field) = MAX (DECL_ALIGN (field), - TYPE_ALIGN (type)); + { + DECL_ALIGN (field) = MAX (DECL_ALIGN (field), + TYPE_ALIGN (type)); + DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type); + } #endif } } @@ -3236,6 +3240,7 @@ check_bitfield_decl (field) DECL_BIT_FIELD (field) = 0; CLEAR_DECL_C_BIT_FIELD (field); DECL_ALIGN (field) = MAX (DECL_ALIGN (field), TYPE_ALIGN (type)); + DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (type); } } @@ -3326,6 +3331,8 @@ check_field_decl (field, t, cant_have_const_ctor, (DECL_PACKED (field) ? BITS_PER_UNIT : TYPE_ALIGN (TREE_TYPE (field)))); + if (! DECL_PACKED (field)) + DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (TREE_TYPE (field)); } /* Check the data members (both static and non-static), class-scoped @@ -3625,6 +3632,7 @@ build_vtbl_or_vbase_field (name, assembler_name, type, class_type, fcontext, 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; @@ -3844,6 +3852,7 @@ build_base_field (rli, binfo, empty_p, base_align, v) DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype); DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype); DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype); + DECL_USER_ALIGN (decl) = CLASSTYPE_USER_ALIGN (basetype); if (! flag_new_abi) { @@ -4800,6 +4809,7 @@ layout_class_type (t, empty_p, vfuns_p, TYPE_SIZE (integer_type)); DECL_SIZE (field) = TYPE_SIZE (integer_type); DECL_ALIGN (field) = TYPE_ALIGN (integer_type); + DECL_USER_ALIGN (field) = TYPE_USER_ALIGN (integer_type); } else padding = NULL_TREE; @@ -4821,6 +4831,7 @@ layout_class_type (t, empty_p, vfuns_p, DECL_BIT_FIELD (padding_field) = 1; DECL_SIZE (padding_field) = padding; DECL_ALIGN (padding_field) = 1; + DECL_USER_ALIGN (padding_field) = 0; layout_nonempty_base_or_field (rli, padding_field, NULL_TREE, v); } } @@ -4897,6 +4908,7 @@ layout_class_type (t, empty_p, vfuns_p, } CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t); + CLASSTYPE_USER_ALIGN (t) = TYPE_USER_ALIGN (t); /* Set the TYPE_DECL for this type to contain the right value for DECL_OFFSET, so that we can use it as part diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 1b65b6a..8fd8115 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1395,6 +1395,7 @@ struct lang_type unsigned has_abstract_assign_ref : 1; unsigned non_aggregate : 1; unsigned is_partial_instantiation : 1; + unsigned user_align : 1; /* When adding a flag here, consider whether or not it ought to apply to a template instance if it applies to the template. If @@ -1403,7 +1404,7 @@ struct lang_type /* There are some bits left to fill out a 32-bit word. Keep track of this by updating the size of this bitfield whenever you add or remove a flag. */ - unsigned dummy : 9; + unsigned dummy : 8; int vsize; int vfield_parent; @@ -1637,6 +1638,7 @@ struct lang_type #define CLASSTYPE_SIZE(NODE) (TYPE_LANG_SPECIFIC(NODE)->size) #define CLASSTYPE_SIZE_UNIT(NODE) (TYPE_LANG_SPECIFIC(NODE)->size_unit) #define CLASSTYPE_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->align) +#define CLASSTYPE_USER_ALIGN(NODE) (TYPE_LANG_SPECIFIC(NODE)->user_align) /* The alignment of NODE, without its virtual bases, in bytes. */ #define CLASSTYPE_ALIGN_UNIT(NODE) \ diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index d14b824..93e6c3f 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6200,6 +6200,7 @@ record_unknown_type (type, name) TYPE_DECL_SUPPRESS_DEBUG (decl) = 1; TYPE_SIZE (type) = TYPE_SIZE (void_type_node); TYPE_ALIGN (type) = 1; + TYPE_USER_ALIGN (type) = 0; TYPE_MODE (type) = TYPE_MODE (void_type_node); } @@ -12884,6 +12885,7 @@ xref_tag (code_type_node, name, globalize) to avoid crashing if it does not get defined. */ TYPE_MODE (ref) = TYPE_MODE (unsigned_type_node); TYPE_ALIGN (ref) = TYPE_ALIGN (unsigned_type_node); + TYPE_USER_ALIGN (ref) = 0; TREE_UNSIGNED (ref) = 1; TYPE_PRECISION (ref) = TYPE_PRECISION (unsigned_type_node); TYPE_MIN_VALUE (ref) = TYPE_MIN_VALUE (unsigned_type_node); @@ -13297,6 +13299,7 @@ finish_enum (enumtype) TYPE_MODE (tem) = TYPE_MODE (enumtype); TYPE_PRECISION (tem) = TYPE_PRECISION (enumtype); TYPE_ALIGN (tem) = TYPE_ALIGN (enumtype); + TYPE_USER_ALIGN (tem) = TYPE_USER_ALIGN (enumtype); TREE_UNSIGNED (tem) = TREE_UNSIGNED (enumtype); } diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 5c36132..75fed46 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2297,6 +2297,7 @@ finish_builtin_type (type, name, fields, len, align_type) } DECL_FIELD_CONTEXT (fields[i]) = type; TYPE_ALIGN (type) = TYPE_ALIGN (align_type); + TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (align_type); layout_type (type); #if 0 /* not yet, should get fixed properly later */ TYPE_NAME (type) = make_type_decl (get_identifier (name), type); diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 238b7fc..bb07c1b 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -74,6 +74,7 @@ void init_init_processing () /* Use the biggest alignment supported by the target to prevent operator new from returning misaligned pointers. */ TYPE_ALIGN (BI_header_type) = BIGGEST_ALIGNMENT; + TYPE_USER_ALIGN (BI_header_type) = 0; finish_builtin_type (BI_header_type, "__new_cookie", fields, 0, BI_header_type); BI_header_size = size_in_bytes (BI_header_type); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cd584c2..625fc1a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4930,6 +4930,7 @@ instantiate_class_template (type) = TYPE_USES_VIRTUAL_BASECLASSES (pattern); TYPE_PACKED (type) = TYPE_PACKED (pattern); TYPE_ALIGN (type) = TYPE_ALIGN (pattern); + TYPE_USER_ALIGN (type) = TYPE_USER_ALIGN (pattern); TYPE_FOR_JAVA (type) = TYPE_FOR_JAVA (pattern); /* For libjava's JArray<T> */ if (ANON_AGGR_TYPE_P (pattern)) SET_ANON_AGGR_TYPE_P (type); diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 45c4c64..3dd1845 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -438,6 +438,7 @@ get_tinfo_decl (type) DECL_ARTIFICIAL (d) = 1; DECL_ALIGN (d) = TYPE_ALIGN (ptr_type_node); + DECL_USER_ALIGN (d) = 0; TREE_READONLY (d) = 1; TREE_STATIC (d) = 1; DECL_EXTERNAL (d) = 1; @@ -1180,6 +1181,7 @@ synthesize_tinfo_fn (fndecl) DECL_COMMON (tdecl) = 1; TREE_USED (tdecl) = 1; DECL_ALIGN (tdecl) = TYPE_ALIGN (ptr_type_node); + DECL_USER_ALIGN (tdecl) = 0; cp_finish_decl (tdecl, NULL_TREE, NULL_TREE, 0); /* Begin processing the function. */ |