* [Ada] Move Build_And_Insert_CUDA_Initialization to expansion phase
@ 2021-05-05 8:20 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-05 8:20 UTC (permalink / raw)
To: gcc-patches; +Cc: Ghjuvan Lacambre
[-- Attachment #1: Type: text/plain, Size: 258 bytes --]
This function really had no business being called during analysis.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_ch7.adb (Expand_N_Package_Body): Add CUDA init call.
* sem_ch7.adb (Analyze_Package_Body_Helper): Remove CUDA init
call.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1823 bytes --]
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb
--- a/gcc/ada/exp_ch7.adb
+++ b/gcc/ada/exp_ch7.adb
@@ -43,6 +43,7 @@ with Exp_Prag; use Exp_Prag;
with Exp_Tss; use Exp_Tss;
with Exp_Util; use Exp_Util;
with Freeze; use Freeze;
+with GNAT_CUDA; use GNAT_CUDA;
with Lib; use Lib;
with Nlists; use Nlists;
with Nmake; use Nmake;
@@ -5756,6 +5757,13 @@ package body Exp_Ch7 is
Build_Static_Dispatch_Tables (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);
+
Build_Task_Activation_Call (N);
-- Verify the run-time semantics of pragma Initial_Condition at the
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -40,7 +40,6 @@ 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;
@@ -1000,13 +999,6 @@ 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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-05 8:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-05 8:20 [Ada] Move Build_And_Insert_CUDA_Initialization to expansion phase Pierre-Marie de Rodat
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).