aboutsummaryrefslogtreecommitdiff
path: root/gcc/ch
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-02-29 02:34:48 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-02-28 21:34:48 -0500
commit9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f (patch)
tree9d32681a03d3ca309091c1dee14f1053a1621f84 /gcc/ch
parentc27ba9120aa6d7a4477315f359088ea7e4267bd3 (diff)
downloadgcc-9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f.zip
gcc-9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f.tar.gz
gcc-9df2c88cf7ee9be1a279bf7e1fc032b77d9bb56f.tar.bz2
* Eliminate DECL_FIELD_SIZE.
* builtins.c (built_in_class_names, built_in_names): New variables. * c-decl.c (finish_struct): Set specified size in DECL_SIZE. * expr.c (expand_expr, case COMPONENT_REF): Get field size from DECL_SIZE, not DECL_FIELD_SIZE. * print-tree.c (print_node): Remove code that prints extra blank lines in some cases. Properly handle inline and builtin function cases. * stor-layout.c (layout_decl): Get specified size from DEC_SIZE. * tree.h (built_in_class_named, built_in_names): New declarations. (union tree_decl): Rename internal unions to u1 and u2 and change some of their components. Add new field built_in_class. (DECL_ALIGN, DECL_INCOMING_RTL, DECL_SAVED_INSNS, DECL_FRAME_SIZE): Reflect above changes. (DECL_FUNCTION_CODE, DECL_BUILT_IN_CLASS): Likewise. (DECL_SET_FUNCTION_CODE, DECL_FIELD_SIZE): Deleted. * objc/objc-act.c (objc_copy_list): Use DECL_SIZE, not DECL_FIELD_SIZE. (encode_field_decl): Likewise; also remove obsolete test for bitfield. * ch/ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name. * ch/decl.c (finish_struct): Don't clear DECL_FIELD_SIZE. * ch/typeck.c (make_chill_struct_type): Likewise. (apply_decl_field_layout): General cleanup. Set DECL_SIZE instead of DECL_FIELD_SIZE. * cp/class.c (build_vtbl_or_vbase_field, check_methods): Don't clear DECL_FIELD_SIZE. (check_bitfield_decl, check_field_decls): Set DECL_SIZE, not DECL_FIELD_SIZE. * cp/rtti.c (expand_class_desc): Likewise. * cp/cp-tree.h (DECL_INIT_PRIORITY): Use underlying union name. (THUNK_VCALL_OFFSET): Likewise. (THUNK_DELTA): Reflect changes in ../tree.h. * java/java-tree.h (LABEL_PC): Relect name changes in ../tree.h. (DECL_BIT_INDEX): Use underlying representation. * java/parse.h (DECL_INHERITED_SOURCE_LINE): Likewise. From-SVN: r32249
Diffstat (limited to 'gcc/ch')
-rw-r--r--gcc/ch/ChangeLog8
-rw-r--r--gcc/ch/ch-tree.h2
-rw-r--r--gcc/ch/decl.c13
-rw-r--r--gcc/ch/typeck.c72
4 files changed, 47 insertions, 48 deletions
diff --git a/gcc/ch/ChangeLog b/gcc/ch/ChangeLog
index 35df1ba..e8cfee4 100644
--- a/gcc/ch/ChangeLog
+++ b/gcc/ch/ChangeLog
@@ -1,3 +1,11 @@
+Mon Feb 28 08:12:26 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
+
+ * ch-tree.h (DECL_ACTION_NESTING_LEVEL): Use new tree union name.
+ * decl.c (finish_struct): Don't clear DECL_FIELD_SIZE.
+ * typeck.c (make_chill_struct_type): Likewise.
+ (apply_decl_field_layout): General cleanup.
+ Set DECL_SIZE instead of DECL_FIELD_SIZE.
+
Sun Feb 27 16:40:33 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* actions.c (chill_convert_for_assignment): Don't use size_binop
diff --git a/gcc/ch/ch-tree.h b/gcc/ch/ch-tree.h
index 6e3008c..3aa7415 100644
--- a/gcc/ch/ch-tree.h
+++ b/gcc/ch/ch-tree.h
@@ -88,7 +88,7 @@ extern int action_nesting_level;
#define ELSE_VARIANT_NAME ridpointers[(int) RID_ELSE]
/* For a LABEL_DECL: action_nesting_level of its target. */
-#define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.saved_insns.i)
+#define DECL_ACTION_NESTING_LEVEL(NODE) ((NODE)->decl.u2.i)
#define DECL_OLD_PREFIX(DECL) ((DECL)->decl.initial)
#define DECL_NEW_PREFIX(DECL) ((DECL)->decl.result)
diff --git a/gcc/ch/decl.c b/gcc/ch/decl.c
index ffda9ab..559587b 100644
--- a/gcc/ch/decl.c
+++ b/gcc/ch/decl.c
@@ -4337,18 +4337,9 @@ finish_struct (t, fieldlist)
{
register tree x;
- /* Install struct as DECL_CONTEXT of each field decl.
- Also process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
- Store 0 there, except for ": 0" fields (so we can find them
- and delete them, below). */
-
+ /* Install struct as DECL_CONTEXT of each field decl. */
for (x = fieldlist; x; x = TREE_CHAIN (x))
- {
- DECL_CONTEXT (x) = t;
- DECL_FIELD_SIZE (x) = 0;
- }
+ DECL_CONTEXT (x) = t;
TYPE_FIELDS (t) = fieldlist;
diff --git a/gcc/ch/typeck.c b/gcc/ch/typeck.c
index 8c74896..2fe1af4 100644
--- a/gcc/ch/typeck.c
+++ b/gcc/ch/typeck.c
@@ -2992,16 +2992,12 @@ make_chill_struct_type (fieldlist)
tree fieldlist;
{
tree t, x;
- if (TREE_UNION_ELEM (fieldlist))
- t = make_node (UNION_TYPE);
- else
- t = make_node (RECORD_TYPE);
+
+ t = make_node (TREE_UNION_ELEM (fieldlist) ? UNION_TYPE : RECORD_TYPE);
+
/* Install struct as DECL_CONTEXT of each field decl. */
for (x = fieldlist; x; x = TREE_CHAIN (x))
- {
- DECL_CONTEXT (x) = t;
- DECL_FIELD_SIZE (x) = 0;
- }
+ DECL_CONTEXT (x) = t;
/* Delete all duplicate fields from the fieldlist */
for (x = fieldlist; x && TREE_CHAIN (x);)
@@ -3033,31 +3029,35 @@ make_chill_struct_type (fieldlist)
return t;
}
-/* decl is a FIELD_DECL.
- DECL_INIT (decl) is (NULL_TREE, integer_one_node, integer_zero_node, tree_list),
- meaning (default, pack, nopack, POS (...) ).
+/* DECL is a FIELD_DECL.
+ DECL_INIT (decl) is
+ (NULL_TREE, integer_one_node, integer_zero_node, tree_list)
+ meaning
+ (default, pack, nopack, POS (...) ).
+
The return value is a boolean: 1 if POS specified, 0 if not */
+
static int
apply_chill_field_layout (decl, next_struct_offset)
tree decl;
- int* next_struct_offset;
+ int *next_struct_offset;
{
- tree layout, type, temp, what;
- int word = 0, wordsize, start_bit, offset, length, natural_length;
+ tree layout = DECL_INITIAL (decl);
+ tree type = TREE_TYPE (decl);
+ tree temp, what;
+ HOST_WIDE_INT word = 0;
+ HOST_WIDE_INT wordsize, start_bit, offset, length, natural_length;
int pos_error = 0;
- int is_discrete;
+ int is_discrete = discrete_type_p (type);
- type = TREE_TYPE (decl);
- is_discrete = discrete_type_p (type);
if (is_discrete)
- natural_length = get_type_precision (TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type));
+ natural_length
+ = get_type_precision (TYPE_MIN_VALUE (type), TYPE_MAX_VALUE (type));
else
natural_length = TREE_INT_CST_LOW (TYPE_SIZE (type));
- layout = DECL_INITIAL (decl);
if (layout == integer_zero_node) /* NOPACK */
{
- DECL_PACKED (decl) = 0;
*next_struct_offset += natural_length;
return 0; /* not POS */
}
@@ -3065,14 +3065,14 @@ apply_chill_field_layout (decl, next_struct_offset)
if (layout == integer_one_node) /* PACK */
{
if (is_discrete)
- DECL_BIT_FIELD (decl) = 1;
- else
{
- DECL_BIT_FIELD (decl) = 0;
- DECL_ALIGN (decl) = BITS_PER_UNIT;
+ DECL_BIT_FIELD (decl) = 1;
+ DECL_SIZE (decl) = bitsize_int (natural_length);
}
+ else
+ DECL_ALIGN (decl) = BITS_PER_UNIT;
+
DECL_PACKED (decl) = 1;
- DECL_FIELD_SIZE (decl) = natural_length;
*next_struct_offset += natural_length;
return 0; /* not POS */
}
@@ -3090,7 +3090,7 @@ apply_chill_field_layout (decl, next_struct_offset)
else
{
word = TREE_INT_CST_LOW (TREE_PURPOSE (temp));
- if (word < 0)
+ if (tree_int_cst_sgn (TREE_PURPOSE (temp)) < 0)
{
error ("Starting word in POS must be >= 0");
word = 0;
@@ -3114,7 +3114,7 @@ apply_chill_field_layout (decl, next_struct_offset)
else
{
start_bit = TREE_INT_CST_LOW (TREE_PURPOSE (temp));
- if (start_bit < 0)
+ if (tree_int_cst_sgn (TREE_PURPOSE (temp)) < 0)
{
error ("Starting bit in POS must be >= 0");
start_bit = *next_struct_offset - offset;
@@ -3142,7 +3142,7 @@ apply_chill_field_layout (decl, next_struct_offset)
else
{
length = TREE_INT_CST_LOW (TREE_VALUE (temp));
- if (length <= 0)
+ if (tree_int_cst_sgn (TREE_VALUE (temp)) < 0)
{
error ("Length in POS must be > 0");
length = natural_length;
@@ -3159,7 +3159,8 @@ apply_chill_field_layout (decl, next_struct_offset)
}
else
{
- int end_bit = TREE_INT_CST_LOW (TREE_VALUE (temp));
+ HOST_WIDE_INT end_bit = TREE_INT_CST_LOW (TREE_VALUE (temp));
+
if (end_bit < start_bit)
{
error ("End bit in POS must be >= the start bit");
@@ -3174,6 +3175,7 @@ apply_chill_field_layout (decl, next_struct_offset)
length = end_bit - start_bit + 1;
}
}
+
if (length != natural_length && ! pos_error)
{
sorry ("The length specified on POS must be the natural length of the field type");
@@ -3189,7 +3191,10 @@ apply_chill_field_layout (decl, next_struct_offset)
DECL_PACKED (decl) = 1;
DECL_BIT_FIELD (decl) = is_discrete;
- DECL_FIELD_SIZE (decl) = length;
+
+ if (is_discrete)
+ DECL_SIZE (decl) = bitsize_int (length);
+
*next_struct_offset += natural_length;
return 1; /* was POS */
@@ -3209,12 +3214,7 @@ layout_chill_struct_type (t)
old_momentary = suspend_momentary ();
- /* Process specified field sizes.
- Set DECL_FIELD_SIZE to the specified size, or 0 if none specified.
- The specified size is found in the DECL_INITIAL.
- Store 0 there, except for ": 0" fields (so we can find them
- and delete them, below). */
-
+ /* Process specified field sizes. */
next_struct_offset = 0;
for (x = fieldlist; x; x = TREE_CHAIN (x))
{