This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Small improvement to function returns
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 7 Apr 2010 12:50:39 +0200
- Subject: [Ada] Small improvement to function returns
The compiler can generate complex code to extract the individual values of the
RETURN structure generated for the Copy-In Copy-Out mechanism, especially on
64-bit platforms.
Fixed thusly, tested on i586-suse-linux, applied on the mainline.
2010-04-07 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Set default
alignment on the RETURN type built for the Copy-In Copy-Out mechanism.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 157983)
+++ gcc-interface/decl.c (working copy)
@@ -4062,6 +4062,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
gcc_assert (TREE_CODE (gnu_return_type) == VOID_TYPE);
gnu_return_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_return_type) = get_identifier ("RETURN");
+ /* Set a default alignment to speed up accesses. */
+ TYPE_ALIGN (gnu_return_type)
+ = get_mode_alignment (ptr_mode);
has_copy_in_out = true;
}