forked from OSchip/llvm-project
[SYCL] Add clang front-end option to enable SYCL device compilation flow.
Patch by Mariya Podchishchaeva <mariya.podchishchaeva@intel.com> llvm-svn: 354773
This commit is contained in:
parent
478cd32bcb
commit
3f62fa69a7
|
@ -217,6 +217,8 @@ LANGOPT(CUDAHostDeviceConstexpr, 1, 1, "treating unattributed constexpr function
|
|||
LANGOPT(CUDADeviceApproxTranscendentals, 1, 0, "using approximate transcendental functions")
|
||||
LANGOPT(GPURelocatableDeviceCode, 1, 0, "generate relocatable device code")
|
||||
|
||||
LANGOPT(SYCLIsDevice , 1, 0, "Generate code for SYCL device")
|
||||
|
||||
LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
|
||||
LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
|
||||
LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
|
||||
|
|
|
@ -836,8 +836,14 @@ def fopenmp_is_device : Flag<["-"], "fopenmp-is-device">,
|
|||
def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
|
||||
HelpText<"Path to the IR file produced by the frontend for the host.">;
|
||||
|
||||
} // let Flags = [CC1Option]
|
||||
//===----------------------------------------------------------------------===//
|
||||
// SYCL Options
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
|
||||
HelpText<"Generate code for SYCL device.">;
|
||||
|
||||
} // let Flags = [CC1Option]
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// cc1as-only Options
|
||||
|
|
|
@ -2879,6 +2879,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
|||
<< Opts.OMPHostIRFile;
|
||||
}
|
||||
|
||||
Opts.SYCLIsDevice = Args.hasArg(options::OPT_fsycl_is_device);
|
||||
|
||||
// Set CUDA mode for OpenMP target NVPTX if specified in options
|
||||
Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && T.isNVPTX() &&
|
||||
Args.hasArg(options::OPT_fopenmp_cuda_mode);
|
||||
|
|
|
@ -1057,6 +1057,12 @@ static void InitializePredefinedMacros(const TargetInfo &TI,
|
|||
Builder.defineMacro("__CLANG_CUDA_APPROX_TRANSCENDENTALS__");
|
||||
}
|
||||
|
||||
// Define a macro indicating that the source file is being compiled with a
|
||||
// SYCL device compiler which doesn't produce host binary.
|
||||
if (LangOpts.SYCLIsDevice) {
|
||||
Builder.defineMacro("__SYCL_DEVICE_ONLY__", "1");
|
||||
}
|
||||
|
||||
// OpenCL definitions.
|
||||
if (LangOpts.OpenCL) {
|
||||
#define OPENCLEXT(Ext) \
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
// RUN: %clang_cc1 %s -E -dM | FileCheck %s
|
||||
// RUN: %clang_cc1 %s -fsycl-is-device -E -dM | FileCheck --check-prefix=CHECK-SYCL %s
|
||||
|
||||
// CHECK-NOT:#define __SYCL_DEVICE_ONLY__ 1
|
||||
// CHECK-SYCL:#define __SYCL_DEVICE_ONLY__ 1
|
Loading…
Reference in New Issue