Skip to content

Commit 4825360

Browse files
committed
Renames mir::Mir to mir::Body
1 parent bfb443e commit 4825360

File tree

133 files changed

+515
-515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+515
-515
lines changed

src/librustc/infer/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl SuppressRegionErrors {
9797

9898
// If we're on MIR or Compare mode, don't report AST region errors as they should
9999
// be reported by NLL
100-
BorrowckMode::Compare | BorrowckMode::Mir => SuppressRegionErrors { suppressed: true },
100+
BorrowckMode::Compare | BorrowckMode::Body => SuppressRegionErrors { suppressed: true },
101101
}
102102
}
103103
}

src/librustc/mir/cache.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use rustc_data_structures::sync::{RwLock, MappedReadGuard, ReadGuard};
33
use rustc_data_structures::stable_hasher::{HashStable, StableHasher,
44
StableHasherResult};
55
use crate::ich::StableHashingContext;
6-
use crate::mir::{Mir, BasicBlock};
6+
use crate::mir::{Body, BasicBlock};
77

88
use crate::rustc_serialize as serialize;
99

@@ -47,7 +47,7 @@ impl Cache {
4747

4848
pub fn predecessors(
4949
&self,
50-
mir: &Mir<'_>
50+
mir: &Body<'_>
5151
) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
5252
if self.predecessors.borrow().is_none() {
5353
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
@@ -57,7 +57,7 @@ impl Cache {
5757
}
5858
}
5959

60-
fn calculate_predecessors(mir: &Mir<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
60+
fn calculate_predecessors(mir: &Body<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
6161
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
6262
for (bb, data) in mir.basic_blocks().iter_enumerated() {
6363
if let Some(ref term) = data.terminator {

src/librustc/mir/interpret/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub struct GlobalId<'tcx> {
4747
/// For a promoted global, the `Instance` of the function they belong to.
4848
pub instance: ty::Instance<'tcx>,
4949

50-
/// The index for promoted globals within their function's `Mir`.
50+
/// The index for promoted globals within their function's `Body`.
5151
pub promoted: Option<mir::Promoted>,
5252
}
5353

src/librustc/mir/mod.rs

+21-21
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl<'tcx> HasLocalDecls<'tcx> for LocalDecls<'tcx> {
6060
}
6161
}
6262

63-
impl<'tcx> HasLocalDecls<'tcx> for Mir<'tcx> {
63+
impl<'tcx> HasLocalDecls<'tcx> for Body<'tcx> {
6464
fn local_decls(&self) -> &LocalDecls<'tcx> {
6565
&self.local_decls
6666
}
@@ -86,7 +86,7 @@ impl MirPhase {
8686

8787
/// Lowered representation of a single function.
8888
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
89-
pub struct Mir<'tcx> {
89+
pub struct Body<'tcx> {
9090
/// List of basic blocks. References to basic block use a newtyped index type `BasicBlock`
9191
/// that indexes into this vector.
9292
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
@@ -107,15 +107,15 @@ pub struct Mir<'tcx> {
107107
pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
108108

109109
/// Rvalues promoted from this function, such as borrows of constants.
110-
/// Each of them is the Mir of a constant with the fn's type parameters
110+
/// Each of them is the Body of a constant with the fn's type parameters
111111
/// in scope, but a separate set of locals.
112-
pub promoted: IndexVec<Promoted, Mir<'tcx>>,
112+
pub promoted: IndexVec<Promoted, Body<'tcx>>,
113113

114114
/// Yields type of the function, if it is a generator.
115115
pub yield_ty: Option<Ty<'tcx>>,
116116

117117
/// Generator drop glue
118-
pub generator_drop: Option<Box<Mir<'tcx>>>,
118+
pub generator_drop: Option<Box<Body<'tcx>>>,
119119

120120
/// The layout of a generator. Produced by the state transformation.
121121
pub generator_layout: Option<GeneratorLayout<'tcx>>,
@@ -167,12 +167,12 @@ pub struct Mir<'tcx> {
167167
cache: cache::Cache,
168168
}
169169

170-
impl<'tcx> Mir<'tcx> {
170+
impl<'tcx> Body<'tcx> {
171171
pub fn new(
172172
basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
173173
source_scopes: IndexVec<SourceScope, SourceScopeData>,
174174
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
175-
promoted: IndexVec<Promoted, Mir<'tcx>>,
175+
promoted: IndexVec<Promoted, Body<'tcx>>,
176176
yield_ty: Option<Ty<'tcx>>,
177177
local_decls: LocalDecls<'tcx>,
178178
user_type_annotations: CanonicalUserTypeAnnotations<'tcx>,
@@ -189,7 +189,7 @@ impl<'tcx> Mir<'tcx> {
189189
local_decls.len()
190190
);
191191

192-
Mir {
192+
Body {
193193
phase: MirPhase::Build,
194194
basic_blocks,
195195
source_scopes,
@@ -423,7 +423,7 @@ pub enum Safety {
423423
ExplicitUnsafe(hir::HirId),
424424
}
425425

426-
impl_stable_hash_for!(struct Mir<'tcx> {
426+
impl_stable_hash_for!(struct Body<'tcx> {
427427
phase,
428428
basic_blocks,
429429
source_scopes,
@@ -442,7 +442,7 @@ impl_stable_hash_for!(struct Mir<'tcx> {
442442
cache
443443
});
444444

445-
impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
445+
impl<'tcx> Index<BasicBlock> for Body<'tcx> {
446446
type Output = BasicBlockData<'tcx>;
447447

448448
#[inline]
@@ -451,7 +451,7 @@ impl<'tcx> Index<BasicBlock> for Mir<'tcx> {
451451
}
452452
}
453453

454-
impl<'tcx> IndexMut<BasicBlock> for Mir<'tcx> {
454+
impl<'tcx> IndexMut<BasicBlock> for Body<'tcx> {
455455
#[inline]
456456
fn index_mut(&mut self, index: BasicBlock) -> &mut BasicBlockData<'tcx> {
457457
&mut self.basic_blocks_mut()[index]
@@ -599,7 +599,7 @@ newtype_index! {
599599
}
600600
}
601601

602-
/// Classifies locals into categories. See `Mir::local_kind`.
602+
/// Classifies locals into categories. See `Body::local_kind`.
603603
#[derive(PartialEq, Eq, Debug, HashStable)]
604604
pub enum LocalKind {
605605
/// User-declared variable binding
@@ -2853,23 +2853,23 @@ fn def_path_str(def_id: DefId) -> String {
28532853
ty::tls::with(|tcx| tcx.def_path_str(def_id))
28542854
}
28552855

2856-
impl<'tcx> graph::DirectedGraph for Mir<'tcx> {
2856+
impl<'tcx> graph::DirectedGraph for Body<'tcx> {
28572857
type Node = BasicBlock;
28582858
}
28592859

2860-
impl<'tcx> graph::WithNumNodes for Mir<'tcx> {
2860+
impl<'tcx> graph::WithNumNodes for Body<'tcx> {
28612861
fn num_nodes(&self) -> usize {
28622862
self.basic_blocks.len()
28632863
}
28642864
}
28652865

2866-
impl<'tcx> graph::WithStartNode for Mir<'tcx> {
2866+
impl<'tcx> graph::WithStartNode for Body<'tcx> {
28672867
fn start_node(&self) -> Self::Node {
28682868
START_BLOCK
28692869
}
28702870
}
28712871

2872-
impl<'tcx> graph::WithPredecessors for Mir<'tcx> {
2872+
impl<'tcx> graph::WithPredecessors for Body<'tcx> {
28732873
fn predecessors<'graph>(
28742874
&'graph self,
28752875
node: Self::Node,
@@ -2878,7 +2878,7 @@ impl<'tcx> graph::WithPredecessors for Mir<'tcx> {
28782878
}
28792879
}
28802880

2881-
impl<'tcx> graph::WithSuccessors for Mir<'tcx> {
2881+
impl<'tcx> graph::WithSuccessors for Body<'tcx> {
28822882
fn successors<'graph>(
28832883
&'graph self,
28842884
node: Self::Node,
@@ -2887,12 +2887,12 @@ impl<'tcx> graph::WithSuccessors for Mir<'tcx> {
28872887
}
28882888
}
28892889

2890-
impl<'a, 'b> graph::GraphPredecessors<'b> for Mir<'a> {
2890+
impl<'a, 'b> graph::GraphPredecessors<'b> for Body<'a> {
28912891
type Item = BasicBlock;
28922892
type Iter = IntoIter<BasicBlock>;
28932893
}
28942894

2895-
impl<'a, 'b> graph::GraphSuccessors<'b> for Mir<'a> {
2895+
impl<'a, 'b> graph::GraphSuccessors<'b> for Body<'a> {
28962896
type Item = BasicBlock;
28972897
type Iter = iter::Cloned<Successors<'b>>;
28982898
}
@@ -2931,7 +2931,7 @@ impl Location {
29312931
}
29322932

29332933
/// Returns `true` if `other` is earlier in the control flow graph than `self`.
2934-
pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Mir<'tcx>) -> bool {
2934+
pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Body<'tcx>) -> bool {
29352935
// If we are in the same block as the other location and are an earlier statement
29362936
// then we are a predecessor of `other`.
29372937
if self.block == other.block && self.statement_index < other.statement_index {
@@ -3165,7 +3165,7 @@ CloneTypeFoldableAndLiftImpls! {
31653165
}
31663166

31673167
BraceStructTypeFoldableImpl! {
3168-
impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> {
3168+
impl<'tcx> TypeFoldable<'tcx> for Body<'tcx> {
31693169
phase,
31703170
basic_blocks,
31713171
source_scopes,

src/librustc/mir/traversal.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ use super::*;
2121
/// A preorder traversal of this graph is either `A B D C` or `A C D B`
2222
#[derive(Clone)]
2323
pub struct Preorder<'a, 'tcx: 'a> {
24-
mir: &'a Mir<'tcx>,
24+
mir: &'a Body<'tcx>,
2525
visited: BitSet<BasicBlock>,
2626
worklist: Vec<BasicBlock>,
2727
root_is_start_block: bool,
2828
}
2929

3030
impl<'a, 'tcx> Preorder<'a, 'tcx> {
31-
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Preorder<'a, 'tcx> {
31+
pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> Preorder<'a, 'tcx> {
3232
let worklist = vec![root];
3333

3434
Preorder {
@@ -40,7 +40,7 @@ impl<'a, 'tcx> Preorder<'a, 'tcx> {
4040
}
4141
}
4242

43-
pub fn preorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> Preorder<'a, 'tcx> {
43+
pub fn preorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> Preorder<'a, 'tcx> {
4444
Preorder::new(mir, START_BLOCK)
4545
}
4646

@@ -99,14 +99,14 @@ impl<'a, 'tcx> Iterator for Preorder<'a, 'tcx> {
9999
///
100100
/// A Postorder traversal of this graph is `D B C A` or `D C B A`
101101
pub struct Postorder<'a, 'tcx: 'a> {
102-
mir: &'a Mir<'tcx>,
102+
mir: &'a Body<'tcx>,
103103
visited: BitSet<BasicBlock>,
104104
visit_stack: Vec<(BasicBlock, Successors<'a>)>,
105105
root_is_start_block: bool,
106106
}
107107

108108
impl<'a, 'tcx> Postorder<'a, 'tcx> {
109-
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
109+
pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> Postorder<'a, 'tcx> {
110110
let mut po = Postorder {
111111
mir,
112112
visited: BitSet::new_empty(mir.basic_blocks().len()),
@@ -194,7 +194,7 @@ impl<'a, 'tcx> Postorder<'a, 'tcx> {
194194
}
195195
}
196196

197-
pub fn postorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> Postorder<'a, 'tcx> {
197+
pub fn postorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> Postorder<'a, 'tcx> {
198198
Postorder::new(mir, START_BLOCK)
199199
}
200200

@@ -252,13 +252,13 @@ impl<'a, 'tcx> Iterator for Postorder<'a, 'tcx> {
252252
/// to re-use the traversal
253253
#[derive(Clone)]
254254
pub struct ReversePostorder<'a, 'tcx: 'a> {
255-
mir: &'a Mir<'tcx>,
255+
mir: &'a Body<'tcx>,
256256
blocks: Vec<BasicBlock>,
257257
idx: usize
258258
}
259259

260260
impl<'a, 'tcx> ReversePostorder<'a, 'tcx> {
261-
pub fn new(mir: &'a Mir<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx> {
261+
pub fn new(mir: &'a Body<'tcx>, root: BasicBlock) -> ReversePostorder<'a, 'tcx> {
262262
let blocks : Vec<_> = Postorder::new(mir, root).map(|(bb, _)| bb).collect();
263263

264264
let len = blocks.len();
@@ -276,7 +276,7 @@ impl<'a, 'tcx> ReversePostorder<'a, 'tcx> {
276276
}
277277

278278

279-
pub fn reverse_postorder<'a, 'tcx>(mir: &'a Mir<'tcx>) -> ReversePostorder<'a, 'tcx> {
279+
pub fn reverse_postorder<'a, 'tcx>(mir: &'a Body<'tcx>) -> ReversePostorder<'a, 'tcx> {
280280
ReversePostorder::new(mir, START_BLOCK)
281281
}
282282

src/librustc/mir/visit.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ macro_rules! make_mir_visitor {
7272
// Override these, and call `self.super_xxx` to revert back to the
7373
// default behavior.
7474

75-
fn visit_mir(&mut self, mir: & $($mutability)? Mir<'tcx>) {
75+
fn visit_mir(&mut self, mir: & $($mutability)? Body<'tcx>) {
7676
self.super_mir(mir);
7777
}
7878

@@ -269,7 +269,7 @@ macro_rules! make_mir_visitor {
269269
// not meant to be overridden.
270270

271271
fn super_mir(&mut self,
272-
mir: & $($mutability)? Mir<'tcx>) {
272+
mir: & $($mutability)? Body<'tcx>) {
273273
if let Some(yield_ty) = &$($mutability)? mir.yield_ty {
274274
self.visit_ty(yield_ty, TyContext::YieldTy(SourceInfo {
275275
span: mir.span,
@@ -278,7 +278,7 @@ macro_rules! make_mir_visitor {
278278
}
279279

280280
// for best performance, we want to use an iterator rather
281-
// than a for-loop, to avoid calling Mir::invalidate for
281+
// than a for-loop, to avoid calling Body::invalidate for
282282
// each basic block.
283283
macro_rules! basic_blocks {
284284
(mut) => (mir.basic_blocks_mut().iter_enumerated_mut());
@@ -886,7 +886,7 @@ macro_rules! make_mir_visitor {
886886

887887
// Convenience methods
888888

889-
fn visit_location(&mut self, mir: & $($mutability)? Mir<'tcx>, location: Location) {
889+
fn visit_location(&mut self, mir: & $($mutability)? Body<'tcx>, location: Location) {
890890
let basic_block = & $($mutability)? mir[location.block];
891891
if basic_block.statements.len() == location.statement_index {
892892
if let Some(ref $($mutability)? terminator) = basic_block.terminator {

src/librustc/query/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ rustc_queries! {
8888
desc { "getting a list of all mir_keys" }
8989
}
9090

91-
/// Maps DefId's that have an associated Mir to the result
91+
/// Maps DefId's that have an associated Body to the result
9292
/// of the MIR qualify_consts pass. The actual meaning of
9393
/// the value isn't known except to the pass itself.
9494
query mir_const_qualif(key: DefId) -> (u8, Lrc<BitSet<mir::Local>>) {
@@ -97,26 +97,26 @@ rustc_queries! {
9797

9898
/// Fetch the MIR for a given `DefId` right after it's built - this includes
9999
/// unreachable code.
100-
query mir_built(_: DefId) -> &'tcx Steal<mir::Mir<'tcx>> {}
100+
query mir_built(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {}
101101

102102
/// Fetch the MIR for a given `DefId` up till the point where it is
103103
/// ready for const evaluation.
104104
///
105105
/// See the README for the `mir` module for details.
106-
query mir_const(_: DefId) -> &'tcx Steal<mir::Mir<'tcx>> {
106+
query mir_const(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {
107107
no_hash
108108
}
109109

110-
query mir_validated(_: DefId) -> &'tcx Steal<mir::Mir<'tcx>> {
110+
query mir_validated(_: DefId) -> &'tcx Steal<mir::Body<'tcx>> {
111111
no_hash
112112
}
113113

114114
/// MIR after our optimization passes have run. This is MIR that is ready
115115
/// for codegen. This is also the only query that can fetch non-local MIR, at present.
116-
query optimized_mir(key: DefId) -> &'tcx mir::Mir<'tcx> {
116+
query optimized_mir(key: DefId) -> &'tcx mir::Body<'tcx> {
117117
cache { key.is_local() }
118118
load_cached(tcx, id) {
119-
let mir: Option<crate::mir::Mir<'tcx>> = tcx.queries.on_disk_cache
119+
let mir: Option<crate::mir::Body<'tcx>> = tcx.queries.on_disk_cache
120120
.try_load_query_result(tcx, id);
121121
mir.map(|x| tcx.alloc_mir(x))
122122
}
@@ -458,7 +458,7 @@ rustc_queries! {
458458
/// in the case of closures, this will be redirected to the enclosing function.
459459
query region_scope_tree(_: DefId) -> Lrc<region::ScopeTree> {}
460460

461-
query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx> {
461+
query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Body<'tcx> {
462462
no_force
463463
desc { |tcx| "generating MIR shim for `{}`", tcx.def_path_str(key.def_id()) }
464464
}

0 commit comments

Comments
 (0)