aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.h
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-03-13 09:12:50 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-03-13 09:12:50 +0000
commit9328904cdf4c4f74be2b74f23b959df0b51c7b40 (patch)
tree436a9081b94cbee253bfc1c9b70ba08564ec5627 /gcc/tree.h
parent05e126b36023b1f79a1cbe16a3345200ba13c247 (diff)
downloadgcc-9328904cdf4c4f74be2b74f23b959df0b51c7b40.zip
gcc-9328904cdf4c4f74be2b74f23b959df0b51c7b40.tar.gz
gcc-9328904cdf4c4f74be2b74f23b959df0b51c7b40.tar.bz2
tree.h (record_layout_info_s): New structure.
* tree.h (record_layout_info_s): New structure. (record_layout_info): New type. (new_record_layout_info): New function. (layout_field): Likewise. (finish_record_layout): Likewise. * stor-layout.c (layout_record): Remove. (new_record_layout_info): New function. (layout_field): New function, broken out from layout_record. (finalize_record_size): Likewise. (compute_record_mode): Likewise. (finalize_type_size): New function, broken out from layout_type. (finish_record_layout): Likewise. (layout_type): Use them. From-SVN: r32503
Diffstat (limited to 'gcc/tree.h')
-rw-r--r--gcc/tree.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/gcc/tree.h b/gcc/tree.h
index cfb8e8e..faa4a90 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1776,12 +1776,46 @@ extern tree build_qualified_type PARAMS ((tree, int));
extern tree build_type_copy PARAMS ((tree));
/* Given a ..._TYPE node, calculate the TYPE_SIZE, TYPE_SIZE_UNIT,
- TYPE_ALIGN and TYPE_MODE fields.
- If called more than once on one node, does nothing except
- for the first time. */
+ TYPE_ALIGN and TYPE_MODE fields. If called more than once on one
+ node, does nothing except for the first time. */
extern void layout_type PARAMS ((tree));
+/* These functions allow a front-end to perform a manual layout of a
+ RECORD_TYPE. (For instance, if the placement of subsequent fields
+ depends on the placement of fields so far.) Begin by calling
+ new_record_layout_info. Then, call layout_field for each of the
+ fields. Then, call finish_record_layout. See layout_type for the
+ default way in which these functions are used. */
+
+struct record_layout_info_s
+{
+ /* The RECORD_TYPE that we are laying out. */
+ tree t;
+ /* The size of the record so far, in bits. */
+ unsigned HOST_WIDE_INT const_size;
+ /* The alignment of the record so far, in bits. */
+ unsigned int record_align;
+ /* If the record can have a variable size, then this will be
+ non-NULL, and the total size will be CONST_SIZE + VAR_SIZE. */
+ tree var_size;
+ /* If the record can have a variable size, then this will be the
+ maximum alignment that we know VAR_SIZE has. */
+ unsigned int var_align;
+ /* The static variables (i.e., class variables, as opposed to
+ instance variables) encountered in T. */
+ tree pending_statics;
+ unsigned int unpacked_align;
+ int packed_maybe_necessary;
+};
+
+typedef struct record_layout_info_s *record_layout_info;
+
+extern record_layout_info new_record_layout_info
+ PARAMS ((tree));
+extern void layout_field PARAMS ((record_layout_info, tree));
+extern void finish_record_layout PARAMS ((record_layout_info));
+
/* Given a hashcode and a ..._TYPE node (for which the hashcode was made),
return a canonicalized ..._TYPE node, so that duplicates are not made.
How the hash code is computed is up to the caller, as long as any two