This revision was automatically updated to reflect the committed changes. Closed by commit rGcb30ad728f0b: [SYCL] Add support for auxiliary triple specification to Frontend (authored by bader).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D71286/new/ https://reviews.llvm.org/D71286 Files: clang/lib/Frontend/CompilerInstance.cpp clang/lib/Frontend/InitPreprocessor.cpp clang/test/Frontend/sycl-aux-triple.cpp Index: clang/test/Frontend/sycl-aux-triple.cpp =================================================================== --- /dev/null +++ clang/test/Frontend/sycl-aux-triple.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck %s +// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s + +// CHECK-NOT:#define __x86_64__ 1 +// CHECK-SYCL:#define __x86_64__ 1 Index: clang/lib/Frontend/InitPreprocessor.cpp =================================================================== --- clang/lib/Frontend/InitPreprocessor.cpp +++ clang/lib/Frontend/InitPreprocessor.cpp @@ -1124,7 +1124,8 @@ if (InitOpts.UsePredefines) { // FIXME: This will create multiple definitions for most of the predefined // macros. This is not the right way to handle this. - if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo()) + if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) && + PP.getAuxTargetInfo()) InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts, PP.getPreprocessorOpts(), Builder); Index: clang/lib/Frontend/CompilerInstance.cpp =================================================================== --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -917,8 +917,9 @@ if (!hasTarget()) return false; - // Create TargetInfo for the other side of CUDA and OpenMP compilation. - if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) && + // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation. + if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice || + getLangOpts().SYCLIsDevice) && !getFrontendOpts().AuxTriple.empty()) { auto TO = std::make_shared<TargetOptions>(); TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
Index: clang/test/Frontend/sycl-aux-triple.cpp =================================================================== --- /dev/null +++ clang/test/Frontend/sycl-aux-triple.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck %s +// RUN: %clang_cc1 %s -fsycl-is-device -triple spir -aux-triple x86_64-unknown-linux-gnu -E -dM | FileCheck --check-prefix=CHECK-SYCL %s + +// CHECK-NOT:#define __x86_64__ 1 +// CHECK-SYCL:#define __x86_64__ 1 Index: clang/lib/Frontend/InitPreprocessor.cpp =================================================================== --- clang/lib/Frontend/InitPreprocessor.cpp +++ clang/lib/Frontend/InitPreprocessor.cpp @@ -1124,7 +1124,8 @@ if (InitOpts.UsePredefines) { // FIXME: This will create multiple definitions for most of the predefined // macros. This is not the right way to handle this. - if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice) && PP.getAuxTargetInfo()) + if ((LangOpts.CUDA || LangOpts.OpenMPIsDevice || LangOpts.SYCLIsDevice) && + PP.getAuxTargetInfo()) InitializePredefinedMacros(*PP.getAuxTargetInfo(), LangOpts, FEOpts, PP.getPreprocessorOpts(), Builder); Index: clang/lib/Frontend/CompilerInstance.cpp =================================================================== --- clang/lib/Frontend/CompilerInstance.cpp +++ clang/lib/Frontend/CompilerInstance.cpp @@ -917,8 +917,9 @@ if (!hasTarget()) return false; - // Create TargetInfo for the other side of CUDA and OpenMP compilation. - if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice) && + // Create TargetInfo for the other side of CUDA/OpenMP/SYCL compilation. + if ((getLangOpts().CUDA || getLangOpts().OpenMPIsDevice || + getLangOpts().SYCLIsDevice) && !getFrontendOpts().AuxTriple.empty()) { auto TO = std::make_shared<TargetOptions>(); TO->Triple = llvm::Triple::normalize(getFrontendOpts().AuxTriple);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits