Skip to content

Commit 835e2bd

Browse files
committed
Add -Z orbit for forcing MIR for everything, unless #[rustc_no_mir] is used.
1 parent 856185d commit 835e2bd

File tree

5 files changed

+22
-6
lines changed

5 files changed

+22
-6
lines changed

configure

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,6 +607,7 @@ opt dist-host-only 0 "only install bins for the host architecture"
607607
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
608608
opt llvm-version-check 1 "check if the LLVM version is supported, build anyway"
609609
opt rustbuild 0 "use the rust and cargo based build system"
610+
opt orbit 0 "get MIR where it belongs - everywhere; most importantly, in orbit"
610611

611612
# Optimization and debugging options. These may be overridden by the release channel, etc.
612613
opt_nosave optimize 1 "build optimized rust code"
@@ -713,6 +714,8 @@ if [ -n "$CFG_ENABLE_DEBUG_ASSERTIONS" ]; then putvar CFG_ENABLE_DEBUG_ASSERTION
713714
if [ -n "$CFG_ENABLE_DEBUGINFO" ]; then putvar CFG_ENABLE_DEBUGINFO; fi
714715
if [ -n "$CFG_ENABLE_DEBUG_JEMALLOC" ]; then putvar CFG_ENABLE_DEBUG_JEMALLOC; fi
715716

717+
if [ -n "$CFG_ENABLE_ORBIT" ]; then putvar CFG_ENABLE_ORBIT; fi
718+
716719
# A magic value that allows the compiler to use unstable features
717720
# during the bootstrap even when doing so would normally be an error
718721
# because of feature staging or because the build turns on

mk/main.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ ifdef CFG_ENABLE_DEBUGINFO
134134
CFG_RUSTC_FLAGS += -g
135135
endif
136136

137+
ifdef CFG_ENABLE_ORBIT
138+
$(info cfg: launching MIR (CFG_ENABLE_ORBIT))
139+
CFG_RUSTC_FLAGS += -Z orbit
140+
endif
141+
137142
ifdef SAVE_TEMPS
138143
CFG_RUSTC_FLAGS += --save-temps
139144
endif

src/librustc/session/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
663663
"print the result of the translation item collection pass"),
664664
mir_opt_level: Option<usize> = (None, parse_opt_uint,
665665
"set the MIR optimization level (0-3)"),
666+
orbit: bool = (false, parse_bool,
667+
"get MIR where it belongs - everywhere; most importantly, in orbit"),
666668
}
667669

668670
pub fn default_lib_output() -> CrateType {

src/librustc_trans/trans/base.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,9 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
14311431
};
14321432

14331433
let check_attrs = |attrs: &[ast::Attribute]| {
1434-
attrs.iter().any(|item| item.check_name("rustc_mir"))
1434+
let default_to_mir = ccx.sess().opts.debugging_opts.orbit;
1435+
let invert = if default_to_mir { "rustc_no_mir" } else { "rustc_mir" };
1436+
default_to_mir ^ attrs.iter().any(|item| item.check_name(invert))
14351437
};
14361438

14371439
let use_mir = if let Some(id) = local_id {
@@ -1449,13 +1451,13 @@ impl<'blk, 'tcx> FunctionContext<'blk, 'tcx> {
14491451
};
14501452

14511453
FunctionContext {
1454+
needs_ret_allocas: nested_returns && mir.is_none(),
14521455
mir: mir,
14531456
llfn: llfndecl,
14541457
llretslotptr: Cell::new(None),
14551458
param_env: ccx.tcx().empty_parameter_environment(),
14561459
alloca_insert_pt: Cell::new(None),
14571460
llreturn: Cell::new(None),
1458-
needs_ret_allocas: nested_returns,
14591461
landingpad_alloca: Cell::new(None),
14601462
lllocals: RefCell::new(NodeMap()),
14611463
llupvars: RefCell::new(NodeMap()),

src/libsyntax/feature_gate.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,14 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeGat
350350
"the `#[rustc_move_fragments]` attribute \
351351
is just used for rustc unit tests \
352352
and will never be stable")),
353-
("rustc_mir", Normal, Gated("rustc_attrs",
354-
"the `#[rustc_mir]` attribute \
355-
is just used for rustc unit tests \
356-
and will never be stable")),
353+
("rustc_mir", Whitelisted, Gated("rustc_attrs",
354+
"the `#[rustc_mir]` attribute \
355+
is just used for rustc unit tests \
356+
and will never be stable")),
357+
("rustc_no_mir", Whitelisted, Gated("rustc_attrs",
358+
"the `#[rustc_no_mir]` attribute \
359+
is just used to make tests pass \
360+
and will never be stable")),
357361

358362
("allow_internal_unstable", Normal, Gated("allow_internal_unstable",
359363
EXPLAIN_ALLOW_INTERNAL_UNSTABLE)),

0 commit comments

Comments
 (0)