Implement intrinsics assume and (un)likely

This commit is contained in:
bjorn3 2018-07-30 16:02:26 +02:00
parent dc3ec67046
commit 4901a66df1

View File

@ -298,6 +298,13 @@ pub fn codegen_call<'a, 'tcx: 'a>(
"abort" => {
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
}
"assume" => {
assert_eq!(args.len(), 1);
}
"likely" | "unlikely" => {
assert_eq!(args.len(), 1);
ret.write_cvalue(fx, args[0]);
}
"copy" | "copy_nonoverlapping" => {
let elem_ty = substs.type_at(0);
let elem_size: u64 = fx.layout_of(elem_ty).size.bytes();