* [Ada] improve layout of RETURN type made for CICO mechanism
@ 2011-04-08 20:31 Eric Botcazou
2012-01-27 9:51 ` Eric Botcazou
0 siblings, 1 reply; 2+ messages in thread
From: Eric Botcazou @ 2011-04-08 20:31 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 688 bytes --]
One year ago the compiler (gigi) was changed to align the RETURN structure
generated for the Copy-In Copy-Out mechanism:
http://gcc.gnu.org/ml/gcc-patches/2010-04/msg00256.html
This helps to generate better code, especially on 64-bit platforms. But this
is not sufficient in some cases, i.e. when there are integer and fixed-point
types involved. The attached patch improves the layout of the type.
Tested on i586-suse-linux, applied on the mainline.
2011-04-08 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Set minimum
alignment on fields of the RETURN type built for the Copy-In Copy-Out
mechanism.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 676 bytes --]
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 172166)
+++ gcc-interface/decl.c (working copy)
@@ -4226,6 +4226,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
= create_field_decl (gnu_param_name, gnu_param_type,
gnu_return_type, NULL_TREE, NULL_TREE,
0, 0);
+ /* Set a minimum alignment to speed up accesses. */
+ if (DECL_ALIGN (gnu_field) < TYPE_ALIGN (gnu_return_type))
+ DECL_ALIGN (gnu_field) = TYPE_ALIGN (gnu_return_type);
Sloc_to_locus (Sloc (gnat_param),
&DECL_SOURCE_LOCATION (gnu_field));
DECL_CHAIN (gnu_field) = gnu_field_list;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Ada] improve layout of RETURN type made for CICO mechanism
2011-04-08 20:31 [Ada] improve layout of RETURN type made for CICO mechanism Eric Botcazou
@ 2012-01-27 9:51 ` Eric Botcazou
0 siblings, 0 replies; 2+ messages in thread
From: Eric Botcazou @ 2012-01-27 9:51 UTC (permalink / raw)
To: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 636 bytes --]
> 2011-04-08 Eric Botcazou <ebotcazou@adacore.com>
>
> * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Set minimum
> alignment on fields of the RETURN type built for the Copy-In Copy-Out
> mechanism.
This can be counter-productive, as the RETURN type is bigger and might not fit
in registers anymore. This is visible on both x86-64 and PowerPC.
Tested on i586-suse-linux, applied on the mainline.
2012-01-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Procedure>: Do not set
an alignment on fields of the RETURN type built for the CICO mechanism.
--
Eric Botcazou
[-- Attachment #2: p.diff --]
[-- Type: text/x-diff, Size: 1185 bytes --]
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 183609)
+++ gcc-interface/decl.c (working copy)
@@ -4305,7 +4305,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
gnu_return_type = gnu_new_ret_type;
TYPE_NAME (gnu_return_type) = get_identifier ("RETURN");
- /* Set a default alignment to speed up accesses. */
+ /* Set a default alignment to speed up accesses. But we
+ shouldn't increase the size of the structure too much,
+ lest it doesn't fit in return registers anymore. */
TYPE_ALIGN (gnu_return_type)
= get_mode_alignment (ptr_mode);
}
@@ -4314,9 +4316,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
= create_field_decl (gnu_param_name, gnu_param_type,
gnu_return_type, NULL_TREE, NULL_TREE,
0, 0);
- /* Set a minimum alignment to speed up accesses. */
- if (DECL_ALIGN (gnu_field) < TYPE_ALIGN (gnu_return_type))
- DECL_ALIGN (gnu_field) = TYPE_ALIGN (gnu_return_type);
Sloc_to_locus (Sloc (gnat_param),
&DECL_SOURCE_LOCATION (gnu_field));
DECL_CHAIN (gnu_field) = gnu_field_list;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-27 9:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-08 20:31 [Ada] improve layout of RETURN type made for CICO mechanism Eric Botcazou
2012-01-27 9:51 ` Eric Botcazou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).