This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Size changes, round 1
- To: gcc-patches at gcc dot gnu dot org
- Subject: Size changes, round 1
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Sat, 19 Feb 00 20:23:40 EST
Since nobody seemed to have any strong opinions on the topic of
TYPE_SIZE_UNIT, I made a first round of changes to clean the code up. I
added a DECL_SIZE_UNIT, BINFO_SIZE_UNIT and CLASSTYPE_SIZE_UNIT, made the
handling of the size_int and bitsize_int macros more consistent, and made a
few related changes in areas affected by the above.
These new fileds do add a small amount of memory usage in tree nodes, but
make the handling of teh two different sizes more consistent.
I committed this change:
Sat Feb 19 18:43:13 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* c-common.c (decl_attributes): Set DECL_SIZE_UNIT.
* c-decl.c (duplicate_decls, finish_enum): Likewise.
(finish_decl): Remove -Wlarger-than code from here.
* flags.h (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
* fold-const.c (size_int_wide): No more HIGH parm; NUMBER is signed.
Clean up checking to see if in table.
(make_bit_field_ref): Remove extra parm to bitsize_int.
* ggc-common.c (ggc_mark_tree_children): Mark DECL_SIZE_UNIT.
* print-tree.c (print_node): Print DECL_SIZE_UNIT and TYPE_SIZE_UNIT.
* stmt.c (expand_decl): Use DECL_SIZE_UNIT for stack checking size
and for computing size of decl.
* stor-layout.c (layout_decl): Set DECL_SIZE_UNIT.
Move -Wlarger-than code to here.
(layout_record): Remove extra arg to bitsize_int.
Set TYPE_BINFO_SIZE_UNIT.
(layout_union): Remove extra arg to bitsize_int.
Use proper type for size of QUAL_UNION.
(layout_type): Remove extra arg to bitsize_int.
* toplev.c (id_clash_len): Now int.
(larger_than_size): Now HOST_WIDE_INT.
(decode_W_option): Clean up id-clash and larger-than- cases.
* tree.c (get_identifier, maybe_get_identifier): Remove unneeded casts.
(expr_align, case FUNCTION_DECL): DECL_ALIGN is not defined.
* tree.h (BINFO_SIZE_UNIT, TYPE_BINFO_SIZE_UNIT, DECL_SIZE_UNIT): New.
(struct tree_decl): New field size_unit.
(size_int_wide): No HIGH operand; NUMBER is now signed.
(size_int_2): Deleted.
(size_int, bitsize_int): Don't use it and rework args.
* varasm.c (assemble_variable, output_constructor): Use DECL_SIZE_UNIT.
* ch/decl.c (layout_enum): Set DECL_SIZE_UNIT.
* ch/satisfy.c (safe_satisfy_decl): Likewise.
* cp/class.c (build_primary_vtable, layout_vtable_decl): Likewise.
(avoid_overlap, build_base_field): Likewise.
(build_base_field, build_base_fields, is_empty_class):
Test DECL_SIZE with integer_zero.
(layout_class_type): Set CLASSTYPE_SIZE_UNIT.
* cp/cp-tree.h (struct lang_type): New field size_unit.
(CLASSTYPE_SIZE_UNIT): New macro.
* cp/decl.c (init_decl_processing): Set DECL_SIZE_UNIT.
(cp_finish_decl): Delete -Wlarger-than processing.
* cp/optimize.c (remap_decl): Walk DECL_SIZE_UNIT.
* cp/pt.c (tsubst_decl): Set DECL_SIZE_UNIT.
* cp/tree.c (make_binfo): binfo vector is one entry longer.
(walk_tree): Walk DECL_SIZE_UNIT.
* f/com.c (ffecom_sym_transform): Use DECL_SIZE_UNIT.
(ffecom_transform_common_, ffecom_transform_equiv_): Likewise.
(duplicate_decls): Likewise.
(ffecom_tree_canonize_ptr_): Delete extra arg to bitsize_int.
(finish_decl): Delete -Wlarger-than processing.
* java/class.c (build_class_ref, push_super_field): Set DECL_SIZE_UNIT.
* java/constants.c (build_constants_constructor): Likewise.
*** c-common.c 2000/02/06 03:40:45 1.92
--- c-common.c 2000/02/19 23:29:05
*************** decl_attributes (node, attributes, prefi
*** 734,738 ****
{
TREE_TYPE (decl) = type = typefm;
! DECL_SIZE (decl) = 0;
layout_decl (decl, 0);
}
--- 735,739 ----
{
TREE_TYPE (decl) = type = typefm;
! DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0;
layout_decl (decl, 0);
}
*** c-decl.c 2000/01/31 03:31:26 1.96
--- c-decl.c 2000/02/19 23:29:11
*************** duplicate_decls (newdecl, olddecl, diffe
*** 1797,1800 ****
--- 1798,1802 ----
/* Since the type is OLDDECL's, make OLDDECL's size go with. */
DECL_SIZE (newdecl) = DECL_SIZE (olddecl);
+ DECL_SIZE_UNIT (newdecl) = DECL_SIZE_UNIT (olddecl);
DECL_MODE (newdecl) = DECL_MODE (olddecl);
if (TREE_CODE (olddecl) != FUNCTION_DECL)
*************** finish_decl (decl, init, asmspec_tree)
*** 3478,3483 ****
if (TREE_CODE (decl) == VAR_DECL)
{
! if (DECL_SIZE (decl) == 0
! && TYPE_SIZE (TREE_TYPE (decl)) != 0)
layout_decl (decl, 0);
--- 3480,3484 ----
if (TREE_CODE (decl) == VAR_DECL)
{
! if (DECL_SIZE (decl) == 0 && TYPE_SIZE (TREE_TYPE (decl)) != 0)
layout_decl (decl, 0);
*************** finish_decl (decl, init, asmspec_tree)
*** 3566,3586 ****
}
- /* If requested, warn about definitions of large data objects. */
-
- if (warn_larger_than
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
- && !DECL_EXTERNAL (decl))
- {
- register tree decl_size = DECL_SIZE (decl);
-
- if (decl_size && TREE_CODE (decl_size) == INTEGER_CST)
- {
- unsigned units = TREE_INT_CST_LOW(decl_size) / BITS_PER_UNIT;
-
- if (units > larger_than_size)
- warning_with_decl (decl, "size of `%s' is %u bytes", units);
- }
- }
-
/* At the end of a declaration, throw away any variable type sizes
of types defined inside that declaration. There is no use
--- 3567,3570 ----
*************** finish_enum (enumtype, values, attribute
*** 5498,5501 ****
--- 5482,5486 ----
TREE_TYPE (enu) = enumtype;
DECL_SIZE (enu) = TYPE_SIZE (enumtype);
+ DECL_SIZE_UNIT (enu) = TYPE_SIZE_UNIT (enumtype);
DECL_ALIGN (enu) = TYPE_ALIGN (enumtype);
DECL_MODE (enu) = TYPE_MODE (enumtype);
*** c-typeck.c 2000/01/26 02:06:18 1.50
--- c-typeck.c 2000/02/19 23:29:17
*************** build_conditional_expr (ifexp, op1, op2)
*** 3499,3539 ****
op2 = convert_and_check (result_type, op2);
- #if 0
- if (code1 == RECORD_TYPE || code1 == UNION_TYPE)
- {
- result_type = TREE_TYPE (op1);
- if (TREE_CONSTANT (ifexp))
- return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
-
- if (TYPE_MODE (result_type) == BLKmode)
- {
- register tree tempvar
- = build_decl (VAR_DECL, NULL_TREE, result_type);
- register tree xop1 = build_modify_expr (tempvar, op1);
- register tree xop2 = build_modify_expr (tempvar, op2);
- register tree result = fold (build (COND_EXPR, result_type,
- ifexp, xop1, xop2));
-
- layout_decl (tempvar, TYPE_ALIGN (result_type));
- /* No way to handle variable-sized objects here.
- I fear that the entire handling of BLKmode conditional exprs
- needs to be redone. */
- if (TREE_CODE (DECL_SIZE (tempvar)) != INTEGER_CST)
- abort ();
- DECL_RTL (tempvar)
- = assign_stack_local (DECL_MODE (tempvar),
- (TREE_INT_CST_LOW (DECL_SIZE (tempvar))
- + BITS_PER_UNIT - 1)
- / BITS_PER_UNIT,
- 0);
-
- TREE_SIDE_EFFECTS (result)
- = TREE_SIDE_EFFECTS (ifexp) | TREE_SIDE_EFFECTS (op1)
- | TREE_SIDE_EFFECTS (op2);
- return build (COMPOUND_EXPR, result_type, result, tempvar);
- }
- }
- #endif /* 0 */
-
if (TREE_CODE (ifexp) == INTEGER_CST)
return pedantic_non_lvalue (integer_zerop (ifexp) ? op2 : op1);
--- 3500,3503 ----
*************** output_init_element (value, type, field,
*** 5986,5989 ****
--- 5950,5954 ----
tree temp = size_binop (PLUS_EXPR, DECL_FIELD_BITPOS (field),
DECL_SIZE (field));
+
TREE_INT_CST_LOW (constructor_bit_index)
= TREE_INT_CST_LOW (temp);
*** flags.h 2000/01/19 09:42:10 1.39
--- flags.h 2000/02/19 23:29:35
*************** extern int warn_template_debugging;
*** 123,127 ****
extern int warn_id_clash;
! extern unsigned id_clash_len;
/* Nonzero means warn about any objects definitions whose size is larger
--- 124,128 ----
extern int warn_id_clash;
! extern int id_clash_len;
/* Nonzero means warn about any objects definitions whose size is larger
*************** extern unsigned id_clash_len;
*** 130,134 ****
extern int warn_larger_than;
! extern unsigned larger_than_size;
/* Warn if a function returns an aggregate,
--- 131,135 ----
extern int warn_larger_than;
! extern HOST_WIDE_INT larger_than_size;
/* Warn if a function returns an aggregate,
*** fold-const.c 2000/02/10 22:05:39 1.103
--- fold-const.c 2000/02/19 23:29:44
*************** const_binop (code, arg1, arg2, notrunc)
*** 1796,1801 ****
}
! /* Return an INTEGER_CST with value whose HOST_BITS_PER_WIDE_INT bits are
! given by HIGH and whose HOST_BITS_PER_WIDE_INT bits are given by NUMBER.
If BIT_P is nonzero, this represents a size in bit and the type of the
--- 1797,1802 ----
}
! /* Return an INTEGER_CST with value whose low-order HOST_BITS_PER_WIDE_INT
! bits are given by NUMBER.
If BIT_P is nonzero, this represents a size in bit and the type of the
*************** const_binop (code, arg1, arg2, notrunc)
*** 1804,1809 ****
tree
! size_int_wide (number, high, bit_p)
! unsigned HOST_WIDE_INT number, high;
int bit_p;
{
--- 1805,1810 ----
tree
! size_int_wide (number, bit_p)
! HOST_WIDE_INT number;
int bit_p;
{
*************** size_int_wide (number, high, bit_p)
*** 1820,1829 ****
}
! if (number < 2*HOST_BITS_PER_WIDE_INT + 1 && high == 0
! && size_table[number][bit_p] != 0)
! return size_table[number][bit_p];
!
! if (number < 2*HOST_BITS_PER_WIDE_INT + 1 && high == 0)
{
if (! ggc_p)
{
--- 1821,1833 ----
}
! /* If this is a positive number that fits in the table we use to hold
! cached entries, see if it is already in the table and put it there
! if not. */
! if (number >= 0
! && number < (int) (sizeof size_table / sizeof size_table[0]) / 2)
{
+ if (size_table[number][bit_p] != 0)
+ return size_table[number][bit_p];
+
if (! ggc_p)
{
*************** size_int_wide (number, high, bit_p)
*** 1843,1847 ****
}
! t = build_int_2 (number, high);
TREE_TYPE (t) = bit_p ? bitsizetype : sizetype;
TREE_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (t) = force_fit_type (t, 0);
--- 1847,1851 ----
}
! t = build_int_2 (number, 0);
TREE_TYPE (t) = bit_p ? bitsizetype : sizetype;
TREE_OVERFLOW (t) = TREE_CONSTANT_OVERFLOW (t) = force_fit_type (t, 0);
*************** make_bit_field_ref (inner, type, bitsize
*** 2810,2814 ****
{
tree result = build (BIT_FIELD_REF, type, inner,
! size_int (bitsize), bitsize_int (bitpos, 0L));
TREE_UNSIGNED (result) = unsignedp;
--- 2814,2818 ----
{
tree result = build (BIT_FIELD_REF, type, inner,
! size_int (bitsize), bitsize_int (bitpos));
TREE_UNSIGNED (result) = unsignedp;
*** ggc-common.c 2000/01/25 10:47:46 1.20
--- ggc-common.c 2000/02/19 23:29:44
*************** ggc_mark_tree_children (t)
*** 379,382 ****
--- 379,383 ----
ggc_mark_string (DECL_SOURCE_FILE (t));
ggc_mark_tree (DECL_SIZE (t));
+ ggc_mark_tree (DECL_SIZE_UNIT (t));
ggc_mark_tree (DECL_NAME (t));
ggc_mark_tree (DECL_CONTEXT (t));
*** print-tree.c 1999/12/05 02:42:10 1.21
--- print-tree.c 2000/02/19 23:29:45
*************** print_node (file, prefix, node, indent)
*** 397,400 ****
--- 398,403 ----
print_node (file, "size", DECL_SIZE (node), indent + 4);
+ print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4);
+
indent_to (file, indent + 3);
if (TREE_CODE (node) != FUNCTION_DECL)
*************** print_node (file, prefix, node, indent)
*** 479,482 ****
--- 482,486 ----
print_node (file, "size", TYPE_SIZE (node), indent + 4);
+ print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4);
indent_to (file, indent + 3);
*** stmt.c 2000/02/17 20:44:22 1.122
--- stmt.c 2000/02/19 23:29:51
*************** expand_decl (decl)
*** 3769,3777 ****
}
! else if (TREE_CODE (DECL_SIZE (decl)) == INTEGER_CST
&& ! (flag_stack_check && ! STACK_CHECK_BUILTIN
! && (TREE_INT_CST_HIGH (DECL_SIZE (decl)) != 0
! || (TREE_INT_CST_LOW (DECL_SIZE (decl))
! > STACK_CHECK_MAX_VAR_SIZE * BITS_PER_UNIT))))
{
/* Variable of fixed size that goes on the stack. */
--- 3770,3778 ----
}
! else if (TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST
&& ! (flag_stack_check && ! STACK_CHECK_BUILTIN
! && (TREE_INT_CST_HIGH (DECL_SIZE_UNIT (decl)) != 0
! || (TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl))
! > STACK_CHECK_MAX_VAR_SIZE))))
{
/* Variable of fixed size that goes on the stack. */
*************** expand_decl (decl)
*** 3843,3850 ****
/* Compute the variable's size, in bytes. */
! size = expand_expr (size_binop (CEIL_DIV_EXPR,
! DECL_SIZE (decl),
! size_int (BITS_PER_UNIT)),
! NULL_RTX, VOIDmode, 0);
free_temp_slots ();
--- 3844,3848 ----
/* Compute the variable's size, in bytes. */
! size = expand_expr (DECL_SIZE_UNIT (decl), NULL_RTX, VOIDmode, 0);
free_temp_slots ();
*** stor-layout.c 2000/02/10 22:05:39 1.45
--- stor-layout.c 2000/02/19 23:29:52
*************** layout_decl (decl, known_align)
*** 266,270 ****
TREE_UNSIGNED (decl) = TREE_UNSIGNED (type);
if (DECL_SIZE (decl) == 0)
! DECL_SIZE (decl) = TYPE_SIZE (type);
if (code == FIELD_DECL && DECL_BIT_FIELD (decl))
--- 267,274 ----
TREE_UNSIGNED (decl) = TREE_UNSIGNED (type);
if (DECL_SIZE (decl) == 0)
! {
! DECL_SIZE (decl) = TYPE_SIZE (type);
! DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (type);
! }
if (code == FIELD_DECL && DECL_BIT_FIELD (decl))
*************** layout_decl (decl, known_align)
*** 274,279 ****
/* Size is specified in number of bits. */
! DECL_SIZE (decl) = bitsize_int (spec_size, 0);
}
/* Force alignment required for the data type.
But if the decl itself wants greater alignment, don't override that.
--- 278,288 ----
/* Size is specified in number of bits. */
! DECL_SIZE (decl) = bitsize_int (spec_size);
! if (spec_size % BITS_PER_UNIT == 0)
! DECL_SIZE_UNIT (decl) = size_int (spec_size / BITS_PER_UNIT);
! else
! DECL_SIZE_UNIT (decl) = 0;
}
+
/* Force alignment required for the data type.
But if the decl itself wants greater alignment, don't override that.
*************** layout_decl (decl, known_align)
*** 309,313 ****
DECL_ALIGN (decl));
DECL_MODE (decl) = xmode;
! DECL_SIZE (decl) = bitsize_int (GET_MODE_BITSIZE (xmode), 0);
/* This no longer needs to be accessed as a bit field. */
DECL_BIT_FIELD (decl) = 0;
--- 318,323 ----
DECL_ALIGN (decl));
DECL_MODE (decl) = xmode;
! DECL_SIZE (decl) = bitsize_int (GET_MODE_BITSIZE (xmode));
! DECL_SIZE_UNIT (decl) = size_int (GET_MODE_SIZE (xmode));
/* This no longer needs to be accessed as a bit field. */
DECL_BIT_FIELD (decl) = 0;
*************** layout_decl (decl, known_align)
*** 318,324 ****
if (DECL_BIT_FIELD (decl) && TYPE_MODE (type) == BLKmode
&& known_align % TYPE_ALIGN (type) == 0
! && DECL_SIZE (decl) != 0
! && (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST
! || (TREE_INT_CST_LOW (DECL_SIZE (decl)) % BITS_PER_UNIT) == 0)
&& DECL_ALIGN (decl) >= TYPE_ALIGN (type))
DECL_BIT_FIELD (decl) = 0;
--- 328,332 ----
if (DECL_BIT_FIELD (decl) && TYPE_MODE (type) == BLKmode
&& known_align % TYPE_ALIGN (type) == 0
! && DECL_SIZE_UNIT (decl) != 0
&& DECL_ALIGN (decl) >= TYPE_ALIGN (type))
DECL_BIT_FIELD (decl) = 0;
*************** layout_decl (decl, known_align)
*** 327,330 ****
--- 335,363 ----
if (DECL_SIZE (decl) != 0 && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
DECL_SIZE (decl) = variable_size (DECL_SIZE (decl));
+ if (DECL_SIZE_UNIT (decl) != 0
+ && TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST)
+ DECL_SIZE_UNIT (decl) = variable_size (DECL_SIZE_UNIT (decl));
+
+ /* If requested, warn about definitions of large data objects. */
+ if (warn_larger_than
+ && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
+ && ! DECL_EXTERNAL (decl))
+ {
+ tree size = DECL_SIZE_UNIT (decl);
+
+ if (size != 0 && TREE_CODE (size) == INTEGER_CST
+ && (TREE_INT_CST_HIGH (size) != 0
+ || TREE_INT_CST_LOW (size) > larger_than_size))
+ {
+ int size_as_int = TREE_INT_CST_LOW (size);
+
+ if (size_as_int == TREE_INT_CST_LOW (size)
+ && TREE_INT_CST_HIGH (size) == 0)
+ warning_with_decl (decl, "size of `%s' is %d bytes", size_as_int);
+ else
+ warning_with_decl (decl, "size of `%s' is larger than %d bytes",
+ larger_than_size);
+ }
+ }
}
*************** layout_record (rec)
*** 486,490 ****
if (const_size > 0)
var_size = size_binop (PLUS_EXPR, var_size,
! bitsize_int (const_size, 0L));
const_size = 0;
var_size = round_up (var_size, desired_align);
--- 519,523 ----
if (const_size > 0)
var_size = size_binop (PLUS_EXPR, var_size,
! bitsize_int (const_size));
const_size = 0;
var_size = round_up (var_size, desired_align);
*************** layout_record (rec)
*** 550,559 ****
if (var_size && const_size)
DECL_FIELD_BITPOS (field)
! = size_binop (PLUS_EXPR, var_size, bitsize_int (const_size, 0L));
else if (var_size)
DECL_FIELD_BITPOS (field) = var_size;
else
{
! DECL_FIELD_BITPOS (field) = bitsize_int (const_size, 0L);
/* If this field ended up more aligned than we thought it
--- 583,592 ----
if (var_size && const_size)
DECL_FIELD_BITPOS (field)
! = size_binop (PLUS_EXPR, var_size, bitsize_int (const_size));
else if (var_size)
DECL_FIELD_BITPOS (field) = var_size;
else
{
! DECL_FIELD_BITPOS (field) = bitsize_int (const_size);
/* If this field ended up more aligned than we thought it
*************** layout_record (rec)
*** 596,605 ****
if (var_size == NULL_TREE)
! TYPE_SIZE (rec) = bitsize_int (const_size, 0L);
else
{
if (const_size)
var_size
! = size_binop (PLUS_EXPR, var_size, bitsize_int (const_size, 0L));
TYPE_SIZE (rec) = var_size;
}
--- 629,638 ----
if (var_size == NULL_TREE)
! TYPE_SIZE (rec) = bitsize_int (const_size);
else
{
if (const_size)
var_size
! = size_binop (PLUS_EXPR, var_size, bitsize_int (const_size));
TYPE_SIZE (rec) = var_size;
}
*************** layout_record (rec)
*** 615,619 ****
the size of TYPE_BINFO to make sure that BINFO_SIZE is available. */
if (TYPE_BINFO (rec) && TREE_VEC_LENGTH (TYPE_BINFO (rec)) > 6)
! TYPE_BINFO_SIZE (rec) = TYPE_SIZE (rec);
{
--- 648,658 ----
the size of TYPE_BINFO to make sure that BINFO_SIZE is available. */
if (TYPE_BINFO (rec) && TREE_VEC_LENGTH (TYPE_BINFO (rec)) > 6)
! {
! TYPE_BINFO_SIZE (rec) = TYPE_SIZE (rec);
! TYPE_BINFO_SIZE_UNIT (rec)
! = convert (sizetype,
! size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (rec),
! size_int (BITS_PER_UNIT)));
! }
{
*************** layout_union (rec)
*** 719,723 ****
layout_decl (field, 0);
! DECL_FIELD_BITPOS (field) = bitsize_int (0L, 0L);
/* Union must be at least as aligned as any field requires. */
--- 758,762 ----
layout_decl (field, 0);
! DECL_FIELD_BITPOS (field) = bitsize_int (0);
/* Union must be at least as aligned as any field requires. */
*************** layout_union (rec)
*** 750,756 ****
}
else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
! var_size = fold (build (COND_EXPR, sizetype, DECL_QUALIFIER (field),
DECL_SIZE (field),
! var_size ? var_size : bitsize_int (0L, 0L)));
}
--- 789,795 ----
}
else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
! var_size = fold (build (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
DECL_SIZE (field),
! var_size ? var_size : bitsize_int (0)));
}
*************** layout_union (rec)
*** 760,770 ****
/* Determine the ultimate size of the union (in bytes). */
if (NULL == var_size)
! TYPE_SIZE (rec) = bitsize_int (CEIL (const_size, BITS_PER_UNIT)
! * BITS_PER_UNIT, 0L);
else if (const_size == 0)
TYPE_SIZE (rec) = var_size;
else
TYPE_SIZE (rec) = size_binop (MAX_EXPR, var_size,
! round_up (bitsize_int (const_size, 0L),
BITS_PER_UNIT));
--- 799,810 ----
/* Determine the ultimate size of the union (in bytes). */
if (NULL == var_size)
! TYPE_SIZE (rec)
! = bitsize_int (CEIL (const_size, BITS_PER_UNIT) * BITS_PER_UNIT);
!
else if (const_size == 0)
TYPE_SIZE (rec) = var_size;
else
TYPE_SIZE (rec) = size_binop (MAX_EXPR, var_size,
! round_up (bitsize_int (const_size),
BITS_PER_UNIT));
*************** layout_type (type)
*** 840,844 ****
TYPE_MODE (type) = smallest_mode_for_size (TYPE_PRECISION (type),
MODE_INT);
! TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)), 0L);
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
--- 880,884 ----
TYPE_MODE (type) = smallest_mode_for_size (TYPE_PRECISION (type),
MODE_INT);
! TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
*************** layout_type (type)
*** 846,850 ****
case REAL_TYPE:
TYPE_MODE (type) = mode_for_size (TYPE_PRECISION (type), MODE_FLOAT, 0);
! TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)), 0L);
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
--- 886,890 ----
case REAL_TYPE:
TYPE_MODE (type) = mode_for_size (TYPE_PRECISION (type), MODE_FLOAT, 0);
! TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
*************** layout_type (type)
*** 857,861 ****
? MODE_COMPLEX_INT : MODE_COMPLEX_FLOAT),
0);
! TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)), 0L);
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
--- 897,901 ----
? MODE_COMPLEX_INT : MODE_COMPLEX_FLOAT),
0);
! TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
*************** layout_type (type)
*** 869,873 ****
case OFFSET_TYPE:
! TYPE_SIZE (type) = bitsize_int (POINTER_SIZE, 0L);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
TYPE_MODE (type) = ptr_mode;
--- 909,913 ----
case OFFSET_TYPE:
! TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
TYPE_MODE (type) = ptr_mode;
*************** layout_type (type)
*** 877,881 ****
case METHOD_TYPE:
TYPE_MODE (type) = mode_for_size (2 * POINTER_SIZE, MODE_INT, 0);
! TYPE_SIZE (type) = bitsize_int (2 * POINTER_SIZE, 0);
TYPE_SIZE_UNIT (type) = size_int ((2 * POINTER_SIZE) / BITS_PER_UNIT);
break;
--- 917,921 ----
case METHOD_TYPE:
TYPE_MODE (type) = mode_for_size (2 * POINTER_SIZE, MODE_INT, 0);
! TYPE_SIZE (type) = bitsize_int (2 * POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int ((2 * POINTER_SIZE) / BITS_PER_UNIT);
break;
*************** layout_type (type)
*** 884,888 ****
case REFERENCE_TYPE:
TYPE_MODE (type) = ptr_mode;
! TYPE_SIZE (type) = bitsize_int (POINTER_SIZE, 0L);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
TREE_UNSIGNED (type) = 1;
--- 924,928 ----
case REFERENCE_TYPE:
TYPE_MODE (type) = ptr_mode;
! TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
TREE_UNSIGNED (type) = 1;
*************** layout_type (type)
*** 1160,1164 ****
TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1);
! TYPE_SIZE (type) = bitsize_int (rounded_size, 0L);
TYPE_SIZE_UNIT (type) = size_int (rounded_size / BITS_PER_UNIT);
TYPE_ALIGN (type) = alignment;
--- 1200,1204 ----
TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1);
! TYPE_SIZE (type) = bitsize_int (rounded_size);
TYPE_SIZE_UNIT (type) = size_int (rounded_size / BITS_PER_UNIT);
TYPE_ALIGN (type) = alignment;
*** toplev.c 2000/02/16 07:54:53 1.290
--- toplev.c 2000/02/19 23:29:56
*************** int warn_cast_align;
*** 1225,1229 ****
int warn_id_clash;
! unsigned id_clash_len;
/* Nonzero means warn about any objects definitions whose size is larger
--- 1226,1230 ----
int warn_id_clash;
! int id_clash_len;
/* Nonzero means warn about any objects definitions whose size is larger
*************** unsigned id_clash_len;
*** 1232,1236 ****
int warn_larger_than;
! unsigned larger_than_size;
/* Nonzero means warn if inline function is too large. */
--- 1233,1237 ----
int warn_larger_than;
! HOST_WIDE_INT larger_than_size;
/* Nonzero means warn if inline function is too large. */
*************** decode_f_option (arg)
*** 4095,4100 ****
align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops);
else if (!strncmp (arg, "align-functions=", 16))
! align_functions =
! read_integral_parameter (arg + 16, arg - 2, align_functions);
else if (!strncmp (arg, "align-jumps=", 12))
align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps);
--- 4096,4101 ----
align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops);
else if (!strncmp (arg, "align-functions=", 16))
! align_functions
! = read_integral_parameter (arg + 16, arg - 2, align_functions);
else if (!strncmp (arg, "align-jumps=", 12))
align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps);
*************** decode_W_option (arg)
*** 4159,4179 ****
if (!strncmp (arg, "id-clash-", 9))
{
! const int id_clash_val = read_integral_parameter (arg + 9, arg - 2, -1);
! if (id_clash_val != -1)
! {
! id_clash_len = id_clash_val;
! warn_id_clash = 1;
! }
}
else if (!strncmp (arg, "larger-than-", 12))
{
! const int larger_than_val =
! read_integral_parameter (arg + 12, arg - 2, -1);
! if (larger_than_val != -1)
! {
! larger_than_size = larger_than_val;
! warn_larger_than = 1;
! }
}
else
--- 4160,4174 ----
if (!strncmp (arg, "id-clash-", 9))
{
! id_clash_len = read_integral_parameter (arg + 9, arg - 2, -1);
! if (id_clash_len != -1)
! warn_id_clash = 1;
}
else if (!strncmp (arg, "larger-than-", 12))
{
! larger_than_size = read_integral_parameter (arg + 12, arg - 2, -1);
!
! if (larger_than_size != -1)
! warn_larger_than = 1;
}
else
*** tree.c 2000/02/18 06:32:01 1.117
--- tree.c 2000/02/19 23:30:02
*************** get_identifier (text)
*** 1264,1268 ****
/* Decide how much of that length to hash on */
hash_len = len;
! if (warn_id_clash && (unsigned)len > id_clash_len)
hash_len = id_clash_len;
--- 1265,1269 ----
/* Decide how much of that length to hash on */
hash_len = len;
! if (warn_id_clash && len > id_clash_len)
hash_len = id_clash_len;
*************** get_identifier (text)
*** 1283,1287 ****
/* Not found; optionally warn about a similar identifier */
! if (warn_id_clash && do_identifier_warnings && (unsigned)len >= id_clash_len)
for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp))
if (!strncmp (IDENTIFIER_POINTER (idp), text, id_clash_len))
--- 1284,1288 ----
/* Not found; optionally warn about a similar identifier */
! if (warn_id_clash && do_identifier_warnings && len >= id_clash_len)
for (idp = hash_table[hi]; idp; idp = TREE_CHAIN (idp))
if (!strncmp (IDENTIFIER_POINTER (idp), text, id_clash_len))
*************** maybe_get_identifier (text)
*** 1330,1334 ****
/* Decide how much of that length to hash on */
hash_len = len;
! if (warn_id_clash && (unsigned)len > id_clash_len)
hash_len = id_clash_len;
--- 1331,1335 ----
/* Decide how much of that length to hash on */
hash_len = len;
! if (warn_id_clash && len > id_clash_len)
hash_len = id_clash_len;
*************** expr_align (t)
*** 2283,2291 ****
return MIN (align0, align1);
! case FUNCTION_DECL: case LABEL_DECL: case CONST_DECL:
case VAR_DECL: case PARM_DECL: case RESULT_DECL:
if (DECL_ALIGN (t) != 0)
return DECL_ALIGN (t);
break;
default:
--- 2284,2295 ----
return MIN (align0, align1);
! case LABEL_DECL: case CONST_DECL:
case VAR_DECL: case PARM_DECL: case RESULT_DECL:
if (DECL_ALIGN (t) != 0)
return DECL_ALIGN (t);
break;
+
+ case FUNCTION_DECL:
+ return FUNCTION_BOUNDARY;
default:
*** tree.h 2000/02/18 06:32:01 1.123
--- tree.h 2000/02/19 23:30:04
*************** struct tree_type
*** 1046,1052 ****
/* The size of a base class subobject of this type. Not all frontends
! currently allocate the space for this field. */
#define BINFO_SIZE(NODE) TREE_VEC_ELT ((NODE), 6)
#define TYPE_BINFO_SIZE(NODE) BINFO_SIZE (TYPE_BINFO (NODE))
/* Slot used to build a chain that represents a use of inheritance.
--- 1047,1055 ----
/* The size of a base class subobject of this type. Not all frontends
! currently allocate the space for these fields. */
#define BINFO_SIZE(NODE) TREE_VEC_ELT ((NODE), 6)
+ #define BINFO_SIZE_UNIT(NODE) TREE_VEC_ELT ((NODE), 7)
#define TYPE_BINFO_SIZE(NODE) BINFO_SIZE (TYPE_BINFO (NODE))
+ #define TYPE_BINFO_SIZE_UNIT(NODE) BINFO_SIZE_UNIT (TYPE_BINFO (NODE))
/* Slot used to build a chain that represents a use of inheritance.
*************** struct tree_type
*** 1114,1118 ****
/* For a PARM_DECL, records the data type used to pass the argument,
which may be different from the type seen in the program. */
! #define DECL_ARG_TYPE(NODE) (DECL_CHECK (NODE)->decl.initial) /* In PARM_DECL. */
/* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
if nonzero, indicates that the field occupies the type. */
--- 1117,1121 ----
/* For a PARM_DECL, records the data type used to pass the argument,
which may be different from the type seen in the program. */
! #define DECL_ARG_TYPE(NODE) (DECL_CHECK (NODE)->decl.initial)
/* For a FIELD_DECL in a QUAL_UNION_TYPE, records the expression, which
if nonzero, indicates that the field occupies the type. */
*************** struct tree_type
*** 1121,1127 ****
#define DECL_SOURCE_FILE(NODE) (DECL_CHECK (NODE)->decl.filename)
#define DECL_SOURCE_LINE(NODE) (DECL_CHECK (NODE)->decl.linenum)
! /* Holds the size of the datum, as a tree expression.
Need not be constant. */
#define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size)
/* Holds the alignment required for the datum. */
#define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.frame_size.u)
--- 1124,1132 ----
#define DECL_SOURCE_FILE(NODE) (DECL_CHECK (NODE)->decl.filename)
#define DECL_SOURCE_LINE(NODE) (DECL_CHECK (NODE)->decl.linenum)
! /* Holds the size of the datum, in bits, as a tree expression.
Need not be constant. */
#define DECL_SIZE(NODE) (DECL_CHECK (NODE)->decl.size)
+ /* Likewise for the size in bytes. */
+ #define DECL_SIZE_UNIT(NODE) (DECL_CHECK (NODE)->decl.size_unit)
/* Holds the alignment required for the datum. */
#define DECL_ALIGN(NODE) (DECL_CHECK (NODE)->decl.frame_size.u)
*************** struct tree_decl
*** 1418,1426 ****
} frame_size;
union tree_node *name;
union tree_node *context;
! union tree_node *arguments;
! union tree_node *result;
! union tree_node *initial;
union tree_node *abstract_origin;
union tree_node *assembler_name;
--- 1423,1432 ----
} frame_size;
+ union tree_node *size_unit;
union tree_node *name;
union tree_node *context;
! union tree_node *arguments; /* Also used for DECL_FIELD_BITPOS */
! union tree_node *result; /* Also used for DECL_BIT_FIELD_TYPE */
! union tree_node *initial; /* Also used for DECL_QUALIFIER */
union tree_node *abstract_origin;
union tree_node *assembler_name;
*************** struct tree_decl
*** 1430,1433 ****
--- 1436,1440 ----
(rtl) info */
struct rtx_def *live_range_rtl;
+
/* For FUNCTION_DECLs: points to insn that constitutes its definition
on the permanent obstack. For FIELD_DECL, this is DECL_FIELD_SIZE. */
*************** extern HOST_WIDE_INT int_size_in_bytes P
*** 1774,1784 ****
extern tree size_binop PARAMS ((enum tree_code, tree, tree));
extern tree ssize_binop PARAMS ((enum tree_code, tree, tree));
! extern tree size_int_wide PARAMS ((unsigned HOST_WIDE_INT,
! unsigned HOST_WIDE_INT, int));
! #define size_int(L) size_int_2 ((L), 0, 0)
! #define bitsize_int(L, H) size_int_2 ((L), (H), 1)
! #define size_int_2(L, H, T) \
! size_int_wide ((unsigned HOST_WIDE_INT) (L), \
! (unsigned HOST_WIDE_INT) (H), (T))
extern tree round_up PARAMS ((tree, int));
--- 1781,1788 ----
extern tree size_binop PARAMS ((enum tree_code, tree, tree));
extern tree ssize_binop PARAMS ((enum tree_code, tree, tree));
! extern tree size_int_wide PARAMS ((HOST_WIDE_INT, int));
!
! #define size_int(L) size_int_wide ((HOST_WIDE_INT) (L), 0)
! #define bitsize_int(L) size_int_wide ((HOST_WIDE_INT) (L), 1)
extern tree round_up PARAMS ((tree, int));
*** varasm.c 2000/02/19 01:26:59 1.98
--- varasm.c 2000/02/19 23:30:10
*************** assemble_variable (decl, top_level, at_e
*** 1419,1430 ****
int size;
! if (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
goto finish;
! /* This is better than explicit arithmetic, since it avoids overflow. */
! size_tree = size_binop (CEIL_DIV_EXPR,
! DECL_SIZE (decl), size_int (BITS_PER_UNIT));
!
size = TREE_INT_CST_LOW (size_tree);
if (TREE_INT_CST_HIGH (size_tree) != 0
|| size != TREE_INT_CST_LOW (size_tree))
--- 1420,1429 ----
int size;
! if (TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST)
goto finish;
! size_tree = DECL_SIZE_UNIT (decl);
size = TREE_INT_CST_LOW (size_tree);
+
if (TREE_INT_CST_HIGH (size_tree) != 0
|| size != TREE_INT_CST_LOW (size_tree))
*************** assemble_variable (decl, top_level, at_e
*** 1436,1440 ****
name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
-
if (TREE_PUBLIC (decl) && DECL_NAME (decl)
&& ! first_global_object_name
--- 1435,1438 ----
*************** output_constructor (exp, size)
*** 4428,4446 ****
if (field)
{
! if (TREE_CODE (DECL_SIZE (field)) != INTEGER_CST)
abort ();
! if (TREE_INT_CST_LOW (DECL_SIZE (field)) > 100000)
! {
! /* This avoids overflow trouble. */
! tree size_tree = size_binop (CEIL_DIV_EXPR,
! DECL_SIZE (field),
! size_int (BITS_PER_UNIT));
! fieldsize = TREE_INT_CST_LOW (size_tree);
! }
! else
! {
! fieldsize = TREE_INT_CST_LOW (DECL_SIZE (field));
! fieldsize = (fieldsize + BITS_PER_UNIT - 1) / BITS_PER_UNIT;
! }
}
else
--- 4426,4433 ----
if (field)
{
! if (TREE_CODE (DECL_SIZE_UNIT (field)) != INTEGER_CST)
abort ();
!
! fieldsize = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field));
}
else
*** ch/decl.c 2000/02/11 15:49:56 1.18
--- ch/decl.c 2000/02/19 23:30:14
*************** layout_enum (enumtype)
*** 4607,4611 ****
--- 4608,4614 ----
{
tree decl = TREE_VALUE (pair);
+
DECL_SIZE (decl) = TYPE_SIZE (enumtype);
+ DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (enumtype);
DECL_ALIGN (decl) = TYPE_ALIGN (enumtype);
*** ch/satisfy.c 2000/02/11 15:48:24 1.11
--- ch/satisfy.c 2000/02/19 23:30:14
*************** safe_satisfy_decl (decl, prev_chain)
*** 187,190 ****
--- 187,192 ----
/* DECL_SIZE is set to prevent re-doing this stuff. */
DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (decl));
+ DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (TREE_TYPE (decl));
+
if (! TREE_CONSTANT (DECL_INITIAL (decl))
&& TREE_CODE (DECL_INITIAL (decl)) != ERROR_MARK)
*** cp/class.c 2000/02/18 06:00:36 1.257
--- cp/class.c 2000/02/19 23:30:25
*************** build_primary_vtable (binfo, type)
*** 1069,1072 ****
--- 1070,1075 ----
TREE_TYPE (decl) = TREE_TYPE (BINFO_VTABLE (binfo));
DECL_SIZE (decl) = TYPE_SIZE (TREE_TYPE (BINFO_VTABLE (binfo)));
+ DECL_SIZE_UNIT (decl)
+ = TYPE_SIZE_UNIT (TREE_TYPE (BINFO_VTABLE (binfo)));
/* Now do rtti stuff. */
*************** layout_vtable_decl (binfo, n)
*** 2530,2541 ****
if (!same_type_p (TREE_TYPE (BINFO_VTABLE (binfo)), atype))
{
! TREE_TYPE (BINFO_VTABLE (binfo)) = atype;
! DECL_SIZE (BINFO_VTABLE (binfo)) = 0;
! layout_decl (BINFO_VTABLE (binfo), 0);
/* At one time the vtable info was grabbed 2 words at a time. This
! fails on sparc unless you have 8-byte alignment. (tiemann) */
! DECL_ALIGN (BINFO_VTABLE (binfo))
! = MAX (TYPE_ALIGN (double_type_node),
! DECL_ALIGN (BINFO_VTABLE (binfo)));
}
}
--- 2533,2546 ----
if (!same_type_p (TREE_TYPE (BINFO_VTABLE (binfo)), atype))
{
! tree vtable = BINFO_VTABLE (binfo);
!
! TREE_TYPE (vtable) = atype;
! DECL_SIZE (vtable) = DECL_SIZE_UNIT (vtable) = 0;
! layout_decl (vtable, 0);
!
/* At one time the vtable info was grabbed 2 words at a time. This
! fails on Sparc unless you have 8-byte alignment. */
! DECL_ALIGN (vtable) = MAX (TYPE_ALIGN (double_type_node),
! DECL_ALIGN (vtable));
}
}
*************** avoid_overlap (decl, newdecl, empty_p)
*** 4031,4035 ****
;
! DECL_SIZE (field) = integer_one_node;
/* The containing class cannot be empty; this field takes up space. */
*empty_p = 0;
--- 4036,4041 ----
;
! DECL_SIZE (field) = bitsize_int (1);
! DECL_SIZE_UNIT (field) = 0;
/* The containing class cannot be empty; this field takes up space. */
*empty_p = 0;
*************** build_base_field (t, binfo, empty_p, saw
*** 4063,4069 ****
DECL_FIELD_CONTEXT (decl) = t;
DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
! if (flag_new_abi && DECL_SIZE (decl) == integer_zero_node)
{
*saw_empty_p = 1;
--- 4069,4076 ----
DECL_FIELD_CONTEXT (decl) = t;
DECL_SIZE (decl) = CLASSTYPE_SIZE (basetype);
+ DECL_SIZE_UNIT (decl) = CLASSTYPE_SIZE_UNIT (basetype);
DECL_ALIGN (decl) = CLASSTYPE_ALIGN (basetype);
! if (flag_new_abi && integer_zerop (DECL_SIZE (decl)))
{
*saw_empty_p = 1;
*************** build_base_field (t, binfo, empty_p, saw
*** 4086,4089 ****
--- 4093,4099 ----
= size_int (MAX (TREE_INT_CST_LOW (DECL_SIZE (decl)),
(int) (*base_align)));
+ DECL_SIZE_UNIT (decl)
+ = size_int (MAX (TREE_INT_CST_LOW (DECL_SIZE_UNIT (decl)),
+ (int) *base_align / BITS_PER_UNIT));
}
*************** build_base_fields (rec, empty_p)
*** 4157,4161 ****
for (decl = base_decls; decl; decl = TREE_CHAIN (decl))
{
! if (DECL_SIZE (decl) == integer_zero_node)
{
/* First step through the following bases until we find
--- 4167,4171 ----
for (decl = base_decls; decl; decl = TREE_CHAIN (decl))
{
! if (integer_zerop (DECL_SIZE (decl)))
{
/* First step through the following bases until we find
*************** build_base_fields (rec, empty_p)
*** 4163,4171 ****
for (nextdecl = TREE_CHAIN (decl); nextdecl;
nextdecl = TREE_CHAIN (nextdecl))
! {
! if (avoid_overlap (decl, nextdecl, empty_p)
! || DECL_SIZE (nextdecl) != integer_zero_node)
! goto nextbase;
! }
/* If we're still looking, also check against the first
--- 4173,4179 ----
for (nextdecl = TREE_CHAIN (decl); nextdecl;
nextdecl = TREE_CHAIN (nextdecl))
! if (avoid_overlap (decl, nextdecl, empty_p)
! || ! integer_zerop (DECL_SIZE (nextdecl)))
! goto nextbase;
/* If we're still looking, also check against the first
*************** layout_class_type (t, empty_p, has_virtu
*** 4823,4832 ****
the virtual bases. */
if (*empty_p && flag_new_abi)
! CLASSTYPE_SIZE (t) = integer_zero_node;
else if (flag_new_abi && TYPE_HAS_COMPLEX_INIT_REF (t)
&& TYPE_HAS_COMPLEX_ASSIGN_REF (t))
! CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t);
else
! CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);
--- 4831,4850 ----
the virtual bases. */
if (*empty_p && flag_new_abi)
! {
! CLASSTYPE_SIZE (t) = bitsize_int (0);
! CLASSTYPE_SIZE_UNIT (t) = size_int (0);
! }
else if (flag_new_abi && TYPE_HAS_COMPLEX_INIT_REF (t)
&& TYPE_HAS_COMPLEX_ASSIGN_REF (t))
! {
! CLASSTYPE_SIZE (t) = TYPE_BINFO_SIZE (t);
! CLASSTYPE_SIZE_UNIT (t) = TYPE_BINFO_SIZE_UNIT (t);
! }
else
! {
! CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
! CLASSTYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (t);
! }
!
CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);
*************** is_empty_class (type)
*** 6218,6222 ****
if (flag_new_abi)
! return CLASSTYPE_SIZE (type) == integer_zero_node;
if (TYPE_BINFO_BASETYPES (type))
--- 6236,6240 ----
if (flag_new_abi)
! return integer_zerop (CLASSTYPE_SIZE (type));
if (TYPE_BINFO_BASETYPES (type))
*** cp/cp-tree.h 2000/02/18 22:42:05 1.403
--- cp/cp-tree.h 2000/02/19 23:30:32
*************** struct lang_type
*** 1359,1362 ****
--- 1360,1364 ----
union tree_node *size;
+ union tree_node *size_unit;
union tree_node *pure_virtuals;
*************** struct lang_type
*** 1562,1565 ****
--- 1564,1568 ----
virtual base classes, for when we use this type as a base itself. */
#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)
*** cp/decl.c 2000/02/18 22:42:05 1.546
--- cp/decl.c 2000/02/19 23:30:47
*************** init_decl_processing ()
*** 6296,6299 ****
--- 6297,6301 ----
DECL_MODE (fields[3]) = TYPE_MODE (delta_type_node);
DECL_SIZE (fields[3]) = TYPE_SIZE (delta_type_node);
+ DECL_SIZE_UNIT (fields[3]) = TYPE_SIZE_UNIT (delta_type_node);
TREE_UNSIGNED (fields[3]) = 0;
TREE_CHAIN (fields[2]) = fields[3];
*************** layout_var_decl (decl)
*** 7109,7113 ****
if (!DECL_EXTERNAL (decl))
complete_type (type);
! if (!DECL_SIZE (decl)&& TYPE_SIZE (type))
layout_decl (decl, 0);
--- 7111,7115 ----
if (!DECL_EXTERNAL (decl))
complete_type (type);
! if (!DECL_SIZE (decl) && TYPE_SIZE (type))
layout_decl (decl, 0);
*************** cp_finish_decl (decl, init, asmspec_tree
*** 7868,7889 ****
finish_end:
-
- /* If requested, warn about definitions of large data objects. */
-
- if (warn_larger_than
- && ! processing_template_decl
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
- && !DECL_EXTERNAL (decl))
- {
- register tree decl_size = DECL_SIZE (decl);
-
- if (decl_size && TREE_CODE (decl_size) == INTEGER_CST)
- {
- unsigned units = TREE_INT_CST_LOW (decl_size) / BITS_PER_UNIT;
-
- if (units > larger_than_size)
- warning_with_decl (decl, "size of `%s' is %u bytes", units);
- }
- }
if (was_readonly)
--- 7870,7873 ----
*** cp/optimize.c 2000/01/28 04:56:59 1.15
--- cp/optimize.c 2000/02/19 23:30:47
*************** remap_decl (decl, id)
*** 110,113 ****
--- 109,113 ----
contain SAVE_EXPRs. */
walk_tree (&DECL_SIZE (t), copy_body_r, id);
+ walk_tree (&DECL_SIZE_UNIT (t), copy_body_r, id);
if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE
&& TYPE_DOMAIN (TREE_TYPE (t)))
*** cp/pt.c 2000/02/16 23:54:23 1.396
--- cp/pt.c 2000/02/19 23:30:55
*************** tsubst_decl (t, args, type, in_decl)
*** 5910,5914 ****
DECL_INITIAL (r) = NULL_TREE;
DECL_RTL (r) = 0;
! DECL_SIZE (r) = 0;
copy_lang_decl (r);
--- 5911,5915 ----
DECL_INITIAL (r) = NULL_TREE;
DECL_RTL (r) = 0;
! DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
copy_lang_decl (r);
*** cp/tree.c 2000/02/16 23:54:23 1.182
--- cp/tree.c 2000/02/19 23:30:57
*************** make_binfo (offset, binfo, vtable, virtu
*** 846,850 ****
tree vtable, virtuals;
{
! tree new_binfo = make_tree_vec (7);
tree type;
--- 847,851 ----
tree vtable, virtuals;
{
! tree new_binfo = make_tree_vec (8);
tree type;
*************** walk_tree (tp, func, data)
*** 1269,1272 ****
--- 1270,1274 ----
WALK_SUBTREE (DECL_INITIAL (DECL_STMT_DECL (*tp)));
WALK_SUBTREE (DECL_SIZE (DECL_STMT_DECL (*tp)));
+ WALK_SUBTREE (DECL_SIZE_UNIT (DECL_STMT_DECL (*tp)));
}
*** f/com.c 2000/02/17 10:06:03 1.75
--- f/com.c 2000/02/19 23:31:10
*************** ffecom_sym_transform_ (ffesymbol s)
*** 7763,7775 ****
finish_decl (t, initexpr, FALSE);
! if ((st != NULL) && (DECL_SIZE (t) != error_mark_node))
{
! tree size_tree;
!
! size_tree = size_binop (CEIL_DIV_EXPR,
! DECL_SIZE (t),
! size_int (BITS_PER_UNIT));
! assert (TREE_INT_CST_HIGH (size_tree) == 0);
! assert (TREE_INT_CST_LOW (size_tree) == ffestorag_size (st));
}
--- 7764,7773 ----
finish_decl (t, initexpr, FALSE);
! if (st != NULL && DECL_SIZE (t) != error_mark_node)
{
! assert (TREE_CODE (DECL_SIZE_UNIT (t)) == INTEGER_CST);
! assert (TREE_INT_CST_HIGH (DECL_SIZE_UNIT (t)) == 0);
! assert (TREE_INT_CST_LOW (DECL_SIZE_UNIT (t))
! == ffestorag_size (st));
}
*************** ffecom_transform_common_ (ffesymbol s)
*** 8827,8839 ****
if (init)
{
! tree size_tree;
!
! assert (DECL_SIZE (cbt) != NULL_TREE);
! assert (TREE_CODE (DECL_SIZE (cbt)) == INTEGER_CST);
! size_tree = size_binop (CEIL_DIV_EXPR,
! DECL_SIZE (cbt),
! size_int (BITS_PER_UNIT));
! assert (TREE_INT_CST_HIGH (size_tree) == 0);
! assert (TREE_INT_CST_LOW (size_tree)
== ffeglobal_common_size (g) + ffeglobal_common_pad (g));
}
--- 8825,8832 ----
if (init)
{
! assert (DECL_SIZE_UNIT (cbt) != NULL_TREE);
! assert (TREE_CODE (DECL_SIZE_UNIT (cbt)) == INTEGER_CST);
! assert (TREE_INT_CST_HIGH (DECL_SIZE_UNIT (cbt)) == 0);
! assert (TREE_INT_CST_LOW (DECL_SIZE_UNIT (cbt))
== ffeglobal_common_size (g) + ffeglobal_common_pad (g));
}
*************** ffecom_transform_equiv_ (ffestorag eqst)
*** 8967,8977 ****
{
! tree size_tree;
!
! size_tree = size_binop (CEIL_DIV_EXPR,
! DECL_SIZE (eqt),
! size_int (BITS_PER_UNIT));
! assert (TREE_INT_CST_HIGH (size_tree) == 0);
! assert (TREE_INT_CST_LOW (size_tree)
== ffestorag_size (eqst) + ffestorag_modulo (eqst));
}
--- 8960,8966 ----
{
! assert (TREE_CODE (DECL_SIZE_UNIT (eqt)) == INTEGER_CST);
! assert (TREE_INT_CST_HIGH (DECL_SIZE_UNIT (eqt)) == 0);
! assert (TREE_INT_CST_LOW (DECL_SIZE_UNIT (eqt))
== ffestorag_size (eqst) + ffestorag_modulo (eqst));
}
*************** ffecom_tree_canonize_ptr_ (tree *decl, t
*** 9121,9125 ****
case PARM_DECL:
*decl = t;
! *offset = bitsize_int (0L, 0L);
break;
--- 9110,9114 ----
case PARM_DECL:
*decl = t;
! *offset = bitsize_int (0);
break;
*************** ffecom_tree_canonize_ptr_ (tree *decl, t
*** 9129,9133 ****
/* A reference to COMMON. */
*decl = TREE_OPERAND (t, 0);
! *offset = bitsize_int (0L, 0L);
break;
}
--- 9118,9122 ----
/* A reference to COMMON. */
*decl = TREE_OPERAND (t, 0);
! *offset = bitsize_int (0);
break;
}
*************** ffecom_tree_canonize_ref_ (tree *decl, t
*** 9250,9254 ****
case PARM_DECL:
*decl = t;
! *offset = bitsize_int (0L, 0L);
*size = TYPE_SIZE (TREE_TYPE (t));
return;
--- 9239,9243 ----
case PARM_DECL:
*decl = t;
! *offset = bitsize_int (0);
*size = TYPE_SIZE (TREE_TYPE (t));
return;
*************** duplicate_decls (tree newdecl, tree oldd
*** 13840,13843 ****
--- 13829,13833 ----
/* Since the type is OLDDECL's, make OLDDECL's size go with. */
DECL_SIZE (newdecl) = DECL_SIZE (olddecl);
+ DECL_SIZE_UNIT (newdecl) = DECL_SIZE_UNIT (olddecl);
if (TREE_CODE (olddecl) != FUNCTION_DECL)
if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
*************** finish_decl (tree decl, tree init, bool
*** 14146,14166 ****
else
DECL_INITIAL (decl) = error_mark_node;
- }
- }
-
- /* If requested, warn about definitions of large data objects. */
-
- if (warn_larger_than
- && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL)
- && !DECL_EXTERNAL (decl))
- {
- register tree decl_size = DECL_SIZE (decl);
-
- if (decl_size && TREE_CODE (decl_size) == INTEGER_CST)
- {
- unsigned units = TREE_INT_CST_LOW (decl_size) / BITS_PER_UNIT;
-
- if (units > larger_than_size)
- warning_with_decl (decl, "size of `%s' is %u bytes", units);
}
}
--- 14136,14139 ----
*** java/class.c 2000/01/21 20:57:00 1.53
--- java/class.c 2000/02/19 23:31:11
*************** build_class_ref (type)
*** 801,804 ****
--- 801,805 ----
decl = build_decl (VAR_DECL, decl_name, class_type_node);
DECL_SIZE (decl) = TYPE_SIZE (class_type_node);
+ DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (class_type_node);
TREE_STATIC (decl) = 1;
TREE_PUBLIC (decl) = 1;
*************** push_super_field (this_class, super_clas
*** 1601,1604 ****
--- 1602,1606 ----
TYPE_FIELDS (this_class) = base_decl;
DECL_SIZE (base_decl) = TYPE_SIZE (super_class);
+ DECL_SIZE_UNIT (base_decl) = TYPE_SIZE_UNIT (super_class);
}
*** java/constants.c 2000/01/21 20:57:00 1.10
--- java/constants.c 2000/02/19 23:31:12
*************** build_constants_constructor ()
*** 458,462 ****
NULL_TREE, data_list);
DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
! rest_of_decl_compilation (data_decl, (char*) 0, 1, 0);
data_value = build_address_of (data_decl);
--- 458,463 ----
NULL_TREE, data_list);
DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
! DECL_SIZE_UNIT (data_decl) = TYPE_SIZE_UNIT (TREE_TYPE (data_decl));
! rest_of_decl_compilation (data_decl, (char *) 0, 1, 0);
data_value = build_address_of (data_decl);