summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorYaxun (Sam) Liu <yaxun.liu@amd.com>2019-10-22 13:41:25 -0400
committerYaxun (Sam) Liu <yaxun.liu@amd.com>2019-10-22 16:06:20 -0400
commit68f5ca4e19c16f12895a6f0b9fbabc1d86c4b6b0 (patch)
treedbbbee3f58bc3c4434dc32b519e06156d94c59a9 /clang/lib/Frontend/CompilerInvocation.cpp
parent4334892e7b077feac3124b789733dbec3380db4c (diff)
downloadbcm5719-llvm-68f5ca4e19c16f12895a6f0b9fbabc1d86c4b6b0.tar.gz
bcm5719-llvm-68f5ca4e19c16f12895a6f0b9fbabc1d86c4b6b0.zip
[HIP] Add option -fgpu-allow-device-init
Add this option to allow device side class type global variables with non-trivial ctor/dtor. device side init/fini functions will be emitted, which will be executed by HIP runtime when the fat binary is loaded/unloaded. This feature is to facilitate implementation of device side sanitizer which requires global vars with non-trival ctors. By default this option is disabled. Differential Revision: https://reviews.llvm.org/D69268
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 665695ec3b1..767a0718b24 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -2528,6 +2528,13 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.CUDADeviceApproxTranscendentals = 1;
Opts.GPURelocatableDeviceCode = Args.hasArg(OPT_fgpu_rdc);
+ if (Args.hasArg(OPT_fgpu_allow_device_init)) {
+ if (Opts.HIP)
+ Opts.GPUAllowDeviceInit = 1;
+ else
+ Diags.Report(diag::warn_ignore_hip_only_option)
+ << Args.getLastArg(OPT_fgpu_allow_device_init)->getAsString(Args);
+ }
Opts.HIPUseNewLaunchAPI = Args.hasArg(OPT_fhip_new_launch_api);
if (Opts.ObjC) {
OpenPOWER on IntegriCloud