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.
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
}