aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-03-25 16:58:48 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2012-03-25 16:58:48 +0000
commita5695aa2c93dec00bfeb7eed1ff6d62858699ba7 (patch)
tree536edf3d5f2df8ca541b5757200960e4953e5522 /gcc/ada/gcc-interface/utils.c
parentfb88e1dd28570359af09327bb65ac8de5fcc9fe8 (diff)
downloadgcc-a5695aa2c93dec00bfeb7eed1ff6d62858699ba7.zip
gcc-a5695aa2c93dec00bfeb7eed1ff6d62858699ba7.tar.gz
gcc-a5695aa2c93dec00bfeb7eed1ff6d62858699ba7.tar.bz2
utils.c (add_parallel_type): Take a TYPE instead of a DECL and adjust.
* gcc-interface/utils.c (add_parallel_type): Take a TYPE instead of a DECL and adjust. Move around. (has_parallel_type): New predicate. (rest_of_record_type_compilation): Return early if the type already has a parallel type. * gcc-interface/gigi.h (add_parallel_type): Adjust. * gcc-interface/decl.c (gnat_to_gnu_entity): Adjust for above changes. From-SVN: r185779
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c42
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