diff options
author | Steve Baird <baird@adacore.com> | 2022-09-12 15:31:19 -0700 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-09-26 11:02:30 +0200 |
commit | 37645e2cd752e2dddcf52d70dc20eadda3e44171 (patch) | |
tree | 9a230bb9fd2405a1dbf5bb037e6667f3dc73acd2 | |
parent | 6b8e3ee10fb7c15a79ebb8739a1fca3b2a62c706 (diff) | |
download | gcc-37645e2cd752e2dddcf52d70dc20eadda3e44171.zip gcc-37645e2cd752e2dddcf52d70dc20eadda3e44171.tar.gz gcc-37645e2cd752e2dddcf52d70dc20eadda3e44171.tar.bz2 |
ada: Improve CUDA host-side and device-side binder support
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.
-rw-r--r-- | gcc/ada/bindgen.adb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index b2fa44d..f2aaa2d 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 & """);"); |