Skip to content

Commit a52d3d3

Browse files
committed
[SYCL] Update clang options processing
39a2a23 commit changes parsing logic for Lang and CodeGen options. That affects SYCL specific options. The definition of impacted options is updated to match new logic.
1 parent 82e6293 commit a52d3d3

File tree

2 files changed

+15
-34
lines changed

2 files changed

+15
-34
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2411,12 +2411,7 @@ def fsycl_device_code_split_EQ : Joined<["-"], "fsycl-device-code-split=">,
24112411
def fsycl_device_code_split : Flag<["-"], "fsycl-device-code-split">, Alias<fsycl_device_code_split_EQ>,
24122412
AliasArgs<["auto"]>, Flags<[CC1Option, CoreOption]>,
24132413
HelpText<"Perform SYCL device code split in the 'auto' mode, i.e. use heuristic to distribute device code across modules">;
2414-
def fsycl_id_queries_fit_in_int : Flag<["-"], "fsycl-id-queries-fit-in-int">,
2415-
Flags<[CC1Option, CoreOption]>, HelpText<"Assume that SYCL ID queries fit "
2416-
"within MAX_INT.">;
2417-
def fno_sycl_id_queries_fit_in_int : Flag<["-"], "fno-sycl-id-queries-fit-in-int">,
2418-
Flags<[CC1Option, CoreOption]>, HelpText<"Do not assume that SYCL ID queries "
2419-
"fit within MAX_INT.">;
2414+
defm sycl_id_queries_fit_in_int: OptInFFlag<"sycl-id-queries-fit-in-int", "Assume", "Do not assume", " that SYCL ID queries fit within MAX_INT.", [CC1Option,CoreOption], LangOpts<"SYCLValueFitInMaxInt">>;
24202415
def fsycl_use_bitcode : Flag<["-"], "fsycl-use-bitcode">,
24212416
Flags<[CC1Option, CoreOption]>, HelpText<"Use LLVM bitcode instead of SPIR-V in fat objects">;
24222417
def fno_sycl_use_bitcode : Flag<["-"], "fno-sycl-use-bitcode">,
@@ -2427,7 +2422,8 @@ def fsycl_link : Flag<["-"], "fsycl-link">, Alias<fsycl_link_EQ>,
24272422
AliasArgs<["early"]>, Flags<[CC1Option, CoreOption]>,
24282423
HelpText<"Generate partially linked device object to be used with the host link">;
24292424
def fsycl_unnamed_lambda : Flag<["-"], "fsycl-unnamed-lambda">,
2430-
Flags<[CC1Option, CoreOption]>, HelpText<"Allow unnamed SYCL lambda kernels">;
2425+
Flags<[CC1Option, CoreOption]>, HelpText<"Allow unnamed SYCL lambda kernels">,
2426+
MarshallingInfoFlag<LangOpts<"SYCLUnnamedLambda">>;
24312427
def fsycl_help_EQ : Joined<["-"], "fsycl-help=">,
24322428
Flags<[NoXarchOption, CoreOption]>, HelpText<"Emit help information from the "
24332429
"related offline compilation tool. Valid values: all, fpga, gen, x86_64.">,
@@ -4273,10 +4269,7 @@ def sycl_std_EQ : Joined<["-"], "sycl-std=">, Group<sycl_Group>, Flags<[CC1Optio
42734269
HelpText<"SYCL language standard to compile for.">, Values<"2020,2017,121,1.2.1,sycl-1.2.1">,
42744270
NormalizedValues<["SYCL_2020", "SYCL_2017", "SYCL_2017", "SYCL_2017", "SYCL_2017"]>, NormalizedValuesScope<"LangOptions">,
42754271
MarshallingInfoString<LangOpts<"SYCLVersion">, "SYCL_None">, ShouldParseIf<fsycl.KeyPath>, AutoNormalizeEnum;
4276-
def fsycl_esimd : Flag<["-"], "fsycl-explicit-simd">, Group<sycl_Group>, Flags<[CC1Option, NoArgumentUnused, CoreOption]>,
4277-
HelpText<"Enable SYCL explicit SIMD extension">;
4278-
def fno_sycl_esimd : Flag<["-"], "fno-sycl-explicit-simd">, Group<sycl_Group>,
4279-
HelpText<"Disable SYCL explicit SIMD extension">, Flags<[NoArgumentUnused, CoreOption]>;
4272+
defm sycl_esimd: OptInFFlag<"sycl-explicit-simd", "Enable", "Disable", " SYCL explicit SIMD extension.", [CC1Option,CoreOption], LangOpts<"SYCLExplicitSIMD">>;
42804273
defm sycl_early_optimizations : OptOutFFlag<"sycl-early-optimizations", "Enable", "Disable", " standard optimization pipeline for SYCL device compiler", [CoreOption]>;
42814274
def fsycl_dead_args_optimization : Flag<["-"], "fsycl-dead-args-optimization">,
42824275
Group<sycl_Group>, Flags<[NoArgumentUnused, CoreOption]>, HelpText<"Enables "
@@ -5463,20 +5456,23 @@ def fopenmp_host_ir_file_path : Separate<["-"], "fopenmp-host-ir-file-path">,
54635456
//===----------------------------------------------------------------------===//
54645457

54655458
def fsycl_is_device : Flag<["-"], "fsycl-is-device">,
5466-
HelpText<"Generate code for SYCL device.">;
5459+
HelpText<"Generate code for SYCL device.">,
5460+
MarshallingInfoFlag<LangOpts<"SYCLIsDevice">>;
54675461
def fsycl_is_host : Flag<["-"], "fsycl-is-host">,
5468-
HelpText<"SYCL host compilation">;
5462+
HelpText<"SYCL host compilation">,
5463+
MarshallingInfoFlag<LangOpts<"SYCLIsHost">>;
54695464
def fsycl_int_header : Separate<["-"], "fsycl-int-header">,
5470-
HelpText<"Generate SYCL integration header into this file.">;
5465+
HelpText<"Generate SYCL integration header into this file.">,
5466+
MarshallingInfoString<LangOpts<"SYCLIntHeader">>;
54715467
def fsycl_int_header_EQ : Joined<["-"], "fsycl-int-header=">,
54725468
Alias<fsycl_int_header>;
54735469
def fsycl_std_layout_kernel_params: Flag<["-"], "fsycl-std-layout-kernel-params">,
5474-
HelpText<"Enable standard layout requirement for SYCL kernel parameters.">;
5475-
def fsycl_allow_func_ptr : Flag<["-"], "fsycl-allow-func-ptr">,
5476-
HelpText<"Allow function pointers in SYCL device.">;
5477-
def fno_sycl_allow_func_ptr : Flag<["-"], "fno-sycl-allow-func-ptr">;
5470+
HelpText<"Enable standard layout requirement for SYCL kernel parameters.">,
5471+
MarshallingInfoFlag<LangOpts<"SYCLStdLayoutKernelParams">>;
5472+
defm sycl_allow_func_ptr: OptInFFlag<"sycl-allow-func-ptr", "Allow", "Disallow", " function pointers in SYCL device.", [CC1Option,CoreOption], LangOpts<"SYCLAllowFuncPtr">>;
54785473
def fenable_sycl_dae : Flag<["-"], "fenable-sycl-dae">,
5479-
HelpText<"Enable Dead Argument Elimination in SPIR kernels">;
5474+
HelpText<"Enable Dead Argument Elimination in SPIR kernels">,
5475+
MarshallingInfoFlag<LangOpts<"EnableDAEInSpirKernels">>;
54805476

54815477
} // let Flags = [CC1Option, NoDriverOption]
54825478

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,14 +2216,6 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
22162216
}
22172217

22182218
if (Opts.SYCL) {
2219-
Opts.SYCLIsDevice = Args.hasArg(options::OPT_fsycl_is_device);
2220-
Opts.SYCLIsHost = Args.hasArg(options::OPT_fsycl_is_host);
2221-
Opts.SYCLAllowFuncPtr =
2222-
Args.hasFlag(options::OPT_fsycl_allow_func_ptr,
2223-
options::OPT_fno_sycl_allow_func_ptr, false);
2224-
Opts.SYCLStdLayoutKernelParams =
2225-
Args.hasArg(options::OPT_fsycl_std_layout_kernel_params);
2226-
Opts.SYCLUnnamedLambda = Args.hasArg(options::OPT_fsycl_unnamed_lambda);
22272219
// -sycl-std applies to any SYCL source, not only those containing kernels,
22282220
// but also those using the SYCL API
22292221
if (const Arg *A = Args.getLastArg(OPT_sycl_std_EQ)) {
@@ -2240,13 +2232,6 @@ void CompilerInvocation::ParseLangArgs(LangOptions &Opts, ArgList &Args,
22402232
<< A->getAsString(Args) << A->getValue();
22412233
}
22422234
}
2243-
Opts.SYCLExplicitSIMD = Args.hasArg(options::OPT_fsycl_esimd);
2244-
Opts.EnableDAEInSpirKernels = Args.hasArg(options::OPT_fenable_sycl_dae);
2245-
Opts.SYCLValueFitInMaxInt =
2246-
Args.hasFlag(options::OPT_fsycl_id_queries_fit_in_int,
2247-
options::OPT_fno_sycl_id_queries_fit_in_int, false);
2248-
Opts.SYCLIntHeader =
2249-
std::string(Args.getLastArgValue(OPT_fsycl_int_header));
22502235
}
22512236

22522237
Opts.DeclareSPIRVBuiltins = Args.hasArg(OPT_fdeclare_spirv_builtins);

0 commit comments

Comments
 (0)