Commit 03bc9897 by Tristan Gingold Committed by Arnaud Charlet

trans.c (gnat_to_gnu): Remove the padding structure more often.

2007-10-15  Tristan Gingold  <gingold@adacore.com>

	* trans.c (gnat_to_gnu): Remove the padding structure more often.
	This optimize assignment to over-aligned record.

From-SVN: r129339
parent 23d083f2
...@@ -4810,15 +4810,16 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4810,15 +4810,16 @@ gnat_to_gnu (Node_Id gnat_node)
&& !(TREE_CODE (gnu_result_type) == RECORD_TYPE && !(TREE_CODE (gnu_result_type) == RECORD_TYPE
&& TYPE_JUSTIFIED_MODULAR_P (gnu_result_type)))) && TYPE_JUSTIFIED_MODULAR_P (gnu_result_type))))
{ {
/* In this case remove padding only if the inner object is of /* In this case remove padding only if the inner object type is the
self-referential size: in that case it must be an object of same as gnu_result_type or is of self-referential size (in that later
unconstrained type with a default discriminant. In other cases, case it must be an object of unconstrained type with a default
we want to avoid copying too much data. */ discriminant). We want to avoid copying too much data. */
if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE if (TREE_CODE (TREE_TYPE (gnu_result)) == RECORD_TYPE
&& TYPE_IS_PADDING_P (TREE_TYPE (gnu_result)) && TYPE_IS_PADDING_P (TREE_TYPE (gnu_result))
&& CONTAINS_PLACEHOLDER_P (TYPE_SIZE && (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result)))
(TREE_TYPE (TYPE_FIELDS == gnu_result_type
(TREE_TYPE (gnu_result)))))) || CONTAINS_PLACEHOLDER_P (TYPE_SIZE (TREE_TYPE (TYPE_FIELDS
(TREE_TYPE (gnu_result)))))))
gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))), gnu_result = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_result))),
gnu_result); gnu_result);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment