trans: split trans_consume off from trans_operand.
This commit is contained in:
parent
5522e678bc
commit
93c32b55e2
1 changed files with 51 additions and 41 deletions
|
@ -164,15 +164,13 @@ impl<'bcx, 'tcx> MirContext<'bcx, 'tcx> {
|
||||||
OperandRef { val: val, ty: ty }
|
OperandRef { val: val, ty: ty }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn trans_operand(&mut self,
|
pub fn trans_consume(&mut self,
|
||||||
bcx: &BlockAndBuilder<'bcx, 'tcx>,
|
bcx: &BlockAndBuilder<'bcx, 'tcx>,
|
||||||
operand: &mir::Operand<'tcx>)
|
lvalue: &mir::Lvalue<'tcx>)
|
||||||
-> OperandRef<'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
|
// watch out for temporaries that do not have an
|
||||||
// alloca; they are handled somewhat differently
|
// alloca; they are handled somewhat differently
|
||||||
if let &mir::Lvalue::Temp(index) = lvalue {
|
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)
|
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) => {
|
mir::Operand::Constant(ref constant) => {
|
||||||
let val = self.trans_constant(bcx, constant);
|
let val = self.trans_constant(bcx, constant);
|
||||||
let operand = val.to_operand(bcx.ccx());
|
let operand = val.to_operand(bcx.ccx());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue