Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 80ff07f

Browse files
committedJun 9, 2019
Changed usages of mir in librustc::mir and librustc_mir to body
1 parent 07c3967 commit 80ff07f

Some content is hidden

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

82 files changed

+1323
-1319
lines changed
 

‎src/librustc/mir/cache.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ impl Cache {
4747

4848
pub fn predecessors(
4949
&self,
50-
mir: &Body<'_>
50+
body: &Body<'_>
5151
) -> MappedReadGuard<'_, IndexVec<BasicBlock, Vec<BasicBlock>>> {
5252
if self.predecessors.borrow().is_none() {
53-
*self.predecessors.borrow_mut() = Some(calculate_predecessors(mir));
53+
*self.predecessors.borrow_mut() = Some(calculate_predecessors(body));
5454
}
5555

5656
ReadGuard::map(self.predecessors.borrow(), |p| p.as_ref().unwrap())
5757
}
5858
}
5959

60-
fn calculate_predecessors(mir: &Body<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
61-
let mut result = IndexVec::from_elem(vec![], mir.basic_blocks());
62-
for (bb, data) in mir.basic_blocks().iter_enumerated() {
60+
fn calculate_predecessors(body: &Body<'_>) -> IndexVec<BasicBlock, Vec<BasicBlock>> {
61+
let mut result = IndexVec::from_elem(vec![], body.basic_blocks());
62+
for (bb, data) in body.basic_blocks().iter_enumerated() {
6363
if let Some(ref term) = data.terminator {
6464
for &tgt in term.successors() {
6565
result[tgt].push(bb);

‎src/librustc/mir/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2916,21 +2916,21 @@ impl Location {
29162916
}
29172917

29182918
/// Returns `true` if `other` is earlier in the control flow graph than `self`.
2919-
pub fn is_predecessor_of<'tcx>(&self, other: Location, mir: &Body<'tcx>) -> bool {
2919+
pub fn is_predecessor_of<'tcx>(&self, other: Location, body: &Body<'tcx>) -> bool {
29202920
// If we are in the same block as the other location and are an earlier statement
29212921
// then we are a predecessor of `other`.
29222922
if self.block == other.block && self.statement_index < other.statement_index {
29232923
return true;
29242924
}
29252925

29262926
// If we're in another block, then we want to check that block is a predecessor of `other`.
2927-
let mut queue: Vec<BasicBlock> = mir.predecessors_for(other.block).clone();
2927+
let mut queue: Vec<BasicBlock> = body.predecessors_for(other.block).clone();
29282928
let mut visited = FxHashSet::default();
29292929

29302930
while let Some(block) = queue.pop() {
29312931
// If we haven't visited this block before, then make sure we visit it's predecessors.
29322932
if visited.insert(block) {
2933-
queue.append(&mut mir.predecessors_for(block).clone());
2933+
queue.append(&mut body.predecessors_for(block).clone());
29342934
} else {
29352935
continue;
29362936
}

0 commit comments

Comments
 (0)
Please sign in to comment.