c-common.c (decl_attributes): Set DECL_SIZE_UNIT.

* 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.

From-SVN: r32068
This commit is contained in:
Richard Kenner 2000-02-20 01:11:00 +00:00 committed by Richard Kenner
parent ccd4c273d9
commit 06ceef4e7b
26 changed files with 312 additions and 269 deletions

View File

@ -1,3 +1,58 @@
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.
Fri Feb 18 20:01:58 2000 Jeffrey A Law (law@cygnus.com)
* pa/quadlib.asm (_U_QFgt, _U_Qfge): Fix flags for _U_Qfcmp call.

View File

@ -1,5 +1,6 @@
/* Subroutines shared by all languages that are variants of C.
Copyright (C) 1992, 93-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.
@ -733,7 +734,7 @@ decl_attributes (node, attributes, prefix_attributes)
else
{
TREE_TYPE (decl) = type = typefm;
DECL_SIZE (decl) = 0;
DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0;
layout_decl (decl, 0);
}
}

View File

@ -1,5 +1,6 @@
/* Process declarations and variables for C compiler.
Copyright (C) 1988, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1796,6 +1797,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
{
/* 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)
if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
@ -3477,8 +3479,7 @@ finish_decl (decl, init, asmspec_tree)
if (TREE_CODE (decl) == VAR_DECL)
{
if (DECL_SIZE (decl) == 0
&& TYPE_SIZE (TREE_TYPE (decl)) != 0)
if (DECL_SIZE (decl) == 0 && TYPE_SIZE (TREE_TYPE (decl)) != 0)
layout_decl (decl, 0);
if (DECL_SIZE (decl) == 0
@ -3565,23 +3566,6 @@ finish_decl (decl, init, asmspec_tree)
rest_of_decl_compilation (decl, NULL_PTR, DECL_CONTEXT (decl) == 0, 0);
}
/* 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
computing them in the following function definition. */
@ -5497,6 +5481,7 @@ finish_enum (enumtype, values, attributes)
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);
DECL_INITIAL (enu) = convert (enumtype, DECL_INITIAL (enu));

View File

@ -1,5 +1,6 @@
/* Build expressions with type checking for C compiler.
Copyright (C) 1987, 88, 91-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -3498,43 +3499,6 @@ build_conditional_expr (ifexp, op1, op2)
if (result_type != TREE_TYPE (op2))
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);
@ -5985,6 +5949,7 @@ output_init_element (value, type, field, pending)
{
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);
TREE_INT_CST_HIGH (constructor_bit_index)

View File

@ -1,21 +1,22 @@
/* Process declarations and variables for GNU CHILL compiler.
Copyright (C) 1992, 93, 94, 98, 99, 2000 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
@ -4606,7 +4607,9 @@ layout_enum (enumtype)
for (pair = values; pair; pair = TREE_CHAIN (pair))
{
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);
/* Set the TREE_VALUE to the name, rather than the decl,

View File

@ -1,5 +1,5 @@
/* Name-satisfaction for GNU Chill compiler.
Copyright (C) 1993, 98, 99, 2000 Free Software Foundation, Inc.
Copyright (C) 1993, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -186,6 +186,8 @@ safe_satisfy_decl (decl, prev_chain)
}
/* 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)
{

View File

@ -1,5 +1,6 @@
/* Functions related to building classes and their related objects.
Copyright (C) 1987, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000 Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@ -1068,6 +1069,8 @@ build_primary_vtable (binfo, type)
virtuals = copy_list (BINFO_VIRTUALS (binfo));
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. */
offset = get_derived_offset (TYPE_BINFO (type), NULL_TREE);
@ -2529,14 +2532,16 @@ layout_vtable_decl (binfo, n)
/* We may have to grow the vtable. */
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);
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. (tiemann) */
DECL_ALIGN (BINFO_VTABLE (binfo))
= MAX (TYPE_ALIGN (double_type_node),
DECL_ALIGN (BINFO_VTABLE (binfo)));
fails on Sparc unless you have 8-byte alignment. */
DECL_ALIGN (vtable) = MAX (TYPE_ALIGN (double_type_node),
DECL_ALIGN (vtable));
}
}
@ -4030,7 +4035,8 @@ avoid_overlap (decl, newdecl, empty_p)
field = TREE_CHAIN (field))
;
DECL_SIZE (field) = integer_one_node;
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;
@ -4062,9 +4068,10 @@ build_base_field (t, binfo, empty_p, saw_empty_p, base_align)
DECL_ARTIFICIAL (decl) = 1;
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 && DECL_SIZE (decl) == integer_zero_node)
if (flag_new_abi && integer_zerop (DECL_SIZE (decl)))
{
*saw_empty_p = 1;
return decl;
@ -4085,6 +4092,9 @@ build_base_field (t, binfo, empty_p, saw_empty_p, base_align)
DECL_SIZE (decl)
= 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));
}
return decl;
@ -4156,17 +4166,15 @@ build_base_fields (rec, empty_p)
if (flag_new_abi && saw_empty)
for (decl = base_decls; decl; decl = TREE_CHAIN (decl))
{
if (DECL_SIZE (decl) == integer_zero_node)
if (integer_zerop (DECL_SIZE (decl)))
{
/* First step through the following bases until we find
an overlap or a non-empty base. */
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 (avoid_overlap (decl, nextdecl, empty_p)
|| ! integer_zerop (DECL_SIZE (nextdecl)))
goto nextbase;
/* If we're still looking, also check against the first
field. */
@ -4822,12 +4830,22 @@ layout_class_type (t, empty_p, has_virtual_p,
/* Remember the size and alignment of the class before adding
the virtual bases. */
if (*empty_p && flag_new_abi)
CLASSTYPE_SIZE (t) = integer_zero_node;
{
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 (t) = TYPE_BINFO_SIZE (t);
CLASSTYPE_SIZE_UNIT (t) = TYPE_BINFO_SIZE_UNIT (t);
}
else
CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
{
CLASSTYPE_SIZE (t) = TYPE_SIZE (t);
CLASSTYPE_SIZE_UNIT (t) = TYPE_SIZE_UNIT (t);
}
CLASSTYPE_ALIGN (t) = TYPE_ALIGN (t);
/* Set the TYPE_DECL for this type to contain the right
@ -6217,7 +6235,7 @@ is_empty_class (type)
return 0;
if (flag_new_abi)
return CLASSTYPE_SIZE (type) == integer_zero_node;
return integer_zerop (CLASSTYPE_SIZE (type));
if (TYPE_BINFO_BASETYPES (type))
return 0;

View File

@ -1,6 +1,7 @@
/* Definitions for C++ parsing and type checking.
Copyright (C) 1987, 92-97, 1998, 1999, 2000 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
Copyright (C) 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@ -1358,6 +1359,7 @@ struct lang_type
union tree_node *search_slot;
union tree_node *size;
union tree_node *size_unit;
union tree_node *pure_virtuals;
union tree_node *friend_classes;
@ -1561,6 +1563,7 @@ struct lang_type
/* These are the size, mode and alignment of the type without its
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)
/* A cons list of virtual functions which cannot be inherited by

View File

@ -1,5 +1,6 @@
/* Process declarations and variables for C compiler.
Copyright (C) 1988, 92-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
Contributed by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@ -6295,6 +6296,7 @@ init_decl_processing ()
DECL_NAME (fields[3]) = delta2_identifier;
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];
vtable_entry_type = build_qualified_type (vtable_entry_type,
@ -7108,7 +7110,7 @@ layout_var_decl (decl)
`extern X x' for some incomplete type `X'.) */
if (!DECL_EXTERNAL (decl))
complete_type (type);
if (!DECL_SIZE (decl)&& TYPE_SIZE (type))
if (!DECL_SIZE (decl) && TYPE_SIZE (type))
layout_decl (decl, 0);
if (!DECL_EXTERNAL (decl) && DECL_SIZE (decl) == NULL_TREE)
@ -7868,24 +7870,6 @@ cp_finish_decl (decl, init, asmspec_tree, flags)
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)
TREE_READONLY (decl) = 1;
}

View File

@ -1,24 +1,23 @@
/* Perform optimizations on tree structure.
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Written by Mark Michell (mark@codesourcery.com).
This file is part of GNU CC.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
GNU CC is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA. */
#include "config.h"
#include "system.h"
@ -109,6 +108,7 @@ remap_decl (decl, id)
in which case some fields need to be remapped because they may
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)))
walk_tree (&TYPE_MAX_VALUE (TYPE_DOMAIN (TREE_TYPE (t))),

View File

@ -1,5 +1,6 @@
/* Handle parameterized types (templates) for GNU C++.
Copyright (C) 1992, 93-97, 1998, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
Written by Ken Raeburn (raeburn@cygnus.com) while at Watchmaker Computing.
Rewritten by Jason Merrill (jason@cygnus.com).
@ -5909,7 +5910,7 @@ tsubst_decl (t, args, type, in_decl)
this variable; otherwise we run into circular dependencies. */
DECL_INITIAL (r) = NULL_TREE;
DECL_RTL (r) = 0;
DECL_SIZE (r) = 0;
DECL_SIZE (r) = DECL_SIZE_UNIT (r) = 0;
copy_lang_decl (r);
/* For __PRETTY_FUNCTION__ we have to adjust the initializer. */

View File

@ -1,5 +1,6 @@
/* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 88, 92-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000 Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
This file is part of GNU CC.
@ -845,7 +846,7 @@ make_binfo (offset, binfo, vtable, virtuals)
tree offset, binfo;
tree vtable, virtuals;
{
tree new_binfo = make_tree_vec (7);
tree new_binfo = make_tree_vec (8);
tree type;
if (TREE_CODE (binfo) == TREE_VEC)
@ -1268,6 +1269,7 @@ walk_tree (tp, func, data)
refer to the declaration itself. */
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)));
}
WALK_SUBTREE (TREE_CHAIN (*tp));

View File

@ -1,5 +1,6 @@
/* Output Dwarf2 format symbol table information from the GNU C compiler.
Copyright (C) 1992, 93, 95-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1992, 1993, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
Contributed by Gary Funck (gary@intrepid.com).
Derived from DWARF 1 implementation of Ron Guilmette (rfg@monkeys.com).
Extensively modified by Jason Merrill (jason@cygnus.com).

View File

@ -1,5 +1,6 @@
/* Convert tree expression to rtl instructions, for GNU compiler.
Copyright (C) 1988, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.

View File

@ -1,5 +1,6 @@
/* com.c -- Implementation File (module.c template V1.0)
Copyright (C) 1995-1999 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
Contributed by James Craig Burley.
This file is part of GNU Fortran.
@ -7762,15 +7763,12 @@ ffecom_sym_transform_ (ffesymbol s)
finish_decl (t, initexpr, FALSE);
if ((st != NULL) && (DECL_SIZE (t) != error_mark_node))
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));
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));
}
resume_momentary (yes);
@ -8826,15 +8824,10 @@ ffecom_transform_common_ (ffesymbol s)
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)
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));
}
@ -8966,13 +8959,9 @@ ffecom_transform_equiv_ (ffestorag eqst)
ffestorag_set_init (eqst, ffebld_new_any ());
{
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)
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));
}
@ -9120,7 +9109,7 @@ ffecom_tree_canonize_ptr_ (tree *decl, tree *offset,
case PARM_DECL:
*decl = t;
*offset = bitsize_int (0L, 0L);
*offset = bitsize_int (0);
break;
case ADDR_EXPR:
@ -9128,7 +9117,7 @@ ffecom_tree_canonize_ptr_ (tree *decl, tree *offset,
{
/* A reference to COMMON. */
*decl = TREE_OPERAND (t, 0);
*offset = bitsize_int (0L, 0L);
*offset = bitsize_int (0);
break;
}
/* Fall through. */
@ -9249,7 +9238,7 @@ ffecom_tree_canonize_ref_ (tree *decl, tree *offset,
case VAR_DECL:
case PARM_DECL:
*decl = t;
*offset = bitsize_int (0L, 0L);
*offset = bitsize_int (0);
*size = TYPE_SIZE (TREE_TYPE (t));
return;
@ -13839,6 +13828,7 @@ duplicate_decls (tree newdecl, tree olddecl)
{
/* 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))
DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
@ -14148,23 +14138,6 @@ finish_decl (tree decl, tree init, bool is_top_level)
}
}
/* 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);
}
}
/* If we have gone back from temporary to permanent allocation, actually
free the temporary space that we no longer need. */
if (temporary && !allocation_temporary_p ())

View File

@ -1,5 +1,6 @@
/* Compilation switch flag definitions for GNU CC.
Copyright (C) 1987, 88, 94-98, 1999 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.
@ -122,14 +123,14 @@ extern int warn_template_debugging;
characters. The value N is in `id_clash_len'. */
extern int warn_id_clash;
extern unsigned id_clash_len;
extern int id_clash_len;
/* Nonzero means warn about any objects definitions whose size is larger
than N bytes. Also want about function definitions whose returned
values are larger than N bytes. The value N is in `larger_than_size'. */
extern int warn_larger_than;
extern unsigned larger_than_size;
extern HOST_WIDE_INT larger_than_size;
/* Warn if a function returns an aggregate,
since there are often incompatible calling conventions for doing this. */

View File

@ -1,5 +1,6 @@
/* Fold a constant sub-tree into a single node for C-compiler
Copyright (C) 1987, 88, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1795,16 +1796,16 @@ const_binop (code, arg1, arg2, notrunc)
return 0;
}
/* 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.
/* 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
result will be bitsizetype, othewise it represents a size in bytes and
the type of the result will be sizetype. */
tree
size_int_wide (number, high, bit_p)
unsigned HOST_WIDE_INT number, high;
size_int_wide (number, bit_p)
HOST_WIDE_INT number;
int bit_p;
{
/* Type-size nodes already made for small sizes. */
@ -1819,12 +1820,15 @@ size_int_wide (number, high, bit_p)
init_p = 1;
}
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 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)
{
/* Make this a permanent node. */
@ -1842,7 +1846,7 @@ size_int_wide (number, high, bit_p)
return t;
}
t = build_int_2 (number, high);
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);
return t;
@ -2809,7 +2813,7 @@ make_bit_field_ref (inner, type, bitsize, bitpos, unsignedp)
int unsignedp;
{
tree result = build (BIT_FIELD_REF, type, inner,
size_int (bitsize), bitsize_int (bitpos, 0L));
size_int (bitsize), bitsize_int (bitpos));
TREE_UNSIGNED (result) = unsignedp;

View File

@ -378,6 +378,7 @@ ggc_mark_tree_children (t)
case 'd': /* A decl node. */
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));
ggc_mark_tree (DECL_ARGUMENTS (t));

View File

@ -1,5 +1,5 @@
/* Functions related to building classes and their related objects.
Copyright (C) 1996, 97-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -800,6 +800,7 @@ build_class_ref (type)
push_obstacks (&permanent_obstack, &permanent_obstack);
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;
DECL_IGNORED_P (decl) = 1;
@ -1600,6 +1601,7 @@ push_super_field (this_class, super_class)
TREE_CHAIN (base_decl) = TYPE_FIELDS (this_class);
TYPE_FIELDS (this_class) = base_decl;
DECL_SIZE (base_decl) = TYPE_SIZE (super_class);
DECL_SIZE_UNIT (base_decl) = TYPE_SIZE_UNIT (super_class);
}
/* Handle the different manners we may have to lay out a super class. */

View File

@ -1,5 +1,5 @@
/* Handle the constant pool of the Java(TM) Virtual Machine.
Copyright (C) 1997, 98-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -457,7 +457,8 @@ build_constants_constructor ()
DECL_INITIAL (data_decl) = build (CONSTRUCTOR, TREE_TYPE (data_decl),
NULL_TREE, data_list);
DECL_SIZE (data_decl) = TYPE_SIZE (TREE_TYPE (data_decl));
rest_of_decl_compilation (data_decl, (char*) 0, 1, 0);
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);
tags_type = build_array_type (unsigned_byte_type_node, index_type);

View File

@ -1,5 +1,6 @@
/* Prints out tree in human readable form - GNU C-compiler
Copyright (C) 1990, 91, 93-98, 1999 Free Software Foundation, Inc.
Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.
@ -396,6 +397,8 @@ print_node (file, prefix, node, indent)
DECL_SOURCE_FILE (node), DECL_SOURCE_LINE (node));
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)
fprintf (file, " align %d", DECL_ALIGN (node));
@ -478,6 +481,7 @@ print_node (file, prefix, node, indent)
fprintf (file, " %s", GET_MODE_NAME(mode));
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);
fprintf (file, " align %d", TYPE_ALIGN (node));

View File

@ -1,5 +1,6 @@
/* Output sdb-format symbol table information from GNU compiler.
Copyright (C) 1988, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.

View File

@ -1,5 +1,6 @@
/* C-compiler utilities for types and variables storage layout
Copyright (C) 1987, 88, 92-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1996, 1998,
1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -265,7 +266,10 @@ layout_decl (decl, known_align)
DECL_MODE (decl) = TYPE_MODE (type);
TREE_UNSIGNED (decl) = TREE_UNSIGNED (type);
if (DECL_SIZE (decl) == 0)
DECL_SIZE (decl) = TYPE_SIZE (type);
{
DECL_SIZE (decl) = TYPE_SIZE (type);
DECL_SIZE_UNIT (decl) = TYPE_SIZE_UNIT (type);
}
if (code == FIELD_DECL && DECL_BIT_FIELD (decl))
{
@ -273,8 +277,13 @@ layout_decl (decl, known_align)
abort ();
/* Size is specified in number of bits. */
DECL_SIZE (decl) = bitsize_int (spec_size, 0);
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.
Likewise, if the decl is packed, don't override it. */
@ -308,7 +317,8 @@ layout_decl (decl, known_align)
DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
DECL_ALIGN (decl));
DECL_MODE (decl) = xmode;
DECL_SIZE (decl) = bitsize_int (GET_MODE_BITSIZE (xmode), 0);
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;
}
@ -317,15 +327,38 @@ layout_decl (decl, known_align)
/* Turn off DECL_BIT_FIELD if we won't need it set. */
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_SIZE_UNIT (decl) != 0
&& DECL_ALIGN (decl) >= TYPE_ALIGN (type))
DECL_BIT_FIELD (decl) = 0;
/* Evaluate nonconstant size only once, either now or as soon as safe. */
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);
}
}
}
/* Lay out a RECORD_TYPE type (a C struct).
@ -485,7 +518,7 @@ layout_record (rec)
{
if (const_size > 0)
var_size = size_binop (PLUS_EXPR, var_size,
bitsize_int (const_size, 0L));
bitsize_int (const_size));
const_size = 0;
var_size = round_up (var_size, desired_align);
var_align = MIN (var_align, desired_align);
@ -549,12 +582,12 @@ layout_record (rec)
if (var_size && const_size)
DECL_FIELD_BITPOS (field)
= size_binop (PLUS_EXPR, var_size, bitsize_int (const_size, 0L));
= 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, 0L);
DECL_FIELD_BITPOS (field) = bitsize_int (const_size);
/* If this field ended up more aligned than we thought it
would be (we approximate this by seeing if its position
@ -595,12 +628,12 @@ layout_record (rec)
Round it up to a multiple of the record's alignment. */
if (var_size == NULL_TREE)
TYPE_SIZE (rec) = bitsize_int (const_size, 0L);
TYPE_SIZE (rec) = bitsize_int (const_size);
else
{
if (const_size)
var_size
= size_binop (PLUS_EXPR, var_size, bitsize_int (const_size, 0L));
= size_binop (PLUS_EXPR, var_size, bitsize_int (const_size));
TYPE_SIZE (rec) = var_size;
}
@ -614,7 +647,13 @@ layout_record (rec)
/* Record the un-rounded size in the binfo node. But first we check
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 (rec) = TYPE_SIZE (rec);
TYPE_BINFO_SIZE_UNIT (rec)
= convert (sizetype,
size_binop (FLOOR_DIV_EXPR, TYPE_SIZE (rec),
size_int (BITS_PER_UNIT)));
}
{
tree unpadded_size = TYPE_SIZE (rec);
@ -718,7 +757,7 @@ layout_union (rec)
continue;
layout_decl (field, 0);
DECL_FIELD_BITPOS (field) = bitsize_int (0L, 0L);
DECL_FIELD_BITPOS (field) = bitsize_int (0);
/* Union must be at least as aligned as any field requires. */
@ -749,9 +788,9 @@ layout_union (rec)
var_size = size_binop (MAX_EXPR, var_size, dsize);
}
else if (TREE_CODE (rec) == QUAL_UNION_TYPE)
var_size = fold (build (COND_EXPR, sizetype, DECL_QUALIFIER (field),
var_size = fold (build (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
DECL_SIZE (field),
var_size ? var_size : bitsize_int (0L, 0L)));
var_size ? var_size : bitsize_int (0)));
}
if (TREE_CODE (rec) == QUAL_UNION_TYPE)
@ -759,13 +798,14 @@ layout_union (rec)
/* 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);
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, 0L),
round_up (bitsize_int (const_size),
BITS_PER_UNIT));
/* Determine the desired alignment. */
@ -839,13 +879,13 @@ layout_type (type)
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 (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
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 (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
@ -856,7 +896,7 @@ layout_type (type)
(TREE_CODE (TREE_TYPE (type)) == INTEGER_TYPE
? MODE_COMPLEX_INT : MODE_COMPLEX_FLOAT),
0);
TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)), 0L);
TYPE_SIZE (type) = bitsize_int (GET_MODE_BITSIZE (TYPE_MODE (type)));
TYPE_SIZE_UNIT (type) = size_int (GET_MODE_SIZE (TYPE_MODE (type)));
break;
@ -868,7 +908,7 @@ layout_type (type)
break;
case OFFSET_TYPE:
TYPE_SIZE (type) = bitsize_int (POINTER_SIZE, 0L);
TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
TYPE_MODE (type) = ptr_mode;
break;
@ -876,14 +916,14 @@ layout_type (type)
case FUNCTION_TYPE:
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 (type) = bitsize_int (2 * POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int ((2 * POINTER_SIZE) / BITS_PER_UNIT);
break;
case POINTER_TYPE:
case REFERENCE_TYPE:
TYPE_MODE (type) = ptr_mode;
TYPE_SIZE (type) = bitsize_int (POINTER_SIZE, 0L);
TYPE_SIZE (type) = bitsize_int (POINTER_SIZE);
TYPE_SIZE_UNIT (type) = size_int (POINTER_SIZE / BITS_PER_UNIT);
TREE_UNSIGNED (type) = 1;
TYPE_PRECISION (type) = POINTER_SIZE;
@ -1159,7 +1199,7 @@ layout_type (type)
else
TYPE_MODE (type) = mode_for_size (alignment, MODE_INT, 1);
TYPE_SIZE (type) = bitsize_int (rounded_size, 0L);
TYPE_SIZE (type) = bitsize_int (rounded_size);
TYPE_SIZE_UNIT (type) = size_int (rounded_size / BITS_PER_UNIT);
TYPE_ALIGN (type) = alignment;
TYPE_PRECISION (type) = size_in_bits;

View File

@ -1,5 +1,6 @@
/* Language-independent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 88, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1263,7 +1264,7 @@ get_identifier (text)
/* Decide how much of that length to hash on */
hash_len = len;
if (warn_id_clash && (unsigned)len > id_clash_len)
if (warn_id_clash && len > id_clash_len)
hash_len = id_clash_len;
/* Compute hash code */
@ -1282,7 +1283,7 @@ get_identifier (text)
return idp; /* <-- return if found */
/* Not found; optionally warn about a similar identifier */
if (warn_id_clash && do_identifier_warnings && (unsigned)len >= id_clash_len)
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))
{
@ -1329,7 +1330,7 @@ maybe_get_identifier (text)
/* Decide how much of that length to hash on */
hash_len = len;
if (warn_id_clash && (unsigned)len > id_clash_len)
if (warn_id_clash && len > id_clash_len)
hash_len = id_clash_len;
/* Compute hash code */
@ -2282,12 +2283,15 @@ expr_align (t)
align1 = expr_align (TREE_OPERAND (t, 2));
return MIN (align0, align1);
case FUNCTION_DECL: case LABEL_DECL: case CONST_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;
case FUNCTION_DECL:
return FUNCTION_BOUNDARY;
default:
break;
}

View File

@ -1,5 +1,6 @@
/* Front-end tree definitions for GNU compiler.
Copyright (C) 1989, 93-98, 1999, 2000 Free Software Foundation, Inc.
Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1045,9 +1046,11 @@ struct tree_type
#define BINFO_VPTR_FIELD(NODE) TREE_VEC_ELT ((NODE), 5)
/* The size of a base class subobject of this type. Not all frontends
currently allocate the space for this field. */
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.
For example, if X is derived from Y, and Y is derived from Z,
@ -1113,16 +1116,18 @@ struct tree_type
#define DECL_INITIAL(NODE) (DECL_CHECK (NODE)->decl.initial)
/* 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. */
#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. */
#define DECL_QUALIFIER(NODE) (DECL_CHECK (NODE)->decl.initial)
/* These two fields describe where in the source code the declaration was. */
#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.
/* 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)
/* Holds the machine mode corresponding to the declaration of a variable or
@ -1417,11 +1422,12 @@ struct tree_decl
} f;
} frame_size;
union tree_node *size_unit;
union tree_node *name;
union tree_node *context;
union tree_node *arguments;
union tree_node *result;
union tree_node *initial;
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;
union tree_node *section_name;
@ -1429,6 +1435,7 @@ struct tree_decl
struct rtx_def *rtl; /* acts as link to register transfer language
(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. */
union {
@ -1773,13 +1780,10 @@ extern tree size_in_bytes PARAMS ((tree));
extern HOST_WIDE_INT int_size_in_bytes PARAMS ((tree));
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 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));
extern tree get_pending_sizes PARAMS ((void));

View File

@ -1,5 +1,6 @@
/* Output variables, constants and external declarations, for GNU compiler.
Copyright (C) 1987, 88, 89, 92-99, 2000 Free Software Foundation, Inc.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of GNU CC.
@ -1418,14 +1419,12 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
{
int size;
if (TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
if (TREE_CODE (DECL_SIZE_UNIT (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 = 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))
{
@ -1435,7 +1434,6 @@ assemble_variable (decl, top_level, at_end, dont_output_data)
}
name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
if (TREE_PUBLIC (decl) && DECL_NAME (decl)
&& ! first_global_object_name
&& ! (DECL_COMMON (decl) && (DECL_INITIAL (decl) == 0
@ -4427,21 +4425,10 @@ output_constructor (exp, size)
/* Determine size this element should occupy. */
if (field)
{
if (TREE_CODE (DECL_SIZE (field)) != INTEGER_CST)
if (TREE_CODE (DECL_SIZE_UNIT (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;
}
fieldsize = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field));
}
else
fieldsize = int_size_in_bytes (TREE_TYPE (TREE_TYPE (exp)));