diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2016-03-09 22:46:00 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-03-17 21:51:55 +0200 |
| commit | 835e2bdf7d370ec5f3a7777c7273d48be0bf5c56 (patch) | |
| tree | 995f42f13a54784f600eb34437e2cc60aefe794a | |
| parent | 856185dbb2f4a57dc865c6dc3c856268c7efa79a (diff) | |
| download | rust-835e2bdf7d370ec5f3a7777c7273d48be0bf5c56.tar.gz rust-835e2bdf7d370ec5f3a7777c7273d48be0bf5c56.zip | |
Add -Z orbit for forcing MIR for everything, unless #[rustc_no_mir] is used.
| -rwxr-xr-x | configure | 3 | ||||
| -rw-r--r-- | mk/main.mk | 5 | ||||
| -rw-r--r-- | src/librustc/session/config.rs | 2 | ||||
| -rw-r--r-- | src/librustc_trans/trans/base.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 12 |
5 files changed, 22 insertions, 6 deletions
diff --git a/configure b/configure index 086dd9f74e0..34132b7e5f5 100755 --- a/configure +++ b/configure @@ -607,6 +607,7 @@ opt dist-host-only 0 "only install bins for the host architecture" opt inject-std-version 1 "inject the current compiler version of libstd into programs" opt llvm-version-check 1 "check if the LLVM version is supported, build anyway" opt rustbuild 0 "use the rust and cargo based build system" +opt orbit 0 "get MIR where it belongs - everywhere; most importantly, in orbit" # Optimization and debugging options. These may be overridden by the release channel, etc. opt_nosave optimize 1 "build optimized rust code" @@ -713,6 +714,8 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi +if [ -n "$CFG_ENABLE_ORBIT" ]; then putvar CFG_ENABLE_ORBIT; fi + # A magic value that allows the compiler to use unstable features # during the bootstrap even when doing so would normally be an error # because of feature staging or because the build turns on diff --git a/mk/main.mk b/mk/main.mk index 887247b80c4..9df04a6d43e 100644 --- a/mk/main.mk +++ b/mk/main.mk @@ -134,6 +134,11 @@ ifdef CFG_ENABLE_DEBUGINFO CFG_RUSTC_FLAGS += -g endif +ifdef CFG_ENABLE_ORBIT + $(info cfg: launching MIR (CFG_ENABLE_ORBIT)) + CFG_RUSTC_FLAGS += -Z orbit +endif + ifdef SAVE_TEMPS CFG_RUSTC_FLAGS += --save-temps endif diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index 9f097215a8a..17f70b2d8dc 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -663,6 +663,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, "print the result of the translation item collection pass"), mir_opt_level: Option<usize> = (None, parse_opt_uint, "set the MIR optimization level (0-3)"), + orbit: bool = (false, parse_bool, + "get MIR where it belongs - everywhere; most importantly, in orbit"), } pub fn default_lib_output() -> CrateType { diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 6add4fee567..93ca306f0b0 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -1431,7 +1431,9 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> { }; let check_attrs = |attrs: &[ast::Attribute]| { - attrs.iter().any(|item| item.check_name("rustc_mir")) + let default_to_mir = ccx.sess().opts.debugging_opts.orbit; + let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" }; + default_to_mir ^ attrs.iter().any(|item| item.check_name(invert)) }; let use_mir = if let Some(id) = local_id { @@ -1449,13 +1451,13 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> { }; FunctionContext { + needs_ret_allocas: nested_returns && mir.is_none(), mir: mir, llfn: llfndecl, llretslotptr: Cell::new(None), param_env: ccx.tcx().empty_parameter_environment(), alloca_insert_pt: Cell::new(None), llreturn: Cell::new(None), - needs_ret_allocas: nested_returns, landingpad_alloca: Cell::new(None), lllocals: RefCell::new(NodeMap()), llupvars: RefCell::new(NodeMap()), diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index fbaf28332c4..a017e62d546 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -350,10 +350,14 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat "the `#[rustc_move_fragments]` attribute \ is just used for rustc unit tests \ and will never be stable")), - ("rustc_mir", Normal, Gated("rustc_attrs", - "the `#[rustc_mir]` attribute \ - is just used for rustc unit tests \ - and will never be stable")), + ("rustc_mir", Whitelisted, Gated("rustc_attrs", + "the `#[rustc_mir]` attribute \ + is just used for rustc unit tests \ + and will never be stable")), + ("rustc_no_mir", Whitelisted, Gated("rustc_attrs", + "the `#[rustc_no_mir]` attribute \ + is just used to make tests pass \ + and will never be stable")), ("allow_internal_unstable", Normal, Gated("allow_internal_unstable", EXPLAIN_ALLOW_INTERNAL_UNSTABLE)), |
