aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2020-10-04 18:12:01 -0400
committerJoseph Huber <jhuber6@vols.utk.edu>2020-10-05 11:02:13 -0400
commiteaf73293cb6b8d45dd85ffced57aea7ad4177754 (patch)
tree3fce7dc08303ef47d16fffafa7f9b9830edfb290 /clang/lib/Frontend/CompilerInvocation.cpp
parent34b34e90fc3299debfda4add0e277f59b0a699da (diff)
downloadllvm-eaf73293cb6b8d45dd85ffced57aea7ad4177754.zip
llvm-eaf73293cb6b8d45dd85ffced57aea7ad4177754.tar.gz
llvm-eaf73293cb6b8d45dd85ffced57aea7ad4177754.tar.bz2
[OpenMP] Add Error Handling for Conflicting Pointer Sizes for Target Offload
Summary: This patch adds an error to Clang that detects if OpenMP offloading is used between two architectures with incompatible pointer sizes. This ensures that the data mapping can be done correctly and solves an issue in code generation generating the wrong size pointer. This patch adds a new lit substitution, %omp_powerpc_triple that, if the system is 32-bit or 64-bit, sets the powerpc triple accordingly. This was required to fix some OpenMP tests that automatically populated the target architecture. Reviewers: jdoerfert Subscribers: cfe-commits guansong sstefan1 yaxunl delcypher Tags: OpenMP clang LLVM Differential Revision: https://reviews.llvm.org/D88594
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index b402f53..bbdf0e3 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3206,6 +3206,14 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
TT.getArch() == llvm::Triple::x86 ||
TT.getArch() == llvm::Triple::x86_64))
Diags.Report(diag::err_drv_invalid_omp_target) << A->getValue(i);
+ else if ((T.isArch64Bit() && TT.isArch32Bit()) ||
+ (T.isArch64Bit() && TT.isArch16Bit()) ||
+ (T.isArch32Bit() && TT.isArch64Bit()) ||
+ (T.isArch32Bit() && TT.isArch16Bit()) ||
+ (T.isArch16Bit() && TT.isArch32Bit()) ||
+ (T.isArch16Bit() && TT.isArch64Bit()))
+ Diags.Report(diag::err_drv_incompatible_omp_arch)
+ << A->getValue(i) << T.str();
else
Opts.OMPTargetTriples.push_back(TT);
}