Rollup merge of #60928 - TheSirC:fix/60229, r=eddyb

Changes the type `mir::Mir` into `mir::Body`

Fixes part 1 of #60229 (previously attempted in #60242).

I stumbled upon the issue and it seems that the previous attempt at solving it was not merged. This is a second try more up-to-date.

The commit should have changed comments as well.
At the time of writting, it passes the tidy and check tool.
This commit is contained in:
Mazdak Farrokhzad 2019-05-29 00:19:55 +02:00 committed by GitHub
commit ee08261c8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
93 changed files with 458 additions and 447 deletions

View file

@ -18,7 +18,7 @@ pub fn non_ssa_locals<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
let mir = fx.mir;
let mut analyzer = LocalAnalyzer::new(fx);
analyzer.visit_mir(mir);
analyzer.visit_body(mir);
for (index, ty) in mir.local_decls.iter().map(|l| l.ty).enumerate() {
let ty = fx.monomorphize(&ty);
@ -272,9 +272,9 @@ impl CleanupKind {
}
}
pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec<mir::BasicBlock, CleanupKind> {
pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Body<'tcx>) -> IndexVec<mir::BasicBlock, CleanupKind> {
fn discover_masters<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
mir: &mir::Mir<'tcx>) {
mir: &mir::Body<'tcx>) {
for (bb, data) in mir.basic_blocks().iter_enumerated() {
match data.terminator().kind {
TerminatorKind::Goto { .. } |
@ -304,7 +304,7 @@ pub fn cleanup_kinds<'a, 'tcx>(mir: &mir::Mir<'tcx>) -> IndexVec<mir::BasicBlock
}
fn propagate<'tcx>(result: &mut IndexVec<mir::BasicBlock, CleanupKind>,
mir: &mir::Mir<'tcx>) {
mir: &mir::Body<'tcx>) {
let mut funclet_succs = IndexVec::from_elem(None, mir.basic_blocks());
let mut set_successor = |funclet: mir::BasicBlock, succ| {

View file

@ -1,6 +1,6 @@
use rustc::ty::{self, Ty, TypeFoldable, UpvarSubsts};
use rustc::ty::layout::{TyLayout, HasTyCtxt, FnTypeExt};
use rustc::mir::{self, Mir};
use rustc::mir::{self, Body};
use rustc::session::config::DebugInfo;
use rustc_mir::monomorphize::Instance;
use rustc_target::abi::call::{FnType, PassMode, IgnoreMode};
@ -27,7 +27,7 @@ use self::operand::{OperandRef, OperandValue};
pub struct FunctionCx<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>> {
instance: Instance<'tcx>,
mir: &'a mir::Mir<'tcx>,
mir: &'a mir::Body<'tcx>,
debug_context: FunctionDebugContext<Bx::DIScope>,
@ -196,7 +196,7 @@ impl<'a, 'tcx: 'a, V: CodegenObject> LocalRef<'tcx, V> {
pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
cx: &'a Bx::CodegenCx,
llfn: Bx::Value,
mir: &'a Mir<'tcx>,
mir: &'a Body<'tcx>,
instance: Instance<'tcx>,
sig: ty::FnSig<'tcx>,
) {
@ -360,7 +360,7 @@ pub fn codegen_mir<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
}
fn create_funclets<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>(
mir: &'a Mir<'tcx>,
mir: &'a Body<'tcx>,
bx: &mut Bx,
cleanup_kinds: &IndexVec<mir::BasicBlock, CleanupKind>,
block_bxs: &IndexVec<mir::BasicBlock, Bx::BasicBlock>)

View file

@ -22,12 +22,12 @@ pub trait DebugInfoMethods<'tcx>: BackendTypes {
instance: Instance<'tcx>,
sig: ty::FnSig<'tcx>,
llfn: Self::Value,
mir: &mir::Mir<'_>,
mir: &mir::Body<'_>,
) -> FunctionDebugContext<Self::DIScope>;
fn create_mir_scopes(
&self,
mir: &mir::Mir<'_>,
mir: &mir::Body<'_>,
debug_context: &mut FunctionDebugContext<Self::DIScope>,
) -> IndexVec<mir::SourceScope, MirDebugScope<Self::DIScope>>;
fn extend_scope_to_file(