]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/mir/visit.rs
hir, mir: Separate HIR expressions / MIR operands from InlineAsm.
[rust.git] / src / librustc / mir / visit.rs
index a38ef078c6f8e713592f4de73350d4df3ce10f8a..36d45f0a51ec22fda19aa31c8ef09a9a0d1e5913 100644 (file)
@@ -92,7 +92,7 @@ fn visit_span(&mut self,
             }
 
             // The `super_xxx` methods comprise the default behavior and are
-            // not meant to be overidden.
+            // not meant to be overridden.
 
             fn super_mir(&mut self,
                          mir: & $($mutability)* Mir<'tcx>) {
@@ -124,9 +124,6 @@ fn super_statement(&mut self,
                                           ref $($mutability)* rvalue) => {
                         self.visit_assign(block, lvalue, rvalue);
                     }
-                    StatementKind::Drop(_, ref $($mutability)* lvalue) => {
-                        self.visit_lvalue(lvalue, LvalueContext::Drop);
-                    }
                 }
             }
 
@@ -177,30 +174,25 @@ fn super_terminator(&mut self,
                     Terminator::Return => {
                     }
 
+                    Terminator::Drop { ref $($mutability)* value, target, unwind } => {
+                        self.visit_lvalue(value, LvalueContext::Drop);
+                        self.visit_branch(block, target);
+                        unwind.map(|t| self.visit_branch(block, t));
+                    }
+
                     Terminator::Call { ref $($mutability)* func,
                                        ref $($mutability)* args,
-                                       ref $($mutability)* kind } => {
+                                       ref $($mutability)* destination,
+                                       cleanup } => {
                         self.visit_operand(func);
                         for arg in args {
                             self.visit_operand(arg);
                         }
-                        match *kind {
-                            CallKind::Converging {
-                                ref $($mutability)* destination,
-                                ..
-                            }        |
-                            CallKind::ConvergingCleanup {
-                                ref $($mutability)* destination,
-                                ..
-                            } => {
-                                self.visit_lvalue(destination, LvalueContext::Store);
-                            }
-                            CallKind::Diverging           |
-                            CallKind::DivergingCleanup(_) => {}
-                        }
-                        for &target in kind.successors() {
+                        if let Some((ref $($mutability)* destination, target)) = *destination {
+                            self.visit_lvalue(destination, LvalueContext::Store);
                             self.visit_branch(block, target);
                         }
+                        cleanup.map(|t| self.visit_branch(block, t));
                     }
                 }
             }
@@ -269,7 +261,14 @@ fn super_rvalue(&mut self,
                         });
                     }
 
-                    Rvalue::InlineAsm(_) => {
+                    Rvalue::InlineAsm { ref $($mutability)* outputs,
+                                        ref $($mutability)* inputs, .. } => {
+                        for output in & $($mutability)* outputs[..] {
+                            self.visit_lvalue(output, LvalueContext::Store);
+                        }
+                        for input in & $($mutability)* inputs[..] {
+                            self.visit_operand(input);
+                        }
                     }
                 }
             }