public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITED] ada: Improve CUDA host-side and device-side binder support
@ 2022-09-26  9:15 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-09-26  9:15 UTC (permalink / raw)
  To: gcc-patches; +Cc: Steve Baird

From: Steve Baird <baird@adacore.com>

Binder-generated code is not allowed to use Ada2012 syntax. In order to
specify an aspect, a pragma must be used.

gcc/ada/

	* bindgen.adb: When the binder is invoked for the device, specify
	the CUDA_Global aspect for the adainit and adafinal procedures via
	a pragma instead of via an aspect_specification.
---
 gcc/ada/bindgen.adb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb
index b2fa44d2dff..f2aaa2dea92 100644
--- a/gcc/ada/bindgen.adb
+++ b/gcc/ada/bindgen.adb
@@ -134,9 +134,6 @@ package body Bindgen is
    --  Text for aspect specifications (if any) given as part of the
    --  Adainit and Adafinal spec declarations.
 
-   function Aspect_Text return String is
-     (if Enable_CUDA_Device_Expansion then " with CUDA_Global" else "");
-
    ----------------------------------
    -- Interface_State Pragma Table --
    ----------------------------------
@@ -2644,10 +2641,11 @@ package body Bindgen is
       end if;
 
       WBI ("");
-      WBI ("   procedure " & Ada_Init_Name.all & Aspect_Text & ";");
+      WBI ("   procedure " & Ada_Init_Name.all & ";");
       if Enable_CUDA_Device_Expansion then
          WBI ("   pragma Export (C, " & Ada_Init_Name.all &
                 ", Link_Name => """ & Device_Ada_Init_Link_Name & """);");
+         WBI ("   pragma CUDA_Global (" & Ada_Init_Name.all & ");");
       else
          WBI ("   pragma Export (C, " & Ada_Init_Name.all & ", """ &
               Ada_Init_Name.all & """);");
@@ -2662,11 +2660,12 @@ package body Bindgen is
 
       if not Cumulative_Restrictions.Set (No_Finalization) then
          WBI ("");
-         WBI ("   procedure " & Ada_Final_Name.all & Aspect_Text & ";");
+         WBI ("   procedure " & Ada_Final_Name.all & ";");
 
          if Enable_CUDA_Device_Expansion then
             WBI ("   pragma Export (C, " & Ada_Final_Name.all &
                    ", Link_Name => """ & Device_Ada_Final_Link_Name & """);");
+            WBI ("   pragma CUDA_Global (" & Ada_Final_Name.all & ");");
          else
             WBI ("   pragma Export (C, " & Ada_Final_Name.all & ", """ &
                  Ada_Final_Name.all & """);");
-- 
2.25.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-26  9:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26  9:15 [COMMITED] ada: Improve CUDA host-side and device-side binder support Marc Poulhiès

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).