@@ -66,9 +66,9 @@ macro_rules! newtype_index {
66
66
/// Lowered representation of a single function.
67
67
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
68
68
pub struct Mir < ' tcx > {
69
- /// List of basic blocks. References to basic block use a newtyped index type `BasicBlock `
69
+ /// List of basic blocks. References to basic block use a newtyped index type `Block `
70
70
/// that indexes into this vector.
71
- basic_blocks : IndexVec < BasicBlock , BasicBlockData < ' tcx > > ,
71
+ basic_blocks : IndexVec < Block , BlockData < ' tcx > > ,
72
72
73
73
/// List of visibility (lexical) scopes; these are referenced by statements
74
74
/// and used (eventually) for debuginfo. Indexed by a `VisibilityScope`.
@@ -115,10 +115,10 @@ pub struct Mir<'tcx> {
115
115
}
116
116
117
117
/// where execution begins
118
- pub const START_BLOCK : BasicBlock = BasicBlock ( 0 ) ;
118
+ pub const START_BLOCK : Block = Block ( 0 ) ;
119
119
120
120
impl < ' tcx > Mir < ' tcx > {
121
- pub fn new ( basic_blocks : IndexVec < BasicBlock , BasicBlockData < ' tcx > > ,
121
+ pub fn new ( basic_blocks : IndexVec < Block , BlockData < ' tcx > > ,
122
122
visibility_scopes : IndexVec < VisibilityScope , VisibilityScopeData > ,
123
123
promoted : IndexVec < Promoted , Mir < ' tcx > > ,
124
124
return_ty : Ty < ' tcx > ,
@@ -147,28 +147,28 @@ impl<'tcx> Mir<'tcx> {
147
147
}
148
148
149
149
#[ inline]
150
- pub fn basic_blocks ( & self ) -> & IndexVec < BasicBlock , BasicBlockData < ' tcx > > {
150
+ pub fn basic_blocks ( & self ) -> & IndexVec < Block , BlockData < ' tcx > > {
151
151
& self . basic_blocks
152
152
}
153
153
154
154
#[ inline]
155
- pub fn basic_blocks_mut ( & mut self ) -> & mut IndexVec < BasicBlock , BasicBlockData < ' tcx > > {
155
+ pub fn basic_blocks_mut ( & mut self ) -> & mut IndexVec < Block , BlockData < ' tcx > > {
156
156
self . cache . invalidate ( ) ;
157
157
& mut self . basic_blocks
158
158
}
159
159
160
160
#[ inline]
161
- pub fn predecessors ( & self ) -> Ref < IndexVec < BasicBlock , Vec < BasicBlock > > > {
161
+ pub fn predecessors ( & self ) -> Ref < IndexVec < Block , Vec < Block > > > {
162
162
self . cache . predecessors ( self )
163
163
}
164
164
165
165
#[ inline]
166
- pub fn predecessors_for ( & self , bb : BasicBlock ) -> Ref < Vec < BasicBlock > > {
166
+ pub fn predecessors_for ( & self , bb : Block ) -> Ref < Vec < Block > > {
167
167
Ref :: map ( self . predecessors ( ) , |p| & p[ bb] )
168
168
}
169
169
170
170
#[ inline]
171
- pub fn dominators ( & self ) -> Dominators < BasicBlock > {
171
+ pub fn dominators ( & self ) -> Dominators < Block > {
172
172
dominators ( self )
173
173
}
174
174
@@ -243,18 +243,18 @@ impl<'tcx> Mir<'tcx> {
243
243
}
244
244
}
245
245
246
- impl < ' tcx > Index < BasicBlock > for Mir < ' tcx > {
247
- type Output = BasicBlockData < ' tcx > ;
246
+ impl < ' tcx > Index < Block > for Mir < ' tcx > {
247
+ type Output = BlockData < ' tcx > ;
248
248
249
249
#[ inline]
250
- fn index ( & self , index : BasicBlock ) -> & BasicBlockData < ' tcx > {
250
+ fn index ( & self , index : Block ) -> & BlockData < ' tcx > {
251
251
& self . basic_blocks ( ) [ index]
252
252
}
253
253
}
254
254
255
- impl < ' tcx > IndexMut < BasicBlock > for Mir < ' tcx > {
255
+ impl < ' tcx > IndexMut < Block > for Mir < ' tcx > {
256
256
#[ inline]
257
- fn index_mut ( & mut self , index : BasicBlock ) -> & mut BasicBlockData < ' tcx > {
257
+ fn index_mut ( & mut self , index : Block ) -> & mut BlockData < ' tcx > {
258
258
& mut self . basic_blocks_mut ( ) [ index]
259
259
}
260
260
}
@@ -411,15 +411,15 @@ pub struct UpvarDecl {
411
411
}
412
412
413
413
///////////////////////////////////////////////////////////////////////////
414
- // BasicBlock
414
+ // Block
415
415
416
- newtype_index ! ( BasicBlock , "bb" ) ;
416
+ newtype_index ! ( Block , "bb" ) ;
417
417
418
418
///////////////////////////////////////////////////////////////////////////
419
- // BasicBlockData and Terminator
419
+ // BlockData and Terminator
420
420
421
421
#[ derive( Clone , Debug , RustcEncodable , RustcDecodable ) ]
422
- pub struct BasicBlockData < ' tcx > {
422
+ pub struct BlockData < ' tcx > {
423
423
/// List of statements in this block.
424
424
pub statements : Vec < Statement < ' tcx > > ,
425
425
@@ -450,7 +450,7 @@ pub struct Terminator<'tcx> {
450
450
pub enum TerminatorKind < ' tcx > {
451
451
/// block should have one successor in the graph; we jump there
452
452
Goto {
453
- target : BasicBlock ,
453
+ target : Block ,
454
454
} ,
455
455
456
456
/// operand evaluates to an integer; jump depending on its value
@@ -472,12 +472,12 @@ pub enum TerminatorKind<'tcx> {
472
472
// This invariant is quite non-obvious and also could be improved.
473
473
// One way to make this invariant is to have something like this instead:
474
474
//
475
- // branches: Vec<(ConstInt, BasicBlock )>,
476
- // otherwise: Option<BasicBlock > // exhaustive if None
475
+ // branches: Vec<(ConstInt, Block )>,
476
+ // otherwise: Option<Block > // exhaustive if None
477
477
//
478
478
// However we’ve decided to keep this as-is until we figure a case
479
479
// where some other approach seems to be strictly better than other.
480
- targets : Vec < BasicBlock > ,
480
+ targets : Vec < Block > ,
481
481
} ,
482
482
483
483
/// Indicates that the landing pad is finished and unwinding should
@@ -494,16 +494,16 @@ pub enum TerminatorKind<'tcx> {
494
494
/// Drop the Lvalue
495
495
Drop {
496
496
location : Lvalue < ' tcx > ,
497
- target : BasicBlock ,
498
- unwind : Option < BasicBlock >
497
+ target : Block ,
498
+ unwind : Option < Block >
499
499
} ,
500
500
501
501
/// Drop the Lvalue and assign the new value over it
502
502
DropAndReplace {
503
503
location : Lvalue < ' tcx > ,
504
504
value : Operand < ' tcx > ,
505
- target : BasicBlock ,
506
- unwind : Option < BasicBlock > ,
505
+ target : Block ,
506
+ unwind : Option < Block > ,
507
507
} ,
508
508
509
509
/// Block ends with a call of a converging function
@@ -513,9 +513,9 @@ pub enum TerminatorKind<'tcx> {
513
513
/// Arguments the function is called with
514
514
args : Vec < Operand < ' tcx > > ,
515
515
/// Destination for the return value. If some, the call is converging.
516
- destination : Option < ( Lvalue < ' tcx > , BasicBlock ) > ,
516
+ destination : Option < ( Lvalue < ' tcx > , Block ) > ,
517
517
/// Cleanups to be done if the call unwinds.
518
- cleanup : Option < BasicBlock >
518
+ cleanup : Option < Block >
519
519
} ,
520
520
521
521
/// Jump to the target if the condition has the expected value,
@@ -524,24 +524,24 @@ pub enum TerminatorKind<'tcx> {
524
524
cond : Operand < ' tcx > ,
525
525
expected : bool ,
526
526
msg : AssertMessage < ' tcx > ,
527
- target : BasicBlock ,
528
- cleanup : Option < BasicBlock >
527
+ target : Block ,
528
+ cleanup : Option < Block >
529
529
}
530
530
}
531
531
532
532
impl < ' tcx > Terminator < ' tcx > {
533
- pub fn successors ( & self ) -> Cow < [ BasicBlock ] > {
533
+ pub fn successors ( & self ) -> Cow < [ Block ] > {
534
534
self . kind . successors ( )
535
535
}
536
536
537
- pub fn successors_mut ( & mut self ) -> Vec < & mut BasicBlock > {
537
+ pub fn successors_mut ( & mut self ) -> Vec < & mut Block > {
538
538
self . kind . successors_mut ( )
539
539
}
540
540
}
541
541
542
542
impl < ' tcx > TerminatorKind < ' tcx > {
543
543
pub fn if_ < ' a , ' gcx > ( tcx : ty:: TyCtxt < ' a , ' gcx , ' tcx > , cond : Operand < ' tcx > ,
544
- t : BasicBlock , f : BasicBlock ) -> TerminatorKind < ' tcx > {
544
+ t : Block , f : Block ) -> TerminatorKind < ' tcx > {
545
545
static BOOL_SWITCH_FALSE : & ' static [ ConstInt ] = & [ ConstInt :: U8 ( 0 ) ] ;
546
546
TerminatorKind :: SwitchInt {
547
547
discr : cond,
@@ -551,7 +551,7 @@ impl<'tcx> TerminatorKind<'tcx> {
551
551
}
552
552
}
553
553
554
- pub fn successors ( & self ) -> Cow < [ BasicBlock ] > {
554
+ pub fn successors ( & self ) -> Cow < [ Block ] > {
555
555
use self :: TerminatorKind :: * ;
556
556
match * self {
557
557
Goto { target : ref b } => slice:: ref_slice ( b) . into_cow ( ) ,
@@ -577,9 +577,9 @@ impl<'tcx> TerminatorKind<'tcx> {
577
577
}
578
578
}
579
579
580
- // FIXME: no mootable cow. I’m honestly not sure what a “cow” between `&mut [BasicBlock ]` and
581
- // `Vec<&mut BasicBlock >` would look like in the first place.
582
- pub fn successors_mut ( & mut self ) -> Vec < & mut BasicBlock > {
580
+ // FIXME: no mootable cow. I’m honestly not sure what a “cow” between `&mut [Block ]` and
581
+ // `Vec<&mut Block >` would look like in the first place.
582
+ pub fn successors_mut ( & mut self ) -> Vec < & mut Block > {
583
583
use self :: TerminatorKind :: * ;
584
584
match * self {
585
585
Goto { target : ref mut b } => vec ! [ b] ,
@@ -603,9 +603,9 @@ impl<'tcx> TerminatorKind<'tcx> {
603
603
}
604
604
}
605
605
606
- impl < ' tcx > BasicBlockData < ' tcx > {
607
- pub fn new ( terminator : Option < Terminator < ' tcx > > ) -> BasicBlockData < ' tcx > {
608
- BasicBlockData {
606
+ impl < ' tcx > BlockData < ' tcx > {
607
+ pub fn new ( terminator : Option < Terminator < ' tcx > > ) -> BlockData < ' tcx > {
608
+ BlockData {
609
609
statements : vec ! [ ] ,
610
610
terminator : terminator,
611
611
is_cleanup : false ,
@@ -1296,7 +1296,7 @@ fn item_path_str(def_id: DefId) -> String {
1296
1296
1297
1297
impl < ' tcx > ControlFlowGraph for Mir < ' tcx > {
1298
1298
1299
- type Node = BasicBlock ;
1299
+ type Node = Block ;
1300
1300
1301
1301
fn num_nodes ( & self ) -> usize { self . basic_blocks . len ( ) }
1302
1302
@@ -1315,19 +1315,19 @@ impl<'tcx> ControlFlowGraph for Mir<'tcx> {
1315
1315
}
1316
1316
1317
1317
impl < ' a , ' b > GraphPredecessors < ' b > for Mir < ' a > {
1318
- type Item = BasicBlock ;
1319
- type Iter = IntoIter < BasicBlock > ;
1318
+ type Item = Block ;
1319
+ type Iter = IntoIter < Block > ;
1320
1320
}
1321
1321
1322
1322
impl < ' a , ' b > GraphSuccessors < ' b > for Mir < ' a > {
1323
- type Item = BasicBlock ;
1324
- type Iter = IntoIter < BasicBlock > ;
1323
+ type Item = Block ;
1324
+ type Iter = IntoIter < Block > ;
1325
1325
}
1326
1326
1327
1327
#[ derive( Copy , Clone , PartialEq , Eq , Hash , Ord , PartialOrd ) ]
1328
1328
pub struct Location {
1329
1329
/// the location is within this block
1330
- pub block : BasicBlock ,
1330
+ pub block : Block ,
1331
1331
1332
1332
/// the location is the start of the this statement; or, if `statement_index`
1333
1333
/// == num-statements, then the start of the terminator.
@@ -1341,7 +1341,7 @@ impl fmt::Debug for Location {
1341
1341
}
1342
1342
1343
1343
impl Location {
1344
- pub fn dominates ( & self , other : & Location , dominators : & Dominators < BasicBlock > ) -> bool {
1344
+ pub fn dominates ( & self , other : & Location , dominators : & Dominators < Block > ) -> bool {
1345
1345
if self . block == other. block {
1346
1346
self . statement_index <= other. statement_index
1347
1347
} else {
@@ -1392,9 +1392,9 @@ impl<'tcx> TypeFoldable<'tcx> for LocalDecl<'tcx> {
1392
1392
}
1393
1393
}
1394
1394
1395
- impl < ' tcx > TypeFoldable < ' tcx > for BasicBlockData < ' tcx > {
1395
+ impl < ' tcx > TypeFoldable < ' tcx > for BlockData < ' tcx > {
1396
1396
fn super_fold_with < ' gcx : ' tcx , F : TypeFolder < ' gcx , ' tcx > > ( & self , folder : & mut F ) -> Self {
1397
- BasicBlockData {
1397
+ BlockData {
1398
1398
statements : self . statements . fold_with ( folder) ,
1399
1399
terminator : self . terminator . fold_with ( folder) ,
1400
1400
is_cleanup : self . is_cleanup
0 commit comments