Commit 66194a98 by Olivier Hainque Committed by Olivier Hainque

decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro, replacement for…

decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro, replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN.

        * gcc-interface/decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro,
        replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN.
        (gnat_to_gnu_entity) <case ..., E_Procedure>: Use it.

From-SVN: r163641
parent a95054c1
2010-08-30 Olivier Hainque <hainque@adacore.com>
* gcc-interface/decl.c (FOREIGN_FORCE_REALIGN_STACK): New macro,
replacement for FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN.
(gnat_to_gnu_entity) <case ..., E_Procedure>: Use it.
2010-08-21 Eric Botcazou <ebotcazou@adacore.com> 2010-08-21 Eric Botcazou <ebotcazou@adacore.com>
* tracebak.c: Fix typo in comment. * tracebak.c: Fix typo in comment.
......
...@@ -60,27 +60,20 @@ ...@@ -60,27 +60,20 @@
#define Has_Stdcall_Convention(E) (0) #define Has_Stdcall_Convention(E) (0)
#endif #endif
/* Stack realignment for functions with foreign conventions is provided on a /* Stack realignment is necessary for functions with foreign conventions when
per back-end basis now, as it is handled by the prologue expanders and not the ABI doesn't mandate as much as what the compiler assumes - that is, up
as part of the function's body any more. It might be requested by way of a to PREFERRED_STACK_BOUNDARY.
dedicated function type attribute on the targets that support it.
Such realignment can be requested with a dedicated function type attribute
We need a way to avoid setting the attribute on the targets that don't on the targets that support it. We define FOREIGN_FORCE_REALIGN_STACK to
support it and use FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN for this purpose. characterize the situations where the attribute should be set. We rely on
compiler configuration settings for 'main' to decide. */
It is defined on targets where the circuitry is available, and indicates
whether the realignment is needed for 'main'. We use this to decide for #ifdef MAIN_STACK_BOUNDARY
foreign subprograms as well. #define FOREIGN_FORCE_REALIGN_STACK \
(MAIN_STACK_BOUNDARY < PREFERRED_STACK_BOUNDARY)
It is not defined on targets where the circuitry is not implemented, and #else
we just never set the attribute in these cases. #define FOREIGN_FORCE_REALIGN_STACK 0
Whether it is defined on all targets that would need it in theory is
not entirely clear. We currently trust the base GCC settings for this
purpose. */
#ifndef FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
#define FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN 0
#endif #endif
struct incomplete struct incomplete
...@@ -4208,13 +4201,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -4208,13 +4201,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
get_identifier ("stdcall"), NULL_TREE, get_identifier ("stdcall"), NULL_TREE,
gnat_entity); gnat_entity);
/* If we are on a target where stack realignment is needed for 'main' /* If we should request stack realignment for a foreign convention
to honor GCC's implicit expectations (stack alignment greater than subprogram, do so. Note that this applies to task entry points in
what the base ABI guarantees), ensure we do the same for foreign particular. */
convention subprograms as they might be used as callbacks from code if (FOREIGN_FORCE_REALIGN_STACK
breaking such expectations. Note that this applies to task entry
points in particular. */
if (FORCE_PREFERRED_STACK_BOUNDARY_IN_MAIN
&& Has_Foreign_Convention (gnat_entity)) && Has_Foreign_Convention (gnat_entity))
prepend_one_attribute_to prepend_one_attribute_to
(&attr_list, ATTR_MACHINE_ATTRIBUTE, (&attr_list, ATTR_MACHINE_ATTRIBUTE,
......
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