diff options
| author | Jakob Degen <jakob.e.degen@gmail.com> | 2022-04-11 15:17:52 -0400 |
|---|---|---|
| committer | Jakob Degen <jakob.e.degen@gmail.com> | 2022-04-16 18:23:59 -0400 |
| commit | f280a839a7d327dd2b38360707437cd75c954d97 (patch) | |
| tree | 191623c7e1a4e778f76f2106a5efa547067d6022 /compiler/rustc_session/src | |
| parent | c8422403f775126c40d558838d321c063554c822 (diff) | |
| download | rust-f280a839a7d327dd2b38360707437cd75c954d97.tar.gz rust-f280a839a7d327dd2b38360707437cd75c954d97.zip | |
Add support for MIR opt unit tests
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 4994f8eaeb2..a5c1c713bfc 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -369,6 +369,8 @@ mod desc { pub const parse_opt_langid: &str = "a language identifier"; pub const parse_opt_pathbuf: &str = "a path"; pub const parse_list: &str = "a space-separated list of strings"; + pub const parse_list_with_polarity: &str = + "a comma-separated list of strings, with elements beginning with + or -"; pub const parse_opt_comma_list: &str = "a comma-separated list of strings"; pub const parse_number: &str = "a number"; pub const parse_opt_number: &str = parse_number; @@ -530,6 +532,22 @@ mod parse { } } + crate fn parse_list_with_polarity(slot: &mut Vec<(String, bool)>, v: Option<&str>) -> bool { + match v { + Some(s) => { + for s in s.split(",") { + match s.chars().next() { + Some('+') => slot.push((s[1..].to_string(), true)), + Some('-') => slot.push((s[1..].to_string(), false)), + _ => return false, + } + } + true + } + None => false, + } + } + crate fn parse_location_detail(ld: &mut LocationDetail, v: Option<&str>) -> bool { if let Some(v) = v { ld.line = false; @@ -1319,6 +1337,10 @@ options! { mir_emit_retag: bool = (false, parse_bool, [TRACKED], "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \ (default: no)"), + mir_enable_passes: Vec<(String, bool)> = (Vec::new(), parse_list_with_polarity, [TRACKED], + "use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be \ + enabled, overriding all other checks. Passes that are not specified are enabled or \ + disabled by other flags as usual."), mir_opt_level: Option<usize> = (None, parse_opt_number, [TRACKED], "MIR optimization level (0-4; default: 1 in non optimized builds and 2 in optimized builds)"), move_size_limit: Option<usize> = (None, parse_opt_number, [TRACKED], |
