]> git.proxmox.com Git - rustc.git/blobdiff - compiler/rustc_codegen_llvm/src/declare.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / compiler / rustc_codegen_llvm / src / declare.rs
index a6e06ffa819ca2f4310eaccc64eaf1fc2b0d3622..5a5c4f7f8603de4342f6265a60d1ae3e778e8f3b 100644 (file)
@@ -18,8 +18,8 @@ use crate::llvm;
 use crate::llvm::AttributePlace::Function;
 use crate::type_::Type;
 use crate::value::Value;
-use rustc_codegen_ssa::traits::*;
 use rustc_middle::ty::Ty;
+use smallvec::SmallVec;
 use tracing::debug;
 
 /// Declare a function.
@@ -41,12 +41,15 @@ fn declare_raw_fn<'ll>(
     llvm::SetFunctionCallConv(llfn, callconv);
     llvm::SetUnnamedAddress(llfn, unnamed);
 
+    let mut attrs = SmallVec::<[_; 4]>::new();
+
     if cx.tcx.sess.opts.cg.no_redzone.unwrap_or(cx.tcx.sess.target.disable_redzone) {
-        llvm::Attribute::NoRedZone.apply_llfn(Function, llfn);
+        attrs.push(llvm::AttributeKind::NoRedZone.create_attr(cx.llcx));
     }
 
-    attributes::default_optimisation_attrs(cx.tcx.sess, llfn);
-    attributes::non_lazy_bind(cx.sess(), llfn);
+    attrs.extend(attributes::non_lazy_bind_attr(cx));
+
+    attributes::apply_to_llfn(llfn, Function, &attrs);
 
     llfn
 }