Pass CPlace to codegen_intrinsic_call

This commit is contained in:
bjorn3 2018-08-11 10:58:31 +02:00
parent 973f191136
commit 4df09f7325

View File

@ -342,12 +342,16 @@ pub fn codegen_call<'a, 'tcx: 'a>(
.collect::<Vec<_>>() .collect::<Vec<_>>()
}; };
let destination = destination.as_ref().map(|(place, bb)| {
(trans_place(fx, place), *bb)
});
if codegen_intrinsic_call(fx, fn_ty, sig, &args, destination) { if codegen_intrinsic_call(fx, fn_ty, sig, &args, destination) {
return; return;
} }
let return_ptr = match destination { let return_ptr = match destination {
Some((place, _)) => trans_place(fx, place).expect_addr(), Some((place, _)) => place.expect_addr(),
None => fx.bcx.ins().iconst(types::I64, 0), None => fx.bcx.ins().iconst(types::I64, 0),
}; };
@ -374,7 +378,7 @@ pub fn codegen_call<'a, 'tcx: 'a>(
fx.bcx.ins().call_indirect(sig, func, &call_args); fx.bcx.ins().call_indirect(sig, func, &call_args);
} }
} }
if let Some((_, dest)) = *destination { if let Some((_, dest)) = destination {
let ret_ebb = fx.get_ebb(dest); let ret_ebb = fx.get_ebb(dest);
fx.bcx.ins().jump(ret_ebb, &[]); fx.bcx.ins().jump(ret_ebb, &[]);
} else { } else {
@ -387,7 +391,7 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
fn_ty: Ty<'tcx>, fn_ty: Ty<'tcx>,
sig: FnSig<'tcx>, sig: FnSig<'tcx>,
args: &[CValue<'tcx>], args: &[CValue<'tcx>],
destination: &Option<(Place<'tcx>, BasicBlock)>, destination: Option<(CPlace<'tcx>, BasicBlock)>,
) -> bool { ) -> bool {
if let TypeVariants::TyFnDef(def_id, substs) = fn_ty.sty { if let TypeVariants::TyFnDef(def_id, substs) = fn_ty.sty {
if sig.abi == Abi::RustIntrinsic { if sig.abi == Abi::RustIntrinsic {
@ -395,7 +399,7 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
let intrinsic = &intrinsic[..]; let intrinsic = &intrinsic[..];
let ret = match destination { let ret = match destination {
Some((place, _)) => trans_place(fx, place), Some((place, _)) => place,
None => { None => {
println!( println!(
"codegen_call(fx, _, {:?}, {:?})", "codegen_call(fx, _, {:?}, {:?})",
@ -614,7 +618,7 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
_ => unimpl!("unsupported intrinsic {}", intrinsic), _ => unimpl!("unsupported intrinsic {}", intrinsic),
} }
if let Some((_, dest)) = *destination { if let Some((_, dest)) = destination {
let ret_ebb = fx.get_ebb(dest); let ret_ebb = fx.get_ebb(dest);
fx.bcx.ins().jump(ret_ebb, &[]); fx.bcx.ins().jump(ret_ebb, &[]);
} else { } else {