1
Fork 0

Disallow values for -C no-* and -Z no-* options again.

With the exception of `-C no-redzone`, because that could take a value
before this PR.

This partially undoes one of the earlier commits in this PR, which added
the ability to take a value to all boolean options that lacked it.

The help output for these options looks like this:
```
    -C         no-vectorize-slp=val -- disable LLVM's SLP vectorization pass
```
The "=val" part is a lie, but hopefully this will be fixed in the future.
This commit is contained in:
Nicholas Nethercote 2020-04-06 09:29:19 +10:00
parent dc06539872
commit 3e3fd73f85
2 changed files with 40 additions and 41 deletions

View file

@ -180,30 +180,19 @@ If not specified, overflow checks are enabled if
## no-prepopulate-passes ## no-prepopulate-passes
This flag controls whether the pass manager uses a pre-populated list of This flag tells the pass manager to use an empty list of passes, instead of the
passes. It takes one of the following values: usual pre-populated list of passes.
* `y`, `yes`, `on`, or no value: use an empty list of passes.
* `n`, `no`, or `off`: use a pre-populated list of passes (the default).
## no-vectorize-loops ## no-vectorize-loops
This flag controls whether `rustc` will attempt to [vectorize This flag disables [loop
loops](https://llvm.org/docs/Vectorizers.html#the-loop-vectorizer). It takes vectorization](https://llvm.org/docs/Vectorizers.html#the-loop-vectorizer).
one of the following values:
* `y`, `yes`, `on`, or no value: disable loop vectorization.
* `n`, `no`, or `off`: enable loop vectorization (the default).
## no-vectorize-slp ## no-vectorize-slp
This flag controls whether `rustc` will attempt to vectorize code using This flag disables vectorization using
[superword-level [superword-level
parallelism](https://llvm.org/docs/Vectorizers.html#the-slp-vectorizer). parallelism](https://llvm.org/docs/Vectorizers.html#the-slp-vectorizer).
It takes one of the following values:
* `y`, `yes`, `on`, or no value: disable SLP vectorization.
* `n`, `no`, or `off`: enable SLP vectorization (the default).
## soft-float ## soft-float
@ -309,7 +298,7 @@ This flag controls the optimization level.
* `2`: some optimizations. * `2`: some optimizations.
* `3`: all optimizations. * `3`: all optimizations.
* `s`: optimize for binary size. * `s`: optimize for binary size.
* `z`: optimize for binary size, but also turn off loop vectorization.. * `z`: optimize for binary size, but also turn off loop vectorization.
Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=2`. Note: The [`-O` flag][option-o-optimize] is an alias for `-C opt-level=2`.

View file

@ -231,6 +231,7 @@ macro_rules! options {
#[allow(non_upper_case_globals, dead_code)] #[allow(non_upper_case_globals, dead_code)]
mod $mod_desc { mod $mod_desc {
pub const parse_no_flag: &str = "no value";
pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `n`, `no`, or `off`"; pub const parse_bool: &str = "one of: `y`, `yes`, `on`, `n`, `no`, or `off`";
pub const parse_opt_bool: &str = parse_bool; pub const parse_opt_bool: &str = parse_bool;
pub const parse_string: &str = "a string"; pub const parse_string: &str = "a string";
@ -288,6 +289,15 @@ macro_rules! options {
} }
)* )*
/// This is for boolean options that don't take a value and start with
/// `no-`. This style of option is deprecated.
fn parse_no_flag(slot: &mut bool, v: Option<&str>) -> bool {
match v {
None => { *slot = true; true }
Some(_) => false,
}
}
/// Use this for any boolean option that has a static default. /// Use this for any boolean option that has a static default.
fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool { fn parse_bool(slot: &mut bool, v: Option<&str>) -> bool {
match v { match v {
@ -640,12 +650,12 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"set rpath values in libs/exes (default: no)"), "set rpath values in libs/exes (default: no)"),
overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
"use overflow checks for integer arithmetic"), "use overflow checks for integer arithmetic"),
no_prepopulate_passes: bool = (false, parse_bool, [TRACKED], no_prepopulate_passes: bool = (false, parse_no_flag, [TRACKED],
"give an empty list of passes to the pass manager (default: no)"), "give an empty list of passes to the pass manager"),
no_vectorize_loops: bool = (false, parse_bool, [TRACKED], no_vectorize_loops: bool = (false, parse_no_flag, [TRACKED],
"disable loop vectorization optimization passes (default: no)"), "disable loop vectorization optimization passes"),
no_vectorize_slp: bool = (false, parse_bool, [TRACKED], no_vectorize_slp: bool = (false, parse_no_flag, [TRACKED],
"disable LLVM's SLP vectorization pass (default: no)"), "disable LLVM's SLP vectorization pass"),
soft_float: bool = (false, parse_bool, [TRACKED], soft_float: bool = (false, parse_bool, [TRACKED],
"use soft float ABI (*eabihf targets only) (default: no)"), "use soft float ABI (*eabihf targets only) (default: no)"),
prefer_dynamic: bool = (false, parse_bool, [TRACKED], prefer_dynamic: bool = (false, parse_bool, [TRACKED],
@ -664,7 +674,7 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options,
"divide crate into N units to optimize in parallel"), "divide crate into N units to optimize in parallel"),
remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED], remark: Passes = (Passes::Some(Vec::new()), parse_passes, [UNTRACKED],
"print remarks for these optimization passes (space separated, or \"all\")"), "print remarks for these optimization passes (space separated, or \"all\")"),
no_stack_check: bool = (false, parse_bool, [UNTRACKED], no_stack_check: bool = (false, parse_no_flag, [UNTRACKED],
"this option is deprecated and does nothing"), "this option is deprecated and does nothing"),
debuginfo: usize = (0, parse_uint, [TRACKED], debuginfo: usize = (0, parse_uint, [TRACKED],
"debug info emission level (0 = no debug info, 1 = line tables only, \ "debug info emission level (0 = no debug info, 1 = line tables only, \
@ -725,8 +735,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"verify LLVM IR (default: no)"), "verify LLVM IR (default: no)"),
borrowck_stats: bool = (false, parse_bool, [UNTRACKED], borrowck_stats: bool = (false, parse_bool, [UNTRACKED],
"gather borrowck statistics (default: no)"), "gather borrowck statistics (default: no)"),
no_landing_pads: bool = (false, parse_bool, [TRACKED], no_landing_pads: bool = (false, parse_no_flag, [TRACKED],
"omit landing pads for unwinding (default: no)"), "omit landing pads for unwinding"),
fewer_names: bool = (false, parse_bool, [TRACKED], fewer_names: bool = (false, parse_bool, [TRACKED],
"reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \ "reduce memory use by retaining fewer names within compilation artifacts (LLVM-IR) \
(default: no)"), (default: no)"),
@ -758,8 +768,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"parse only; do not compile, assemble, or link (default: no)"), "parse only; do not compile, assemble, or link (default: no)"),
dual_proc_macros: bool = (false, parse_bool, [TRACKED], dual_proc_macros: bool = (false, parse_bool, [TRACKED],
"load proc macros for both target and host, but only link to the target (default: no)"), "load proc macros for both target and host, but only link to the target (default: no)"),
no_codegen: bool = (false, parse_bool, [TRACKED], no_codegen: bool = (false, parse_no_flag, [TRACKED],
"run all passes except codegen; no output (default: no)"), "run all passes except codegen; no output"),
treat_err_as_bug: Option<usize> = (None, parse_treat_err_as_bug, [TRACKED], treat_err_as_bug: Option<usize> = (None, parse_treat_err_as_bug, [TRACKED],
"treat error number `val` that occurs as bug"), "treat error number `val` that occurs as bug"),
report_delayed_bugs: bool = (false, parse_bool, [TRACKED], report_delayed_bugs: bool = (false, parse_bool, [TRACKED],
@ -789,8 +799,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
(default: no)"), (default: no)"),
query_dep_graph: bool = (false, parse_bool, [UNTRACKED], query_dep_graph: bool = (false, parse_bool, [UNTRACKED],
"enable queries of the dependency graph for regression testing (default: no)"), "enable queries of the dependency graph for regression testing (default: no)"),
no_analysis: bool = (false, parse_bool, [UNTRACKED], no_analysis: bool = (false, parse_no_flag, [UNTRACKED],
"parse and expand the source, but run no analysis (default: no)"), "parse and expand the source, but run no analysis"),
unstable_options: bool = (false, parse_bool, [UNTRACKED], unstable_options: bool = (false, parse_bool, [UNTRACKED],
"adds unstable command line options to rustc interface (default: no)"), "adds unstable command line options to rustc interface (default: no)"),
force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED], force_overflow_checks: Option<bool> = (None, parse_opt_bool, [TRACKED],
@ -799,8 +809,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"for every macro invocation, print its name and arguments (default: no)"), "for every macro invocation, print its name and arguments (default: no)"),
debug_macros: bool = (false, parse_bool, [TRACKED], debug_macros: bool = (false, parse_bool, [TRACKED],
"emit line numbers debug info inside macros (default: no)"), "emit line numbers debug info inside macros (default: no)"),
no_generate_arange_section: bool = (false, parse_bool, [TRACKED], no_generate_arange_section: bool = (false, parse_no_flag, [TRACKED],
"omit DWARF address ranges that give faster lookups (default: no)"), "omit DWARF address ranges that give faster lookups"),
keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED], keep_hygiene_data: bool = (false, parse_bool, [UNTRACKED],
"keep hygiene data after analysis (default: no)"), "keep hygiene data after analysis (default: no)"),
show_span: Option<String> = (None, parse_opt_string, [TRACKED], show_span: Option<String> = (None, parse_opt_string, [TRACKED],
@ -862,7 +872,7 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"extra arguments to prepend to the linker invocation (space separated)"), "extra arguments to prepend to the linker invocation (space separated)"),
profile: bool = (false, parse_bool, [TRACKED], profile: bool = (false, parse_bool, [TRACKED],
"insert profiling code (default: no)"), "insert profiling code (default: no)"),
no_profiler_runtime: bool = (false, parse_bool, [TRACKED], no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
"prevent automatic injection of the profiler_builtins crate"), "prevent automatic injection of the profiler_builtins crate"),
relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED], relro_level: Option<RelroLevel> = (None, parse_relro_level, [TRACKED],
"choose which RELRO level to use"), "choose which RELRO level to use"),
@ -911,12 +921,12 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
(default: no)"), (default: no)"),
share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED], share_generics: Option<bool> = (None, parse_opt_bool, [TRACKED],
"make the current crate share its generic instantiations"), "make the current crate share its generic instantiations"),
no_parallel_llvm: bool = (false, parse_bool, [UNTRACKED], no_parallel_llvm: bool = (false, parse_no_flag, [UNTRACKED],
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO) (default: no)"), "run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
no_leak_check: bool = (false, parse_bool, [UNTRACKED], no_leak_check: bool = (false, parse_no_flag, [UNTRACKED],
"disable the 'leak check' for subtyping; unsound, but useful for tests (default: no)"), "disable the 'leak check' for subtyping; unsound, but useful for tests"),
no_interleave_lints: bool = (false, parse_bool, [UNTRACKED], no_interleave_lints: bool = (false, parse_no_flag, [UNTRACKED],
"execute lints separately; allows benchmarking individual lints (default: no)"), "execute lints separately; allows benchmarking individual lints"),
crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED], crate_attr: Vec<String> = (Vec::new(), parse_string_push, [TRACKED],
"inject the given attribute in the crate"), "inject the given attribute in the crate"),
self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled, self_profile: SwitchWithOptPath = (SwitchWithOptPath::Disabled,
@ -953,8 +963,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"deduplicate identical diagnostics (default: yes)"), "deduplicate identical diagnostics (default: yes)"),
control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [UNTRACKED], control_flow_guard: CFGuard = (CFGuard::Disabled, parse_cfguard, [UNTRACKED],
"use Windows Control Flow Guard (`disabled`, `nochecks` or `checks`)"), "use Windows Control Flow Guard (`disabled`, `nochecks` or `checks`)"),
no_link: bool = (false, parse_bool, [TRACKED], no_link: bool = (false, parse_no_flag, [TRACKED],
"compile without linking (default: no)"), "compile without linking"),
link_only: bool = (false, parse_bool, [TRACKED], link_only: bool = (false, parse_bool, [TRACKED],
"link the `.rlink` file generated by `-Z no-link` (default: no)"), "link the `.rlink` file generated by `-Z no-link` (default: no)"),
new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED], new_llvm_pass_manager: bool = (false, parse_bool, [TRACKED],