forked from OSchip/llvm-project
[clang][cli] Port OpenMP-related LangOpts to marshalling system
Port some OpenMP-related language options to the marshalling system for automatic command line parsing and generation. Reviewed By: dexonsmith Differential Revision: https://reviews.llvm.org/D95348
This commit is contained in:
parent
88b8c1f2bc
commit
9ad94c126a
|
@ -2145,18 +2145,24 @@ def fopenmp_EQ : Joined<["-"], "fopenmp=">, Group<f_Group>;
|
|||
def fopenmp_use_tls : Flag<["-"], "fopenmp-use-tls">, Group<f_Group>,
|
||||
Flags<[NoArgumentUnused, HelpHidden]>;
|
||||
def fnoopenmp_use_tls : Flag<["-"], "fnoopenmp-use-tls">, Group<f_Group>,
|
||||
Flags<[CC1Option, NoArgumentUnused, HelpHidden]>;
|
||||
Flags<[CC1Option, NoArgumentUnused, HelpHidden]>,
|
||||
MarshallingInfoNegativeFlag<LangOpts<"OpenMPUseTLS">, !strconcat("(bool)", fopenmp.KeyPath)>,
|
||||
ShouldParseIf<fopenmp.KeyPath>;
|
||||
def fopenmp_targets_EQ : CommaJoined<["-"], "fopenmp-targets=">, Flags<[NoXarchOption, CC1Option]>,
|
||||
HelpText<"Specify comma-separated list of triples OpenMP offloading targets to be supported">;
|
||||
def fopenmp_relocatable_target : Flag<["-"], "fopenmp-relocatable-target">,
|
||||
Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>;
|
||||
def fnoopenmp_relocatable_target : Flag<["-"], "fnoopenmp-relocatable-target">,
|
||||
Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>;
|
||||
def fopenmp_simd : Flag<["-"], "fopenmp-simd">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused]>,
|
||||
HelpText<"Emit OpenMP code only for SIMD-based constructs.">;
|
||||
defm openmp_simd : BoolFOption<"openmp-simd",
|
||||
LangOpts<"OpenMPSimd">, DefaultFalse,
|
||||
PosFlag<SetTrue, [], "Emit OpenMP code only for SIMD-based constructs.">,
|
||||
NegFlag<SetFalse>, BothFlags<[CC1Option, NoArgumentUnused]>>,
|
||||
ShouldParseIf<!strconcat("!", fopenmp.KeyPath)>;
|
||||
def fopenmp_enable_irbuilder : Flag<["-"], "fopenmp-enable-irbuilder">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused, HelpHidden]>,
|
||||
HelpText<"Use the experimental OpenMP-IR-Builder codegen path.">;
|
||||
def fno_openmp_simd : Flag<["-"], "fno-openmp-simd">, Group<f_Group>, Flags<[CC1Option, NoArgumentUnused]>;
|
||||
HelpText<"Use the experimental OpenMP-IR-Builder codegen path.">,
|
||||
MarshallingInfoFlag<LangOpts<"OpenMPIRBuilder">>,
|
||||
ShouldParseIf<fopenmp.KeyPath>;
|
||||
def fopenmp_cuda_mode : Flag<["-"], "fopenmp-cuda-mode">, Group<f_Group>,
|
||||
Flags<[CC1Option, NoArgumentUnused, HelpHidden]>;
|
||||
def fno_openmp_cuda_mode : Flag<["-"], "fno-openmp-cuda-mode">, Group<f_Group>,
|
||||
|
@ -5367,9 +5373,12 @@ def fno_cuda_host_device_constexpr : Flag<["-"], "fno-cuda-host-device-constexpr
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
def fopenmp_is_device : Flag<["-"], "fopenmp-is-device">,
|
||||
HelpText<"Generate code only for an OpenMP target device.">;
|
||||
HelpText<"Generate code only for an OpenMP target device.">,
|
||||
MarshallingInfoFlag<LangOpts<"OpenMPIsDevice">>,
|
||||
ShouldParseIf<fopenmp.KeyPath>;
|
||||
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.">;
|
||||
HelpText<"Path to the IR file produced by the frontend for the host.">,
|
||||
MarshallingInfoString<LangOpts<"OMPHostIRFile">>;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// SYCL Options
|
||||
|
|
|
@ -477,6 +477,12 @@ static void FixupInvocation(CompilerInvocation &Invocation,
|
|||
<< A->getSpelling() << T.getTriple();
|
||||
}
|
||||
|
||||
// Report if OpenMP host file does not exist.
|
||||
if (!LangOpts.OMPHostIRFile.empty() &&
|
||||
!llvm::sys::fs::exists(LangOpts.OMPHostIRFile))
|
||||
Diags.Report(diag::err_drv_omp_host_ir_file_not_found)
|
||||
<< LangOpts.OMPHostIRFile;
|
||||
|
||||
if (!CodeGenOpts.ProfileRemappingFile.empty() && CodeGenOpts.LegacyPassManager)
|
||||
Diags.Report(diag::err_drv_argument_only_allowed_with)
|
||||
<< Args.getLastArg(OPT_fprofile_remapping_file_EQ)->getAsString(Args)
|
||||
|
@ -2382,13 +2388,6 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||
bool IsSimdSpecified =
|
||||
Args.hasFlag(options::OPT_fopenmp_simd, options::OPT_fno_openmp_simd,
|
||||
/*Default=*/false);
|
||||
Opts.OpenMPSimd = !Opts.OpenMP && IsSimdSpecified;
|
||||
Opts.OpenMPUseTLS =
|
||||
Opts.OpenMP && !Args.hasArg(options::OPT_fnoopenmp_use_tls);
|
||||
Opts.OpenMPIsDevice =
|
||||
Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_is_device);
|
||||
Opts.OpenMPIRBuilder =
|
||||
Opts.OpenMP && Args.hasArg(options::OPT_fopenmp_enable_irbuilder);
|
||||
bool IsTargetSpecified =
|
||||
Opts.OpenMPIsDevice || Args.hasArg(options::OPT_fopenmp_targets_EQ);
|
||||
|
||||
|
@ -2462,15 +2461,6 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
|
|||
}
|
||||
}
|
||||
|
||||
// Get OpenMP host file path if any and report if a non existent file is
|
||||
// found
|
||||
if (Arg *A = Args.getLastArg(options::OPT_fopenmp_host_ir_file_path)) {
|
||||
Opts.OMPHostIRFile = A->getValue();
|
||||
if (!llvm::sys::fs::exists(Opts.OMPHostIRFile))
|
||||
Diags.Report(diag::err_drv_omp_host_ir_file_not_found)
|
||||
<< Opts.OMPHostIRFile;
|
||||
}
|
||||
|
||||
// Set CUDA mode for OpenMP target NVPTX/AMDGCN if specified in options
|
||||
Opts.OpenMPCUDAMode = Opts.OpenMPIsDevice && (T.isNVPTX() || T.isAMDGCN()) &&
|
||||
Args.hasArg(options::OPT_fopenmp_cuda_mode);
|
||||
|
|
Loading…
Reference in New Issue