about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-10-21 17:29:50 -0400
committerNiko Matsakis <niko@alum.mit.edu>2015-11-03 04:35:00 -0500
commit044096b3e9a8d02461d49fb5559bb11c4308e701 (patch)
tree7fb4f5ccf48bd7c06e499a9e3772c0b51ffcd437
parent3ab29d337834383c159b2a4e275581f97ad34a25 (diff)
downloadrust-044096b3e9a8d02461d49fb5559bb11c4308e701.tar.gz
rust-044096b3e9a8d02461d49fb5559bb11c4308e701.zip
Change Call operands to be, well, Operands
-rw-r--r--src/librustc_mir/build/expr/into.rs4
-rw-r--r--src/librustc_mir/build/matches/test.rs19
-rw-r--r--src/librustc_mir/build/misc.rs26
-rw-r--r--src/librustc_mir/repr.rs4
4 files changed, 25 insertions, 28 deletions
diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs
index a7d68b09b54..57c6db79c52 100644
--- a/src/librustc_mir/build/expr/into.rs
+++ b/src/librustc_mir/build/expr/into.rs
@@ -211,10 +211,10 @@ impl<'a,'tcx> Builder<'a,'tcx> {
                 this.cfg.start_new_block().unit()
             }
             ExprKind::Call { fun, args } => {
-                let fun = unpack!(block = this.as_lvalue(block, fun));
+                let fun = unpack!(block = this.as_operand(block, fun));
                 let args: Vec<_> =
                     args.into_iter()
-                        .map(|arg| unpack!(block = this.as_lvalue(block, arg)))
+                        .map(|arg| unpack!(block = this.as_operand(block, arg)))
                         .collect();
                 let success = this.cfg.start_new_block();
                 let panic = this.diverge_cleanup();
diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs
index 0d01df485fa..e035f53dacf 100644
--- a/src/librustc_mir/build/matches/test.rs
+++ b/src/librustc_mir/build/matches/test.rs
@@ -100,27 +100,28 @@ impl<'a,'tcx> Builder<'a,'tcx> {
 
             TestKind::Eq { value, ty } => {
                 // call PartialEq::eq(discrim, constant)
-                let constant = self.push_literal(block, test.span, ty.clone(), value);
+                let constant = self.literal_operand(test.span, ty.clone(), value);
                 let item_ref = self.hir.partial_eq(ty);
-                self.call_comparison_fn(block, test.span, item_ref, lvalue.clone(), constant)
+                self.call_comparison_fn(block, test.span, item_ref,
+                                        Operand::Consume(lvalue.clone()), constant)
             }
 
             TestKind::Range { lo, hi, ty } => {
                 // Test `v` by computing `PartialOrd::le(lo, v) && PartialOrd::le(v, hi)`.
-                let lo = self.push_literal(block, test.span, ty.clone(), lo);
-                let hi = self.push_literal(block, test.span, ty.clone(), hi);
+                let lo = self.literal_operand(test.span, ty.clone(), lo);
+                let hi = self.literal_operand(test.span, ty.clone(), hi);
                 let item_ref = self.hir.partial_le(ty);
 
                 let lo_blocks = self.call_comparison_fn(block,
                                                         test.span,
                                                         item_ref.clone(),
                                                         lo,
-                                                        lvalue.clone());
+                                                        Operand::Consume(lvalue.clone()));
 
                 let hi_blocks = self.call_comparison_fn(lo_blocks[0],
                                                         test.span,
                                                         item_ref,
-                                                        lvalue.clone(),
+                                                        Operand::Consume(lvalue.clone()),
                                                         hi);
 
                 let failure = self.cfg.start_new_block();
@@ -165,14 +166,14 @@ impl<'a,'tcx> Builder<'a,'tcx> {
                           block: BasicBlock,
                           span: Span,
                           item_ref: ItemRef<'tcx>,
-                          lvalue1: Lvalue<'tcx>,
-                          lvalue2: Lvalue<'tcx>)
+                          lvalue1: Operand<'tcx>,
+                          lvalue2: Operand<'tcx>)
                           -> Vec<BasicBlock> {
         let target_blocks = vec![self.cfg.start_new_block(), self.cfg.start_new_block()];
 
         let bool_ty = self.hir.bool_ty();
         let eq_result = self.temp(bool_ty);
-        let func = self.push_item_ref(block, span, item_ref);
+        let func = self.item_ref_operand(span, item_ref);
         let call_blocks = [self.cfg.start_new_block(), self.diverge_cleanup()];
         self.cfg.terminate(block,
                            Terminator::Call {
diff --git a/src/librustc_mir/build/misc.rs b/src/librustc_mir/build/misc.rs
index 86b6df19b77..41274f3f373 100644
--- a/src/librustc_mir/build/misc.rs
+++ b/src/librustc_mir/build/misc.rs
@@ -34,20 +34,17 @@ impl<'a,'tcx> Builder<'a,'tcx> {
         lvalue
     }
 
-    pub fn push_literal(&mut self,
-                        block: BasicBlock,
-                        span: Span,
-                        ty: Ty<'tcx>,
-                        literal: Literal<'tcx>)
-                        -> Lvalue<'tcx> {
-        let temp = self.temp(ty.clone());
+    pub fn literal_operand(&mut self,
+                           span: Span,
+                           ty: Ty<'tcx>,
+                           literal: Literal<'tcx>)
+                           -> Operand<'tcx> {
         let constant = Constant {
             span: span,
             ty: ty,
             literal: literal,
         };
-        self.cfg.push_assign_constant(block, span, &temp, constant);
-        temp
+        Operand::Constant(constant)
     }
 
     pub fn push_usize(&mut self, block: BasicBlock, span: Span, value: usize) -> Lvalue<'tcx> {
@@ -63,15 +60,14 @@ impl<'a,'tcx> Builder<'a,'tcx> {
         temp
     }
 
-    pub fn push_item_ref(&mut self,
-                         block: BasicBlock,
-                         span: Span,
-                         item_ref: ItemRef<'tcx>)
-                         -> Lvalue<'tcx> {
+    pub fn item_ref_operand(&mut self,
+                            span: Span,
+                            item_ref: ItemRef<'tcx>)
+                            -> Operand<'tcx> {
         let literal = Literal::Item {
             def_id: item_ref.def_id,
             substs: item_ref.substs,
         };
-        self.push_literal(block, span, item_ref.ty, literal)
+        self.literal_operand(span, item_ref.ty, literal)
     }
 }
diff --git a/src/librustc_mir/repr.rs b/src/librustc_mir/repr.rs
index eb919f36cc3..89b1afa8723 100644
--- a/src/librustc_mir/repr.rs
+++ b/src/librustc_mir/repr.rs
@@ -294,10 +294,10 @@ pub struct CallData<'tcx> {
     pub destination: Lvalue<'tcx>,
 
     /// the fn being called
-    pub func: Lvalue<'tcx>,
+    pub func: Operand<'tcx>,
 
     /// the arguments
-    pub args: Vec<Lvalue<'tcx>>,
+    pub args: Vec<Operand<'tcx>>,
 }
 
 impl<'tcx> BasicBlockData<'tcx> {