diff options
author | Samuel Antao <sfantao@us.ibm.com> | 2016-02-08 15:59:20 +0000 |
---|---|---|
committer | Samuel Antao <sfantao@us.ibm.com> | 2016-02-08 15:59:20 +0000 |
commit | 45bfe4cc8a07cec3c635da9355c30537f2bfde3b (patch) | |
tree | 4b6122771ab9b7c457112788738017eb6734c2c6 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 7a7614757c7b05eaa341d5156f1b275c85532bbb (diff) | |
download | bcm5719-llvm-45bfe4cc8a07cec3c635da9355c30537f2bfde3b.tar.gz bcm5719-llvm-45bfe4cc8a07cec3c635da9355c30537f2bfde3b.zip |
Re-apply for the 2nd-time r259977 - [OpenMP] Reorganize code to allow specialized code generation for different devices.
This was reverted by r260036, but was not the cause of the problem in the buildbot.
llvm-svn: 260106
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 2403385ca4a..2b191ca8dc3 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -1446,6 +1446,7 @@ static Visibility parseVisibility(Arg *arg, ArgList &args, } static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, + const TargetOptions &TargetOpts, DiagnosticsEngine &Diags) { // FIXME: Cleanup per-file based stuff. LangStandard::Kind LangStd = LangStandard::lang_unspecified; @@ -1841,6 +1842,22 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Opts.OpenMPIsDevice = Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device); + // Provide diagnostic when a given target is not expected to be an OpenMP + // device or host. + if (Opts.OpenMP && !Opts.OpenMPIsDevice) { + llvm::Triple T(TargetOpts.Triple); + switch (T.getArch()) { + default: + break; + // Add unsupported host targets here: + case llvm::Triple::nvptx: + case llvm::Triple::nvptx64: + Diags.Report(clang::diag::err_drv_omp_host_target_not_supported) + << TargetOpts.Triple; + break; + } + } + // Get the OpenMP target triples if any. if (Arg *A = Args.getLastArg(options::OPT_omptargets_EQ)) { @@ -2107,7 +2124,7 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res, Diags, Res.getLangOpts()->Sanitize); } else { // Other LangOpts are only initialzed when the input is not AST or LLVM IR. - ParseLangArgs(*Res.getLangOpts(), Args, DashX, Diags); + ParseLangArgs(*Res.getLangOpts(), Args, DashX, Res.getTargetOpts(), Diags); if (Res.getFrontendOpts().ProgramAction == frontend::RewriteObjC) Res.getLangOpts()->ObjCExceptions = 1; } |