aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch7.adb
diff options
context:
space:
mode:
authorGhjuvan Lacambre <lacambre@adacore.com>2020-01-30 11:47:00 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-10-19 05:53:39 -0400
commitb0a16e6d4c91120dd9a2900da0831e83e65f2046 (patch)
treefddf91c6ac35ddec55df092cb2927cff6a1cc151 /gcc/ada/sem_ch7.adb
parent2bb7741fbeee2f4fd472cd7e9791ae0b54e7a2b4 (diff)
downloadgcc-b0a16e6d4c91120dd9a2900da0831e83e65f2046.zip
gcc-b0a16e6d4c91120dd9a2900da0831e83e65f2046.tar.gz
gcc-b0a16e6d4c91120dd9a2900da0831e83e65f2046.tar.bz2
[Ada] Implement initialization of CUDA runtime
gcc/ada/ * debug.adb: Document -gnatd_c flag as being used for CUDA. * gnat_cuda.ads: New file. * gnat_cuda.adb: New file. * rtsfind.ads: Add Interfaces_C_Strings package and RE_Fatbin_Wrapper, RE_Register_Fat_Binary, RE_Register_Fat_Binary_End, RE_Register_Function, RE_Chars_Ptr, RE_New_Char_Array entities. * rtsfind.adb: Create new Interfaces_C_Descendant subtype, handle it. * sem_ch7.adb (Analyze_Package_Body_Helper): Call CUDA init procedure. * sem_prag.adb (Analyze_Pragma): Call Add_Cuda_Kernel procedure. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add gnat_cuda.o.
Diffstat (limited to 'gcc/ada/sem_ch7.adb')
-rw-r--r--gcc/ada/sem_ch7.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 04ff071..762f0c1 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -40,6 +40,7 @@ with Exp_Dist; use Exp_Dist;
with Exp_Dbug; use Exp_Dbug;
with Freeze; use Freeze;
with Ghost; use Ghost;
+with GNAT_CUDA; use GNAT_CUDA;
with Lib; use Lib;
with Lib.Xref; use Lib.Xref;
with Namet; use Namet;
@@ -999,6 +1000,13 @@ package body Sem_Ch7 is
Analyze_List (Declarations (N));
end if;
+ -- If procedures marked with CUDA_Global have been defined within N, we
+ -- need to register them with the CUDA runtime at program startup. This
+ -- requires multiple declarations and function calls which need to be
+ -- appended to N's declarations.
+
+ Build_And_Insert_CUDA_Initialization (N);
+
HSS := Handled_Statement_Sequence (N);
if Present (HSS) then