diff options
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 18f9dac..1460a43 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -855,6 +855,29 @@ finish_record_type (tree record_type, tree field_list, int rep_level, rest_of_record_type_compilation (record_type); } +/* Append PARALLEL_TYPE on the chain of parallel types of TYPE. */ + +void +add_parallel_type (tree type, tree parallel_type) +{ + tree decl = TYPE_STUB_DECL (type); + + while (DECL_PARALLEL_TYPE (decl)) + decl = TYPE_STUB_DECL (DECL_PARALLEL_TYPE (decl)); + + SET_DECL_PARALLEL_TYPE (decl, parallel_type); +} + +/* Return true if TYPE has a parallel type. */ + +static bool +has_parallel_type (tree type) +{ + tree decl = TYPE_STUB_DECL (type); + + return DECL_PARALLEL_TYPE (decl) != NULL_TREE; +} + /* Wrap up compilation of RECORD_TYPE, i.e. output all the debug information associated with it. It need not be invoked directly in most cases since finish_record_type takes care of doing so, but this can be necessary if @@ -871,6 +894,10 @@ rest_of_record_type_compilation (tree record_type) if (TYPE_IS_PADDING_P (record_type)) return; + /* If the type already has a parallel type (XVS type), then we're done. */ + if (has_parallel_type (record_type)) + return; + for (field = TYPE_FIELDS (record_type); field; field = DECL_CHAIN (field)) { /* We need to make an XVE/XVU record if any field has variable size, @@ -1054,23 +1081,10 @@ rest_of_record_type_compilation (tree record_type) TYPE_FIELDS (new_record_type) = nreverse (TYPE_FIELDS (new_record_type)); - add_parallel_type (TYPE_STUB_DECL (record_type), new_record_type); + add_parallel_type (record_type, new_record_type); } } -/* Append PARALLEL_TYPE on the chain of parallel types for decl. */ - -void -add_parallel_type (tree decl, tree parallel_type) -{ - tree d = decl; - - while (DECL_PARALLEL_TYPE (d)) - d = TYPE_STUB_DECL (DECL_PARALLEL_TYPE (d)); - - SET_DECL_PARALLEL_TYPE (d, parallel_type); -} - /* Utility function of above to merge LAST_SIZE, the previous size of a record with FIRST_BIT and SIZE that describe a field. SPECIAL is true if this represents a QUAL_UNION_TYPE in which case we must look for COND_EXPRs and |