From 448e254ca0416148b7ee8450e37dc1727fc5d530 Mon Sep 17 00:00:00 2001 From: Jake Goulding Date: Fri, 10 Jun 2016 17:37:46 -0400 Subject: [PATCH] All intrinsics are available in all supported LLVM versions --- src/librustc_trans/context.rs | 40 +---------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index 550455a7fb7..bfcb1ae33b3 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -1097,45 +1097,7 @@ macro_rules! mk_struct { ifn!("llvm.localrecover", fn(i8p, i8p, t_i32) -> i8p); ifn!("llvm.x86.seh.recoverfp", fn(i8p, i8p) -> i8p); - // Some intrinsics were introduced in later versions of LLVM, but they have - // fallbacks in libc or libm and such. - macro_rules! compatible_ifn { - ($name:expr, noop($cname:ident ($($arg:expr),*) -> void), $llvm_version:expr) => ( - if unsafe { llvm::LLVMVersionMinor() >= $llvm_version } { - // The `if key == $name` is already in ifn! - ifn!($name, fn($($arg),*) -> void); - } else if key == $name { - let f = declare::declare_cfn(ccx, stringify!($cname), - Type::func(&[$($arg),*], &void)); - llvm::SetLinkage(f, llvm::InternalLinkage); - - let bld = ccx.builder(); - let llbb = unsafe { - llvm::LLVMAppendBasicBlockInContext(ccx.llcx(), f, - "entry-block\0".as_ptr() as *const _) - }; - - bld.position_at_end(llbb); - bld.ret_void(); - - ccx.intrinsics().borrow_mut().insert($name, f.clone()); - return Some(f); - } - ); - ($name:expr, $cname:ident ($($arg:expr),*) -> $ret:expr, $llvm_version:expr) => ( - if unsafe { llvm::LLVMVersionMinor() >= $llvm_version } { - // The `if key == $name` is already in ifn! - ifn!($name, fn($($arg),*) -> $ret); - } else if key == $name { - let f = declare::declare_cfn(ccx, stringify!($cname), - Type::func(&[$($arg),*], &$ret)); - ccx.intrinsics().borrow_mut().insert($name, f.clone()); - return Some(f); - } - ) - } - - compatible_ifn!("llvm.assume", noop(llvmcompat_assume(i1) -> void), 6); + ifn!("llvm.assume", fn(i1) -> void); if ccx.sess().opts.debuginfo != NoDebugInfo { ifn!("llvm.dbg.declare", fn(Type::metadata(ccx), Type::metadata(ccx)) -> void); -- 2.44.0