rustc: move mir::repr::* to mir.

This commit is contained in:
Eduard Burtescu 2016-09-19 23:50:00 +03:00
parent 5530030420
commit 36340ba994
72 changed files with 155 additions and 170 deletions

View File

@ -105,16 +105,7 @@ pub mod middle {
pub mod weak_lang_items;
}
pub mod mir {
mod cache;
pub mod repr;
pub mod tcx;
pub mod visit;
pub mod transform;
pub mod traversal;
pub mod mir_map;
}
pub mod mir;
pub mod session;
pub mod traits;
pub mod ty;

View File

@ -29,7 +29,7 @@ use hir::map::definitions::{Definitions, DefKey};
use hir::svh::Svh;
use middle::lang_items;
use ty::{self, Ty, TyCtxt};
use mir::repr::Mir;
use mir::Mir;
use mir::mir_map::MirMap;
use session::Session;
use session::search_paths::PathKind;

View File

@ -11,7 +11,7 @@
use std::cell::{Ref, RefCell};
use rustc_data_structures::indexed_vec::IndexVec;
use mir::repr::{Mir, BasicBlock};
use mir::{Mir, BasicBlock};
use rustc_serialize as serialize;

View File

@ -10,7 +10,7 @@
use dep_graph::{DepGraph, DepNode, DepTrackingMap, DepTrackingMapConfig};
use hir::def_id::DefId;
use mir::repr::Mir;
use mir::Mir;
use std::marker::PhantomData;
pub struct MirMap<'tcx> {

View File

@ -32,7 +32,12 @@ use std::vec::IntoIter;
use syntax::ast::{self, Name};
use syntax_pos::Span;
use super::cache::Cache;
mod cache;
pub mod tcx;
pub mod visit;
pub mod transform;
pub mod traversal;
pub mod mir_map;
macro_rules! newtype_index {
($name:ident, $debug_name:expr) => (
@ -106,7 +111,7 @@ pub struct Mir<'tcx> {
pub span: Span,
/// A cache for various calculations
cache: Cache
cache: cache::Cache
}
/// where execution begins
@ -137,7 +142,7 @@ impl<'tcx> Mir<'tcx> {
upvar_decls: upvar_decls,
spread_arg: None,
span: span,
cache: Cache::new()
cache: cache::Cache::new()
}
}

View File

@ -13,7 +13,7 @@
* building is complete.
*/
use mir::repr::*;
use mir::*;
use ty::subst::{Subst, Substs};
use ty::{self, AdtDef, Ty, TyCtxt};
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};

View File

@ -12,7 +12,7 @@ use dep_graph::DepNode;
use hir;
use hir::map::DefPathData;
use mir::mir_map::MirMap;
use mir::repr::{Mir, Promoted};
use mir::{Mir, Promoted};
use ty::TyCtxt;
use syntax::ast::NodeId;
use util::common::time;

View File

@ -13,7 +13,7 @@ use std::vec;
use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::Idx;
use super::repr::*;
use super::*;
/// Preorder traversal of a graph.
///

View File

@ -12,7 +12,7 @@ use middle::const_val::ConstVal;
use hir::def_id::DefId;
use ty::subst::Substs;
use ty::{ClosureSubsts, Region, Ty};
use mir::repr::*;
use mir::*;
use rustc_const_math::ConstUsize;
use rustc_data_structures::tuple_slice::TupleSlice;
use rustc_data_structures::indexed_vec::Idx;

View File

@ -21,8 +21,8 @@
//! `a[x]` would still overlap them both. But that is not this
//! representation does today.)
use rustc::mir::repr::{Lvalue, LvalueElem};
use rustc::mir::repr::{Operand, Projection, ProjectionElem};
use rustc::mir::{Lvalue, LvalueElem};
use rustc::mir::{Operand, Projection, ProjectionElem};
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub struct AbstractOperand;

View File

@ -11,7 +11,7 @@
//! Hook into libgraphviz for rendering dataflow graphs for MIR.
use syntax::ast::NodeId;
use rustc::mir::repr::{BasicBlock, Mir};
use rustc::mir::{BasicBlock, Mir};
use rustc_data_structures::bitslice::bits_to_string;
use rustc_data_structures::indexed_set::{IdxSet};
use rustc_data_structures::indexed_vec::Idx;

View File

@ -9,7 +9,7 @@
// except according to those terms.
use rustc::ty::TyCtxt;
use rustc::mir::repr::{self, Mir, Location};
use rustc::mir::{self, Mir, Location};
use rustc_data_structures::bitslice::BitSlice; // adds set_bit/get_bit to &[usize] bitvector rep.
use rustc_data_structures::bitslice::{BitwiseOperator};
use rustc_data_structures::indexed_set::{IdxSet};
@ -245,7 +245,7 @@ impl<'a, 'tcx> BitDenotation for MaybeInitializedLvals<'a, 'tcx> {
fn statement_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MovePathIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
idx: usize)
{
drop_flag_effects_for_location(
@ -258,7 +258,7 @@ impl<'a, 'tcx> BitDenotation for MaybeInitializedLvals<'a, 'tcx> {
fn terminator_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MovePathIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
statements_len: usize)
{
drop_flag_effects_for_location(
@ -271,9 +271,9 @@ impl<'a, 'tcx> BitDenotation for MaybeInitializedLvals<'a, 'tcx> {
fn propagate_call_return(&self,
ctxt: &Self::Ctxt,
in_out: &mut IdxSet<MovePathIndex>,
_call_bb: repr::BasicBlock,
_dest_bb: repr::BasicBlock,
dest_lval: &repr::Lvalue) {
_call_bb: mir::BasicBlock,
_dest_bb: mir::BasicBlock,
dest_lval: &mir::Lvalue) {
// when a call returns successfully, that means we need to set
// the bits for that dest_lval to 1 (initialized).
on_lookup_result_bits(self.tcx, self.mir, &ctxt.move_data,
@ -306,7 +306,7 @@ impl<'a, 'tcx> BitDenotation for MaybeUninitializedLvals<'a, 'tcx> {
fn statement_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MovePathIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
idx: usize)
{
drop_flag_effects_for_location(
@ -319,7 +319,7 @@ impl<'a, 'tcx> BitDenotation for MaybeUninitializedLvals<'a, 'tcx> {
fn terminator_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MovePathIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
statements_len: usize)
{
drop_flag_effects_for_location(
@ -332,9 +332,9 @@ impl<'a, 'tcx> BitDenotation for MaybeUninitializedLvals<'a, 'tcx> {
fn propagate_call_return(&self,
ctxt: &Self::Ctxt,
in_out: &mut IdxSet<MovePathIndex>,
_call_bb: repr::BasicBlock,
_dest_bb: repr::BasicBlock,
dest_lval: &repr::Lvalue) {
_call_bb: mir::BasicBlock,
_dest_bb: mir::BasicBlock,
dest_lval: &mir::Lvalue) {
// when a call returns successfully, that means we need to set
// the bits for that dest_lval to 0 (initialized).
on_lookup_result_bits(self.tcx, self.mir, &ctxt.move_data,
@ -366,7 +366,7 @@ impl<'a, 'tcx> BitDenotation for DefinitelyInitializedLvals<'a, 'tcx> {
fn statement_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MovePathIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
idx: usize)
{
drop_flag_effects_for_location(
@ -379,7 +379,7 @@ impl<'a, 'tcx> BitDenotation for DefinitelyInitializedLvals<'a, 'tcx> {
fn terminator_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MovePathIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
statements_len: usize)
{
drop_flag_effects_for_location(
@ -392,9 +392,9 @@ impl<'a, 'tcx> BitDenotation for DefinitelyInitializedLvals<'a, 'tcx> {
fn propagate_call_return(&self,
ctxt: &Self::Ctxt,
in_out: &mut IdxSet<MovePathIndex>,
_call_bb: repr::BasicBlock,
_dest_bb: repr::BasicBlock,
dest_lval: &repr::Lvalue) {
_call_bb: mir::BasicBlock,
_dest_bb: mir::BasicBlock,
dest_lval: &mir::Lvalue) {
// when a call returns successfully, that means we need to set
// the bits for that dest_lval to 1 (initialized).
on_lookup_result_bits(self.tcx, self.mir, &ctxt.move_data,
@ -418,7 +418,7 @@ impl<'a, 'tcx> BitDenotation for MovingOutStatements<'a, 'tcx> {
fn statement_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MoveOutIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
idx: usize) {
let (tcx, mir, move_data) = (self.tcx, self.mir, &ctxt.move_data);
let stmt = &mir[bb].statements[idx];
@ -437,10 +437,10 @@ impl<'a, 'tcx> BitDenotation for MovingOutStatements<'a, 'tcx> {
}
let bits_per_block = self.bits_per_block(ctxt);
match stmt.kind {
repr::StatementKind::SetDiscriminant { .. } => {
mir::StatementKind::SetDiscriminant { .. } => {
span_bug!(stmt.source_info.span, "SetDiscriminant should not exist in borrowck");
}
repr::StatementKind::Assign(ref lvalue, _) => {
mir::StatementKind::Assign(ref lvalue, _) => {
// assigning into this `lvalue` kills all
// MoveOuts from it, and *also* all MoveOuts
// for children and associated fragment sets.
@ -453,16 +453,16 @@ impl<'a, 'tcx> BitDenotation for MovingOutStatements<'a, 'tcx> {
sets.kill_set.add(&moi);
});
}
repr::StatementKind::StorageLive(_) |
repr::StatementKind::StorageDead(_) |
repr::StatementKind::Nop => {}
mir::StatementKind::StorageLive(_) |
mir::StatementKind::StorageDead(_) |
mir::StatementKind::Nop => {}
}
}
fn terminator_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<MoveOutIndex>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
statements_len: usize)
{
let (mir, move_data) = (self.mir, &ctxt.move_data);
@ -481,9 +481,9 @@ impl<'a, 'tcx> BitDenotation for MovingOutStatements<'a, 'tcx> {
fn propagate_call_return(&self,
ctxt: &Self::Ctxt,
in_out: &mut IdxSet<MoveOutIndex>,
_call_bb: repr::BasicBlock,
_dest_bb: repr::BasicBlock,
dest_lval: &repr::Lvalue) {
_call_bb: mir::BasicBlock,
_dest_bb: mir::BasicBlock,
dest_lval: &mir::Lvalue) {
let move_data = &ctxt.move_data;
let bits_per_block = self.bits_per_block(ctxt);

View File

@ -13,7 +13,7 @@ use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::bitslice::{bitwise, BitwiseOperator};
use rustc::ty::TyCtxt;
use rustc::mir::repr::{self, Mir};
use rustc::mir::{self, Mir};
use std::fmt::Debug;
use std::io;
@ -78,14 +78,12 @@ impl<'a, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD>
// the kill-sets.
{
let sets = &mut self.flow_state.sets.for_block(repr::START_BLOCK.index());
let sets = &mut self.flow_state.sets.for_block(mir::START_BLOCK.index());
self.flow_state.operator.start_block_effect(&self.ctxt, sets);
}
for (bb, data) in self.mir.basic_blocks().iter_enumerated() {
let &repr::BasicBlockData { ref statements,
ref terminator,
is_cleanup: _ } = data;
let &mir::BasicBlockData { ref statements, ref terminator, is_cleanup: _ } = data;
let sets = &mut self.flow_state.sets.for_block(bb.index());
for j_stmt in 0..statements.len() {
@ -122,7 +120,7 @@ impl<'b, 'a: 'b, 'tcx: 'a, BD> PropagationContext<'b, 'a, 'tcx, BD>
in_out.subtract(sets.kill_set);
}
builder.propagate_bits_into_graph_successors_of(
in_out, &mut self.changed, (repr::BasicBlock::new(bb_idx), bb_data));
in_out, &mut self.changed, (mir::BasicBlock::new(bb_idx), bb_data));
}
}
}
@ -336,7 +334,7 @@ pub trait BitDenotation {
fn statement_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<Self::Idx>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
idx_stmt: usize);
/// Mutates the block-sets (the flow sets for the given
@ -352,7 +350,7 @@ pub trait BitDenotation {
fn terminator_effect(&self,
ctxt: &Self::Ctxt,
sets: &mut BlockSets<Self::Idx>,
bb: repr::BasicBlock,
bb: mir::BasicBlock,
idx_term: usize);
/// Mutates the block-sets according to the (flow-dependent)
@ -377,9 +375,9 @@ pub trait BitDenotation {
fn propagate_call_return(&self,
ctxt: &Self::Ctxt,
in_out: &mut IdxSet<Self::Idx>,
call_bb: repr::BasicBlock,
dest_bb: repr::BasicBlock,
dest_lval: &repr::Lvalue);
call_bb: mir::BasicBlock,
dest_bb: mir::BasicBlock,
dest_lval: &mir::Lvalue);
}
impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D>
@ -444,39 +442,39 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D>
&mut self,
in_out: &mut IdxSet<D::Idx>,
changed: &mut bool,
(bb, bb_data): (repr::BasicBlock, &repr::BasicBlockData))
(bb, bb_data): (mir::BasicBlock, &mir::BasicBlockData))
{
match bb_data.terminator().kind {
repr::TerminatorKind::Return |
repr::TerminatorKind::Resume |
repr::TerminatorKind::Unreachable => {}
repr::TerminatorKind::Goto { ref target } |
repr::TerminatorKind::Assert { ref target, cleanup: None, .. } |
repr::TerminatorKind::Drop { ref target, location: _, unwind: None } |
repr::TerminatorKind::DropAndReplace {
mir::TerminatorKind::Return |
mir::TerminatorKind::Resume |
mir::TerminatorKind::Unreachable => {}
mir::TerminatorKind::Goto { ref target } |
mir::TerminatorKind::Assert { ref target, cleanup: None, .. } |
mir::TerminatorKind::Drop { ref target, location: _, unwind: None } |
mir::TerminatorKind::DropAndReplace {
ref target, value: _, location: _, unwind: None
} => {
self.propagate_bits_into_entry_set_for(in_out, changed, target);
}
repr::TerminatorKind::Assert { ref target, cleanup: Some(ref unwind), .. } |
repr::TerminatorKind::Drop { ref target, location: _, unwind: Some(ref unwind) } |
repr::TerminatorKind::DropAndReplace {
mir::TerminatorKind::Assert { ref target, cleanup: Some(ref unwind), .. } |
mir::TerminatorKind::Drop { ref target, location: _, unwind: Some(ref unwind) } |
mir::TerminatorKind::DropAndReplace {
ref target, value: _, location: _, unwind: Some(ref unwind)
} => {
self.propagate_bits_into_entry_set_for(in_out, changed, target);
self.propagate_bits_into_entry_set_for(in_out, changed, unwind);
}
repr::TerminatorKind::If { ref targets, .. } => {
mir::TerminatorKind::If { ref targets, .. } => {
self.propagate_bits_into_entry_set_for(in_out, changed, &targets.0);
self.propagate_bits_into_entry_set_for(in_out, changed, &targets.1);
}
repr::TerminatorKind::Switch { ref targets, .. } |
repr::TerminatorKind::SwitchInt { ref targets, .. } => {
mir::TerminatorKind::Switch { ref targets, .. } |
mir::TerminatorKind::SwitchInt { ref targets, .. } => {
for target in targets {
self.propagate_bits_into_entry_set_for(in_out, changed, target);
}
}
repr::TerminatorKind::Call { ref cleanup, ref destination, func: _, args: _ } => {
mir::TerminatorKind::Call { ref cleanup, ref destination, func: _, args: _ } => {
if let Some(ref unwind) = *cleanup {
self.propagate_bits_into_entry_set_for(in_out, changed, unwind);
}
@ -494,7 +492,7 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D>
fn propagate_bits_into_entry_set_for(&mut self,
in_out: &IdxSet<D::Idx>,
changed: &mut bool,
bb: &repr::BasicBlock) {
bb: &mir::BasicBlock) {
let entry_set = self.flow_state.sets.for_block(bb.index()).on_entry;
let set_changed = bitwise(entry_set.words_mut(),
in_out.words(),

View File

@ -13,7 +13,7 @@ use syntax::ast;
use syntax_pos::Span;
use rustc::ty::{self, TyCtxt};
use rustc::mir::repr::{self, Mir};
use rustc::mir::{self, Mir};
use rustc_data_structures::indexed_vec::Idx;
use super::super::gather_moves::{MovePathIndex, LookupResult};
@ -59,13 +59,11 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
mir: &Mir<'tcx>,
ctxt: &O::Ctxt,
results: &DataflowResults<O>,
bb: repr::BasicBlock) where
bb: mir::BasicBlock) where
O: BitDenotation<Ctxt=MoveDataParamEnv<'tcx>, Idx=MovePathIndex>
{
let move_data = &ctxt.move_data;
let repr::BasicBlockData { ref statements,
ref terminator,
is_cleanup: _ } = mir[bb];
let mir::BasicBlockData { ref statements, ref terminator, is_cleanup: _ } = mir[bb];
let (args, span) = match is_rustc_peek(tcx, terminator) {
Some(args_and_span) => args_and_span,
@ -73,7 +71,7 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
};
assert!(args.len() == 1);
let peek_arg_lval = match args[0] {
repr::Operand::Consume(ref lval @ repr::Lvalue::Local(_)) => Some(lval),
mir::Operand::Consume(ref lval @ mir::Lvalue::Local(_)) => Some(lval),
_ => None,
};
@ -103,21 +101,19 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
for (j, stmt) in statements.iter().enumerate() {
debug!("rustc_peek: ({:?},{}) {:?}", bb, j, stmt);
let (lvalue, rvalue) = match stmt.kind {
repr::StatementKind::Assign(ref lvalue, ref rvalue) => {
mir::StatementKind::Assign(ref lvalue, ref rvalue) => {
(lvalue, rvalue)
}
repr::StatementKind::StorageLive(_) |
repr::StatementKind::StorageDead(_) |
repr::StatementKind::Nop => continue,
repr::StatementKind::SetDiscriminant{ .. } =>
mir::StatementKind::StorageLive(_) |
mir::StatementKind::StorageDead(_) |
mir::StatementKind::Nop => continue,
mir::StatementKind::SetDiscriminant{ .. } =>
span_bug!(stmt.source_info.span,
"sanity_check should run before Deaggregator inserts SetDiscriminant"),
};
if lvalue == peek_arg_lval {
if let repr::Rvalue::Ref(_,
repr::BorrowKind::Shared,
ref peeking_at_lval) = *rvalue {
if let mir::Rvalue::Ref(_, mir::BorrowKind::Shared, ref peeking_at_lval) = *rvalue {
// Okay, our search is over.
match move_data.rev_lookup.find(peeking_at_lval) {
LookupResult::Exact(peek_mpi) => {
@ -162,12 +158,12 @@ fn each_block<'a, 'tcx, O>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
terminator: &'a Option<repr::Terminator<'tcx>>)
-> Option<(&'a [repr::Operand<'tcx>], Span)> {
if let Some(repr::Terminator { ref kind, source_info, .. }) = *terminator {
if let repr::TerminatorKind::Call { func: ref oper, ref args, .. } = *kind
terminator: &'a Option<mir::Terminator<'tcx>>)
-> Option<(&'a [mir::Operand<'tcx>], Span)> {
if let Some(mir::Terminator { ref kind, source_info, .. }) = *terminator {
if let mir::TerminatorKind::Call { func: ref oper, ref args, .. } = *kind
{
if let repr::Operand::Constant(ref func) = *oper
if let mir::Operand::Constant(ref func) = *oper
{
if let ty::TyFnDef(def_id, _, &ty::BareFnTy { abi, .. }) = func.ty.sty
{

View File

@ -17,7 +17,7 @@ use super::{DropFlagState, MoveDataParamEnv};
use super::patch::MirPatch;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::subst::{Kind, Subst, Substs};
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::transform::{Pass, MirPass, MirSource};
use rustc::middle::const_val::ConstVal;
use rustc::middle::lang_items;

View File

@ -10,7 +10,7 @@
use rustc::ty::{self, TyCtxt, ParameterEnvironment};
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::util::nodemap::FnvHashMap;
use rustc_data_structures::indexed_vec::{IndexVec};

View File

@ -17,8 +17,7 @@ use syntax_pos::{Span, DUMMY_SP};
use rustc::hir;
use rustc::hir::intravisit::{FnKind};
use rustc::mir::repr;
use rustc::mir::repr::{BasicBlock, BasicBlockData, Mir, Statement, Terminator, Location};
use rustc::mir::{self, BasicBlock, BasicBlockData, Mir, Statement, Terminator, Location};
use rustc::session::Session;
use rustc::ty::{self, TyCtxt};
@ -214,12 +213,12 @@ fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>,
path: MovePathIndex,
mut cond: F)
-> Option<MovePathIndex>
where F: FnMut(&repr::LvalueProjection<'tcx>) -> bool
where F: FnMut(&mir::LvalueProjection<'tcx>) -> bool
{
let mut next_child = move_data.move_paths[path].first_child;
while let Some(child_index) = next_child {
match move_data.move_paths[child_index].lvalue {
repr::Lvalue::Projection(ref proj) => {
mir::Lvalue::Projection(ref proj) => {
if cond(proj) {
return Some(child_index)
}
@ -252,7 +251,7 @@ fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>,
/// FIXME: we have to do something for moving slice patterns.
fn lvalue_contents_drop_state_cannot_differ<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
mir: &Mir<'tcx>,
lv: &repr::Lvalue<'tcx>) -> bool {
lv: &mir::Lvalue<'tcx>) -> bool {
let ty = lv.ty(mir, tcx).to_ty(tcx);
match ty.sty {
ty::TyArray(..) | ty::TySlice(..) | ty::TyRef(..) | ty::TyRawPtr(..) => {
@ -339,7 +338,7 @@ fn drop_flag_effects_for_function_entry<'a, 'tcx, F>(
{
let move_data = &ctxt.move_data;
for arg in mir.args_iter() {
let lvalue = repr::Lvalue::Local(arg);
let lvalue = mir::Lvalue::Local(arg);
let lookup_result = move_data.rev_lookup.find(&lvalue);
on_lookup_result_bits(tcx, mir, move_data,
lookup_result,
@ -379,23 +378,23 @@ fn drop_flag_effects_for_location<'a, 'tcx, F>(
let block = &mir[loc.block];
match block.statements.get(loc.statement_index) {
Some(stmt) => match stmt.kind {
repr::StatementKind::SetDiscriminant{ .. } => {
mir::StatementKind::SetDiscriminant{ .. } => {
span_bug!(stmt.source_info.span, "SetDiscrimant should not exist during borrowck");
}
repr::StatementKind::Assign(ref lvalue, _) => {
mir::StatementKind::Assign(ref lvalue, _) => {
debug!("drop_flag_effects: assignment {:?}", stmt);
on_lookup_result_bits(tcx, mir, move_data,
move_data.rev_lookup.find(lvalue),
|moi| callback(moi, DropFlagState::Present))
}
repr::StatementKind::StorageLive(_) |
repr::StatementKind::StorageDead(_) |
repr::StatementKind::Nop => {}
mir::StatementKind::StorageLive(_) |
mir::StatementKind::StorageDead(_) |
mir::StatementKind::Nop => {}
},
None => {
debug!("drop_flag_effects: replace {:?}", block.terminator());
match block.terminator().kind {
repr::TerminatorKind::DropAndReplace { ref location, .. } => {
mir::TerminatorKind::DropAndReplace { ref location, .. } => {
on_lookup_result_bits(tcx, mir, move_data,
move_data.rev_lookup.find(location),
|moi| callback(moi, DropFlagState::Present))

View File

@ -9,7 +9,7 @@
// except according to those terms.
use rustc::ty::Ty;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
/// This struct represents a patch to MIR, which can add

View File

@ -11,7 +11,7 @@
use eval;
use rustc::middle::const_val::ConstVal;
use rustc::mir::repr::{Field, BorrowKind, Mutability};
use rustc::mir::{Field, BorrowKind, Mutability};
use rustc::ty::{self, TyCtxt, AdtDef, Ty, Region};
use rustc::hir::{self, PatKind};
use rustc::hir::def::Def;

View File

@ -23,7 +23,7 @@ use rustc::hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX};
use rustc::dep_graph::DepNode;
use rustc::hir::map as hir_map;
use rustc::hir::map::DefKey;
use rustc::mir::repr::Mir;
use rustc::mir::Mir;
use rustc::mir::mir_map::MirMap;
use rustc::util::nodemap::{NodeSet, DefIdMap};
use rustc_back::PanicStrategy;

View File

@ -30,7 +30,7 @@ use rustc::ty::subst::Substs;
use rustc_const_math::ConstInt;
use rustc::mir::repr::Mir;
use rustc::mir::Mir;
use std::borrow::Cow;
use std::cell::Ref;

View File

@ -605,7 +605,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
}))
}
fn encode_mir(&mut self, def_id: DefId) -> Option<Lazy<mir::repr::Mir<'tcx>>> {
fn encode_mir(&mut self, def_id: DefId) -> Option<Lazy<mir::Mir<'tcx>>> {
self.mir_map.map.get(&def_id).map(|mir| self.lazy(mir))
}

View File

@ -221,7 +221,7 @@ pub struct Entry<'tcx> {
pub predicates: Option<Lazy<ty::GenericPredicates<'tcx>>>,
pub ast: Option<Lazy<astencode::Ast<'tcx>>>,
pub mir: Option<Lazy<mir::repr::Mir<'tcx>>>,
pub mir: Option<Lazy<mir::Mir<'tcx>>>,
}
#[derive(Copy, Clone, RustcEncodable, RustcDecodable)]

View File

@ -10,7 +10,7 @@
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::hir;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

View File

@ -14,7 +14,7 @@
//! Routines for manipulating the control-flow graph.
use build::CFG;
use rustc::mir::repr::*;
use rustc::mir::*;
impl<'tcx> CFG<'tcx> {
pub fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> {

View File

@ -12,7 +12,7 @@
use build::Builder;
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// Compile `expr`, yielding a compile-time constant. Assumes that

View File

@ -13,7 +13,7 @@
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::Category;
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc_data_structures::indexed_vec::Idx;

View File

@ -13,7 +13,7 @@
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::Category;
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// Compile `expr` into a value that can be used as an operand.

View File

@ -22,7 +22,7 @@ use hair::*;
use rustc_const_math::{ConstInt, ConstIsize};
use rustc::middle::const_val::ConstVal;
use rustc::ty;
use rustc::mir::repr::*;
use rustc::mir::*;
use syntax::ast;
use syntax_pos::Span;

View File

@ -13,7 +13,7 @@
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::Category;
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// Compile `expr` into a fresh temporary. This is used when building

View File

@ -14,7 +14,7 @@ use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::{Category, RvalueFunc};
use hair::*;
use rustc::ty;
use rustc::mir::repr::*;
use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
/// Compile `expr`, storing the result into `destination`, which

View File

@ -12,7 +12,7 @@ use build::{BlockAnd, BlockAndExtension, Builder};
use build::scope::LoopScope;
use hair::*;
use rustc::middle::region::CodeExtent;
use rustc::mir::repr::*;
use rustc::mir::*;
use syntax_pos::Span;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

View File

@ -16,7 +16,7 @@
use build::{BlockAnd, Builder};
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
pub trait EvalInto<'tcx> {
fn eval_into<'a, 'gcx>(self,

View File

@ -18,7 +18,7 @@ use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::bitvec::BitVector;
use rustc::middle::const_val::ConstVal;
use rustc::ty::{AdtDef, Ty};
use rustc::mir::repr::*;
use rustc::mir::*;
use hair::*;
use syntax::ast::{Name, NodeId};
use syntax_pos::Span;

View File

@ -25,7 +25,7 @@
use build::{BlockAnd, BlockAndExtension, Builder};
use build::matches::{Binding, MatchPair, Candidate};
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
use std::mem;

View File

@ -22,7 +22,7 @@ use rustc_data_structures::fnv::FnvHashMap;
use rustc_data_structures::bitvec::BitVector;
use rustc::middle::const_val::ConstVal;
use rustc::ty::{self, Ty};
use rustc::mir::repr::*;
use rustc::mir::*;
use syntax_pos::Span;
use std::cmp::Ordering;

View File

@ -11,7 +11,7 @@
use build::Builder;
use build::matches::MatchPair;
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
use std::u32;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

View File

@ -17,7 +17,7 @@ use rustc_const_math::{ConstInt, ConstUsize, ConstIsize};
use rustc::middle::const_val::ConstVal;
use rustc::ty::{self, Ty};
use rustc::mir::repr::*;
use rustc::mir::*;
use syntax::ast;
use syntax_pos::Span;

View File

@ -13,7 +13,7 @@ use hair::Pattern;
use rustc::middle::region::{CodeExtent, CodeExtentData, ROOT_CODE_EXTENT};
use rustc::ty::{self, Ty};
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::util::nodemap::NodeMap;
use rustc::hir;
use syntax::abi::Abi;

View File

@ -91,7 +91,7 @@ use rustc::middle::region::{CodeExtent, CodeExtentData};
use rustc::middle::lang_items;
use rustc::ty::subst::{Kind, Subst};
use rustc::ty::{Ty, TyCtxt};
use rustc::mir::repr::*;
use rustc::mir::*;
use syntax_pos::Span;
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::fnv::FnvHashMap;

View File

@ -10,7 +10,7 @@
//! Def-use analysis.
use rustc::mir::repr::{Local, Location, Lvalue, Mir};
use rustc::mir::{Local, Location, Lvalue, Mir};
use rustc::mir::visit::{LvalueContext, MutVisitor, Visitor};
use rustc_data_structures::indexed_vec::IndexVec;
use std::marker::PhantomData;

View File

@ -10,7 +10,7 @@
use dot;
use rustc::hir::def_id::DefId;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::mir_map::MirMap;
use rustc::ty::TyCtxt;
use std::fmt::Debug;

View File

@ -21,7 +21,7 @@ use rustc_const_eval as const_eval;
use rustc::middle::region::CodeExtent;
use rustc::ty::{self, AdtKind, VariantDef, Ty};
use rustc::ty::cast::CastKind as TyCastKind;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::hir;
use syntax::ptr::P;

View File

@ -16,7 +16,7 @@
*/
use hair::*;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::transform::MirSource;
use rustc::middle::const_val::ConstVal;

View File

@ -14,7 +14,7 @@
//! unit-tested and separated from the Rust source and compiler data
//! structures.
use rustc::mir::repr::{BinOp, BorrowKind, Field, Literal, UnOp, TypedConstVal};
use rustc::mir::{BinOp, BorrowKind, Field, Literal, UnOp, TypedConstVal};
use rustc::hir::def_id::DefId;
use rustc::middle::region::CodeExtent;
use rustc::ty::subst::Substs;

View File

@ -19,7 +19,7 @@
use build;
use rustc::dep_graph::DepNode;
use rustc::hir::def_id::DefId;
use rustc::mir::repr::Mir;
use rustc::mir::Mir;
use rustc::mir::transform::MirSource;
use rustc::mir::visit::MutVisitor;
use pretty;

View File

@ -11,7 +11,7 @@
use build::{ScopeAuxiliaryVec, ScopeId};
use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::mir_map::MirMap;
use rustc::mir::transform::MirSource;
use rustc::ty::TyCtxt;

View File

@ -9,7 +9,7 @@
// except according to those terms.
use rustc::ty::TyCtxt;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};

View File

@ -30,7 +30,7 @@
//! future.
use def_use::DefUseAnalysis;
use rustc::mir::repr::{Constant, Local, Location, Lvalue, Mir, Operand, Rvalue, StatementKind};
use rustc::mir::{Constant, Local, Location, Lvalue, Mir, Operand, Rvalue, StatementKind};
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc::mir::visit::MutVisitor;
use rustc::ty::TyCtxt;

View File

@ -9,7 +9,7 @@
// except according to those terms.
use rustc::ty::TyCtxt;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc_data_structures::indexed_vec::Idx;

View File

@ -13,7 +13,7 @@
use std::fmt;
use rustc::ty::TyCtxt;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::transform::{Pass, MirPass, MirPassHook, MirSource};
use pretty;

View File

@ -14,7 +14,7 @@
use rustc::ty::subst::Substs;
use rustc::ty::{Ty, TyCtxt};
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::visit::MutVisitor;
use rustc::mir::transform::{MirPass, MirSource, Pass};

View File

@ -10,7 +10,7 @@
//! Performs various peephole optimizations.
use rustc::mir::repr::{Location, Lvalue, Mir, Operand, ProjectionElem, Rvalue, Local};
use rustc::mir::{Location, Lvalue, Mir, Operand, ProjectionElem, Rvalue, Local};
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc::mir::visit::{MutVisitor, Visitor};
use rustc::ty::TyCtxt;

View File

@ -12,7 +12,7 @@
//! specified.
use rustc::ty::TyCtxt;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::visit::MutVisitor;
use rustc::mir::transform::{Pass, MirPass, MirSource};

View File

@ -22,7 +22,7 @@
//! initialization and can otherwise silence errors, if
//! move analysis runs after promotion on broken MIR.
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::visit::{LvalueContext, MutVisitor, Visitor};
use rustc::mir::traversal::ReversePostorder;
use rustc::ty::TyCtxt;

View File

@ -25,9 +25,9 @@ use rustc::hir::map::blocks::FnLikeNode;
use rustc::traits::{self, Reveal};
use rustc::ty::{self, TyCtxt, Ty};
use rustc::ty::cast::CastTy;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::mir_map::MirMap;
use rustc::mir::traversal::{self, ReversePostorder};
use rustc::mir::traversal::ReversePostorder;
use rustc::mir::transform::{Pass, MirMapPass, MirPassHook, MirSource};
use rustc::mir::visit::{LvalueContext, Visitor};
use rustc::util::nodemap::DefIdMap;

View File

@ -13,7 +13,7 @@
use rustc::ty::TyCtxt;
use rustc::middle::const_val::ConstVal;
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc::mir::repr::*;
use rustc::mir::*;
use std::fmt;

View File

@ -35,9 +35,8 @@
use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc::ty::TyCtxt;
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc::mir::traversal;
use std::fmt;
pub struct SimplifyCfg<'a> { label: &'a str }

View File

@ -15,10 +15,10 @@ use rustc::infer::{self, InferCtxt, InferOk};
use rustc::traits::{self, Reveal};
use rustc::ty::fold::TypeFoldable;
use rustc::ty::{self, Ty, TyCtxt, TypeVariants};
use rustc::mir::repr::*;
use rustc::mir::*;
use rustc::mir::tcx::LvalueTy;
use rustc::mir::transform::{MirPass, MirSource, Pass};
use rustc::mir::visit::{self, Visitor};
use rustc::mir::visit::Visitor;
use std::fmt;
use syntax::ast;
use syntax_pos::{Span, DUMMY_SP};

View File

@ -198,10 +198,9 @@ use rustc::traits;
use rustc::ty::subst::{Substs, Subst};
use rustc::ty::{self, TypeFoldable, TyCtxt};
use rustc::ty::adjustment::CustomCoerceUnsized;
use rustc::mir::repr as mir;
use rustc::mir::{self, Location};
use rustc::mir::visit as mir_visit;
use rustc::mir::visit::Visitor as MirVisitor;
use rustc::mir::repr::Location;
use rustc_const_eval as const_eval;

View File

@ -16,7 +16,7 @@ use rustc::hir::def::ExportMap;
use rustc::hir::def_id::DefId;
use rustc::traits;
use rustc::mir::mir_map::MirMap;
use rustc::mir::repr as mir;
use rustc::mir;
use base;
use builder::Builder;
use common::BuilderRef_res;

View File

@ -15,7 +15,7 @@ use super::utils::{DIB, span_start};
use llvm;
use llvm::debuginfo::{DIScope, DISubprogram};
use common::{CrateContext, FunctionContext};
use rustc::mir::repr::{Mir, VisibilityScope};
use rustc::mir::{Mir, VisibilityScope};
use libc::c_uint;
use std::ptr;

View File

@ -32,7 +32,7 @@ use abi::Abi;
use common::{CrateContext, FunctionContext, Block, BlockAndBuilder};
use monomorphize::{self, Instance};
use rustc::ty::{self, Ty};
use rustc::mir::repr as mir;
use rustc::mir;
use session::config::{self, FullDebugInfo, LimitedDebugInfo, NoDebugInfo};
use util::nodemap::{DefIdMap, FnvHashMap, FnvHashSet};

View File

@ -13,9 +13,7 @@
use rustc_data_structures::bitvec::BitVector;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc::mir::repr as mir;
use rustc::mir::repr::TerminatorKind;
use rustc::mir::repr::Location;
use rustc::mir::{self, Location, TerminatorKind};
use rustc::mir::visit::{Visitor, LvalueContext};
use rustc::mir::traversal;
use common::{self, Block, BlockAndBuilder};

View File

@ -12,7 +12,7 @@ use llvm::{self, ValueRef};
use rustc_const_eval::{ErrKind, ConstEvalErr, note_const_eval_err};
use rustc::middle::lang_items;
use rustc::ty;
use rustc::mir::repr as mir;
use rustc::mir;
use abi::{Abi, FnType, ArgType};
use adt;
use base;

View File

@ -16,7 +16,7 @@ use rustc_const_math::ConstFloat::*;
use rustc_const_math::{ConstInt, ConstIsize, ConstUsize, ConstMathErr};
use rustc::hir::def_id::DefId;
use rustc::infer::TransNormalize;
use rustc::mir::repr as mir;
use rustc::mir;
use rustc::mir::tcx::LvalueTy;
use rustc::traits;
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};

View File

@ -10,7 +10,7 @@
use llvm::ValueRef;
use rustc::ty::{self, Ty, TypeFoldable};
use rustc::mir::repr as mir;
use rustc::mir;
use rustc::mir::tcx::LvalueTy;
use rustc_data_structures::indexed_vec::Idx;
use adt;

View File

@ -11,7 +11,7 @@
use libc::c_uint;
use llvm::{self, ValueRef};
use rustc::ty;
use rustc::mir::repr as mir;
use rustc::mir;
use rustc::mir::tcx::LvalueTy;
use session::config::FullDebugInfo;
use base;

View File

@ -10,7 +10,7 @@
use llvm::ValueRef;
use rustc::ty::Ty;
use rustc::mir::repr as mir;
use rustc::mir;
use rustc_data_structures::indexed_vec::Idx;
use base;

View File

@ -12,7 +12,7 @@ use llvm::{self, ValueRef};
use rustc::ty::{self, Ty};
use rustc::ty::cast::{CastTy, IntTy};
use rustc::ty::layout::Layout;
use rustc::mir::repr as mir;
use rustc::mir;
use asm;
use base;

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use rustc::mir::repr as mir;
use rustc::mir;
use base;
use common::{self, BlockAndBuilder};

View File

@ -19,7 +19,7 @@ extern crate rustc_const_math;
extern crate syntax;
use rustc::mir::transform::{self, MirPass, MirSource};
use rustc::mir::repr::{Mir, Literal, Location};
use rustc::mir::{Mir, Literal, Location};
use rustc::mir::visit::MutVisitor;
use rustc::ty::TyCtxt;
use rustc::middle::const_val::ConstVal;