@@ -16,27 +16,27 @@ use rustc::ty::TyCtxt;
1616
1717use super :: dataflow:: * ;
1818
19- pub struct LocalLivenessAnalysis ;
19+ pub struct DeadCode ;
2020
21- impl Pass for LocalLivenessAnalysis { }
21+ impl Pass for DeadCode { }
2222
23- impl < ' tcx > MirPass < ' tcx > for LocalLivenessAnalysis {
23+ impl < ' tcx > MirPass < ' tcx > for DeadCode {
2424 fn run_pass < ' a > ( & mut self , _: TyCtxt < ' a , ' tcx , ' tcx > , _: MirSource , mir : & mut Mir < ' tcx > ) {
25- let new_mir = Dataflow :: backward ( mir, LiveValueTransfer , LiveValueRewrite ) ;
25+ let new_mir = Dataflow :: backward ( mir, DeadCodeTransfer , DeadCodeRewrite ) ;
2626 * mir = new_mir;
2727 }
2828}
2929
3030#[ derive( Debug , Clone ) ]
31- struct LiveValueLattice {
31+ struct DeadCodeLattice {
3232 vars : BitVector ,
3333 args : BitVector ,
3434 tmps : BitVector ,
3535}
3636
37- impl Lattice for LiveValueLattice {
37+ impl Lattice for DeadCodeLattice {
3838 fn bottom ( ) -> Self {
39- LiveValueLattice {
39+ DeadCodeLattice {
4040 vars : BitVector :: new ( 0 ) ,
4141 tmps : BitVector :: new ( 0 ) ,
4242 args : BitVector :: new ( 0 )
@@ -53,7 +53,7 @@ impl Lattice for LiveValueLattice {
5353 }
5454}
5555
56- impl LiveValueLattice {
56+ impl DeadCodeLattice {
5757 fn set_lvalue_live < ' a > ( & mut self , l : & Lvalue < ' a > ) {
5858 match * l {
5959 Lvalue :: Arg ( a) => {
@@ -82,29 +82,29 @@ impl LiveValueLattice {
8282 }
8383}
8484
85- struct LiveValueTransfer ;
86- impl < ' tcx > Transfer < ' tcx > for LiveValueTransfer {
87- type Lattice = LiveValueLattice ;
88- type TerminatorReturn = LiveValueLattice ;
85+ struct DeadCodeTransfer ;
86+ impl < ' tcx > Transfer < ' tcx > for DeadCodeTransfer {
87+ type Lattice = DeadCodeLattice ;
88+ type TerminatorReturn = DeadCodeLattice ;
8989
90- fn stmt ( & self , s : & Statement < ' tcx > , lat : LiveValueLattice ) -> LiveValueLattice {
91- let mut vis = LiveValueVisitor ( lat) ;
90+ fn stmt ( & self , s : & Statement < ' tcx > , lat : DeadCodeLattice ) -> DeadCodeLattice {
91+ let mut vis = DeadCodeVisitor ( lat) ;
9292 vis. visit_statement ( START_BLOCK , s) ;
9393 vis. 0
9494 }
9595
96- fn term ( & self , t : & Terminator < ' tcx > , lat : LiveValueLattice ) -> LiveValueLattice {
97- let mut vis = LiveValueVisitor ( lat) ;
96+ fn term ( & self , t : & Terminator < ' tcx > , lat : DeadCodeLattice ) -> DeadCodeLattice {
97+ let mut vis = DeadCodeVisitor ( lat) ;
9898 vis. visit_terminator ( START_BLOCK , t) ;
9999 vis. 0
100100 }
101101}
102102
103- struct LiveValueRewrite ;
104- impl < ' tcx , T > Rewrite < ' tcx , T > for LiveValueRewrite
105- where T : Transfer < ' tcx , Lattice =LiveValueLattice >
103+ struct DeadCodeRewrite ;
104+ impl < ' tcx , T > Rewrite < ' tcx , T > for DeadCodeRewrite
105+ where T : Transfer < ' tcx , Lattice =DeadCodeLattice >
106106{
107- fn stmt ( & self , s : & Statement < ' tcx > , lat : & LiveValueLattice )
107+ fn stmt ( & self , s : & Statement < ' tcx > , lat : & DeadCodeLattice )
108108 -> StatementChange < ' tcx >
109109 {
110110 let StatementKind :: Assign ( ref lval, ref rval) = s. kind ;
@@ -121,15 +121,15 @@ where T: Transfer<'tcx, Lattice=LiveValueLattice>
121121 }
122122 }
123123
124- fn term ( & self , t : & Terminator < ' tcx > , _: & LiveValueLattice )
124+ fn term ( & self , t : & Terminator < ' tcx > , _: & DeadCodeLattice )
125125 -> TerminatorChange < ' tcx >
126126 {
127127 TerminatorChange :: Terminator ( t. clone ( ) )
128128 }
129129}
130130
131- struct LiveValueVisitor ( LiveValueLattice ) ;
132- impl < ' tcx > Visitor < ' tcx > for LiveValueVisitor {
131+ struct DeadCodeVisitor ( DeadCodeLattice ) ;
132+ impl < ' tcx > Visitor < ' tcx > for DeadCodeVisitor {
133133 fn visit_lvalue ( & mut self , lval : & Lvalue < ' tcx > , ctx : LvalueContext ) {
134134 if ctx == LvalueContext :: Store || ctx == LvalueContext :: CallStore {
135135 match * lval {
0 commit comments