1
Fork 0

trans: split trans_consume off from trans_operand.

This commit is contained in:
Eduard Burtescu 2016-06-09 18:13:16 +03:00
parent 5522e678bc
commit 93c32b55e2

View file

@ -164,15 +164,13 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
OperandRef { val: val, ty: ty }
}
pub fn trans_operand(&mut self,
pub fn trans_consume(&mut self,
bcx: &BlockAndBuilder<'bcx, 'tcx>,
operand: &mir::Operand<'tcx>)
lvalue: &mir::Lvalue<'tcx>)
-> OperandRef<'tcx>
{
debug!("trans_operand(operand={:?})", operand);
debug!("trans_consume(lvalue={:?})", lvalue);
match *operand {
mir::Operand::Consume(ref lvalue) => {
// watch out for temporaries that do not have an
// alloca; they are handled somewhat differently
if let &mir::Lvalue::Temp(index) = lvalue {
@ -216,6 +214,18 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
self.trans_load(bcx, tr_lvalue.llval, ty)
}
pub fn trans_operand(&mut self,
bcx: &BlockAndBuilder<'bcx, 'tcx>,
operand: &mir::Operand<'tcx>)
-> OperandRef<'tcx>
{
debug!("trans_operand(operand={:?})", operand);
match *operand {
mir::Operand::Consume(ref lvalue) => {
self.trans_consume(bcx, lvalue)
}
mir::Operand::Constant(ref constant) => {
let val = self.trans_constant(bcx, constant);
let operand = val.to_operand(bcx.ccx());