Merge commit '5988bbd24a' into sync_cg_clif-2020-11-27

This commit is contained in:
bjorn3 2020-11-27 20:48:53 +01:00
commit 477aa67802
33 changed files with 400 additions and 222 deletions

View file

@ -67,3 +67,15 @@ pub(crate) fn trap_unimplemented(fx: &mut FunctionCx<'_, '_, impl Module>, msg:
let true_ = fx.bcx.ins().iconst(types::I32, 1);
fx.bcx.ins().trapnz(true_, TrapCode::User(!0));
}
/// Like `trap_unimplemented` but returns a fake value of the specified type.
///
/// Trap code: user65535
pub(crate) fn trap_unimplemented_ret_value<'tcx>(
fx: &mut FunctionCx<'_, 'tcx, impl Module>,
dest_layout: TyAndLayout<'tcx>,
msg: impl AsRef<str>,
) -> CValue<'tcx> {
trap_unimplemented(fx, msg);
CValue::by_ref(Pointer::const_addr(fx, 0), dest_layout)
}