Add -Z orbit for forcing MIR for everything, unless #[rustc_no_mir] is used.

This commit is contained in:
Eduard Burtescu 2016-03-09 22:46:00 +02:00
parent 856185dbb2
commit 835e2bdf7d
5 changed files with 22 additions and 6 deletions

View file

@ -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 {

View file

@ -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()),

View file

@ -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)),