]> git.lizzy.rs Git - rust.git/commitdiff
Implement intrinsics assume and (un)likely
authorbjorn3 <bjorn3@users.noreply.github.com>
Mon, 30 Jul 2018 14:02:26 +0000 (16:02 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Mon, 30 Jul 2018 14:02:26 +0000 (16:02 +0200)
src/abi.rs

index f2e6007e5f8d58a78ef85c209277fa261c9a6eab..70af157e47c340ecddf2f2651addd5ea185f11f4 100644 (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();