Auto merge of - michaelwoerister:mir-repr-to-librustc, r=nikomatsakis

This is done mostly so that we can refer to MIR types in csearch and other metadata related area.

Heads up, @rust-lang/compiler!

r? @nikomatsakis
This commit is contained in:
bors 2015-11-30 14:18:28 +00:00
commit 8bc43ed59d
41 changed files with 73 additions and 64 deletions

@ -136,6 +136,12 @@ pub mod middle {
pub mod weak_lang_items;
}
pub mod mir {
pub mod repr;
pub mod tcx;
pub mod visit;
}
pub mod session;
pub mod lint;

@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use rustc::middle::const_eval::ConstVal;
use rustc::middle::def_id::DefId;
use rustc::middle::subst::Substs;
use rustc::middle::ty::{AdtDef, ClosureSubsts, FnOutput, Region, Ty};
use middle::const_eval::ConstVal;
use middle::def_id::DefId;
use middle::subst::Substs;
use middle::ty::{AdtDef, ClosureSubsts, FnOutput, Region, Ty};
use rustc_back::slice;
use rustc_front::hir::InlineAsm;
use syntax::ast::Name;

@ -13,9 +13,9 @@
* building is complete.
*/
use repr::*;
use rustc::middle::subst::Substs;
use rustc::middle::ty::{self, AdtDef, Ty};
use mir::repr::*;
use middle::subst::Substs;
use middle::ty::{self, AdtDef, Ty};
use rustc_front::hir;
#[derive(Copy, Clone, Debug)]

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use rustc::middle::ty::Region;
use repr::*;
use middle::ty::Region;
use mir::repr::*;
pub trait Visitor<'tcx> {
// Override these, and call `self.super_xxx` to revert back to the

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

@ -14,7 +14,7 @@
//! Routines for manipulating the control-flow graph.
use build::CFG;
use repr::*;
use rustc::mir::repr::*;
use syntax::codemap::Span;
impl<'tcx> CFG<'tcx> {

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

@ -10,10 +10,10 @@
//! See docs in build/expr/mod.rs
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::Category;
use hair::*;
use repr::*;
use rustc::mir::repr::*;
impl<'a,'tcx> Builder<'a,'tcx> {
/// Compile `expr`, yielding an lvalue that we can move from etc.

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

@ -12,10 +12,10 @@
use rustc_data_structures::fnv::FnvHashMap;
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::{Category, RvalueFunc};
use hair::*;
use repr::*;
use rustc::mir::repr::*;
impl<'a,'tcx> Builder<'a,'tcx> {
/// Compile `expr`, yielding an rvalue.

@ -10,10 +10,10 @@
//! See docs in build/expr/mod.rs
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::Category;
use hair::*;
use repr::*;
use rustc::mir::repr::*;
impl<'a,'tcx> Builder<'a,'tcx> {
/// Compile `expr` into a fresh temporary. This is used when building

@ -10,12 +10,12 @@
//! See docs in build/expr/mod.rs
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::expr::category::{Category, RvalueFunc};
use build::scope::LoopScope;
use hair::*;
use repr::*;
use rustc::middle::region::CodeExtent;
use rustc::mir::repr::*;
use syntax::codemap::Span;
impl<'a,'tcx> Builder<'a,'tcx> {

@ -14,9 +14,9 @@
//! wrapped up as expressions (e.g. blocks). To make this ergonomic, we use this
//! latter `EvalInto` trait.
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use repr::*;
use rustc::mir::repr::*;
pub trait EvalInto<'tcx> {
fn eval_into<'a>(self,

@ -13,12 +13,12 @@
//! includes the high-level algorithm, the submodules contain the
//! details.
use build::{BlockAnd, Builder};
use repr::*;
use build::{BlockAnd, BlockAndExtension, Builder};
use rustc_data_structures::fnv::FnvHashMap;
use rustc::middle::const_eval::ConstVal;
use rustc::middle::region::CodeExtent;
use rustc::middle::ty::{AdtDef, Ty};
use rustc::mir::repr::*;
use hair::*;
use syntax::ast::{Name, NodeId};
use syntax::codemap::Span;

@ -22,10 +22,10 @@
//! sort of test: for example, testing which variant an enum is, or
//! testing a value against a constant.
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::matches::{Binding, MatchPair, Candidate};
use hair::*;
use repr::*;
use rustc::mir::repr::*;
use std::mem;

@ -18,10 +18,10 @@
use build::Builder;
use build::matches::{Candidate, MatchPair, Test, TestKind};
use hair::*;
use repr::*;
use rustc_data_structures::fnv::FnvHashMap;
use rustc::middle::const_eval::ConstVal;
use rustc::middle::ty::{self, Ty};
use rustc::mir::repr::*;
use syntax::codemap::Span;
impl<'a,'tcx> Builder<'a,'tcx> {

@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::matches::MatchPair;
use hair::*;
use repr::*;
use rustc::mir::repr::*;
use std::u32;
impl<'a,'tcx> Builder<'a,'tcx> {

@ -13,8 +13,8 @@
use build::Builder;
use hair::*;
use repr::*;
use rustc::middle::ty::Ty;
use rustc::mir::repr::*;
use std::u32;
use syntax::codemap::Span;

@ -11,9 +11,10 @@
use hair::cx::Cx;
use rustc::middle::region::CodeExtent;
use rustc::middle::ty::{FnOutput, Ty};
use rustc::mir::repr::*;
use rustc_data_structures::fnv::FnvHashMap;
use rustc_front::hir;
use repr::*;
use syntax::ast;
use syntax::codemap::Span;
@ -41,7 +42,12 @@ struct CFG<'tcx> {
#[must_use] // if you don't use one of these results, you're leaving a dangling edge
struct BlockAnd<T>(BasicBlock, T);
impl BasicBlock {
trait BlockAndExtension {
fn and<T>(self, v: T) -> BlockAnd<T>;
fn unit(self) -> BlockAnd<()>;
}
impl BlockAndExtension for BasicBlock {
fn and<T>(self, v: T) -> BlockAnd<T> {
BlockAnd(self, v)
}

@ -86,10 +86,10 @@ should go to.
*/
use build::{BlockAnd, Builder, CFG};
use repr::*;
use build::{BlockAnd, BlockAndExtension, Builder, CFG};
use rustc::middle::region::CodeExtent;
use rustc::middle::ty::Ty;
use rustc::mir::repr::*;
use syntax::codemap::Span;
pub struct Scope<'tcx> {

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use build::{BlockAnd, Builder};
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use repr::*;
use rustc::mir::repr::*;
impl<'a,'tcx> Builder<'a,'tcx> {
pub fn stmts(&mut self, mut block: BasicBlock, stmts: Vec<StmtRef<'tcx>>) -> BlockAnd<()> {

@ -9,7 +9,7 @@
// except according to those terms.
use dot;
use repr::*;
use rustc::mir::repr::*;
use std::borrow::IntoCow;
#[derive(Copy, Clone, PartialEq, Eq)]

@ -9,7 +9,6 @@
// except according to those terms.
use hair::*;
use repr::*;
use rustc_data_structures::fnv::FnvHashMap;
use hair::cx::Cx;
use hair::cx::block;
@ -19,6 +18,7 @@ use rustc::middle::def;
use rustc::middle::region::CodeExtent;
use rustc::middle::pat_util;
use rustc::middle::ty::{self, VariantDef, Ty};
use rustc::mir::repr::*;
use rustc_front::hir;
use rustc_front::util as hir_util;
use syntax::ext::mtwt;

@ -16,7 +16,7 @@
*/
use hair::*;
use repr::*;
use rustc::mir::repr::*;
use rustc::middle::const_eval::{self, ConstVal};
use rustc::middle::def_id::DefId;

@ -10,13 +10,13 @@
use hair::*;
use hair::cx::Cx;
use repr::*;
use rustc_data_structures::fnv::FnvHashMap;
use rustc::middle::const_eval;
use rustc::middle::def;
use rustc::middle::pat_util::{pat_is_resolved_const, pat_is_binding};
use rustc::middle::subst::Substs;
use rustc::middle::ty::{self, Ty};
use rustc::mir::repr::*;
use rustc_front::hir;
use syntax::ast;
use syntax::ext::mtwt;

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

@ -32,9 +32,6 @@ extern crate syntax;
pub mod build;
pub mod mir_map;
mod hair;
pub mod repr;
mod graphviz;
pub mod transform;
pub mod tcx;
pub mod visit;

@ -23,7 +23,7 @@ extern crate rustc_front;
use build;
use dot;
use transform::*;
use repr::Mir;
use rustc::mir::repr::Mir;
use hair::cx::Cx;
use std::fs::File;

@ -12,8 +12,8 @@
//! We want to do this once just before trans, so trans does not have to take
//! care erasing regions all over the place.
use repr::*;
use rustc::middle::ty;
use rustc::mir::repr::*;
use transform::MirPass;
use mir_map::MirMap;

@ -12,7 +12,7 @@ pub mod simplify_cfg;
pub mod erase_regions;
mod util;
use repr::Mir;
use rustc::mir::repr::Mir;
pub trait MirPass<'tcx> {
fn run_on_mir(&mut self, mir: &mut Mir<'tcx>);

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use repr::*;
use rustc::middle::const_eval::ConstVal;
use rustc::mir::repr::*;
use std::mem;
use transform::util;
use transform::MirPass;

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use repr::*;
use rustc::mir::repr::*;
/// Update basic block ids in all terminators using the given replacements,
/// useful e.g. after removal of several basic blocks to update all terminators

@ -40,7 +40,7 @@ use middle::traits;
use middle::ty::{self, HasTypeFlags, Ty};
use middle::ty::fold::{TypeFolder, TypeFoldable};
use rustc_front::hir;
use rustc_mir::repr::Mir;
use rustc::mir::repr::Mir;
use util::nodemap::{FnvHashMap, NodeMap};
use arena::TypedArena;
@ -1223,4 +1223,4 @@ pub fn get_static_val<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
} else {
base::get_extern_const(ccx, did, ty)
}
}
}

@ -12,8 +12,8 @@
//! which do not.
use rustc_data_structures::fnv::FnvHashSet;
use rustc_mir::repr as mir;
use rustc_mir::visit::{Visitor, LvalueContext};
use rustc::mir::repr as mir;
use rustc::mir::visit::{Visitor, LvalueContext};
use trans::common::{self, Block};
use super::rvalue;

@ -9,7 +9,7 @@
// except according to those terms.
use llvm::BasicBlockRef;
use rustc_mir::repr as mir;
use rustc::mir::repr as mir;
use trans::base;
use trans::build;
use trans::common::Block;

@ -10,7 +10,7 @@
use middle::ty::{Ty, HasTypeFlags};
use rustc::middle::const_eval::ConstVal;
use rustc_mir::repr as mir;
use rustc::mir::repr as mir;
use trans::consts::{self, TrueConst};
use trans::common::{self, Block};
use trans::common::{C_bool, C_bytes, C_floating_f64, C_integral, C_str_slice};

@ -10,8 +10,8 @@
use llvm::ValueRef;
use rustc::middle::ty::{self, Ty, HasTypeFlags};
use rustc_mir::repr as mir;
use rustc_mir::tcx::LvalueTy;
use rustc::mir::repr as mir;
use rustc::mir::tcx::LvalueTy;
use trans::adt;
use trans::base;
use trans::build;

@ -10,8 +10,8 @@
use libc::c_uint;
use llvm::{self, ValueRef};
use rustc_mir::repr as mir;
use rustc_mir::tcx::LvalueTy;
use rustc::mir::repr as mir;
use rustc::mir::tcx::LvalueTy;
use trans::base;
use trans::build;
use trans::common::{self, Block};

@ -10,7 +10,7 @@
use llvm::ValueRef;
use rustc::middle::ty::{Ty, HasTypeFlags};
use rustc_mir::repr as mir;
use rustc::mir::repr as mir;
use trans::base;
use trans::common::{self, Block};
use trans::datum;

@ -10,7 +10,7 @@
use llvm::ValueRef;
use rustc::middle::ty::{self, Ty};
use rustc_mir::repr as mir;
use rustc::mir::repr as mir;
use trans::asm;
use trans::base;

@ -9,7 +9,7 @@
// except according to those terms.
use rustc::middle::ty::LvaluePreference;
use rustc_mir::repr as mir;
use rustc::mir::repr as mir;
use trans::common::Block;
use trans::debuginfo::DebugLoc;
use trans::glue;