1
Fork 0

Auto merge of #92731 - bjorn3:asm_support_changes, r=nagisa

Avoid unnecessary monomorphization of inline asm related functions

This should reduce build time for codegen backends by avoiding duplicated monomorphization of certain inline asm related functions for each passed in closure type.
This commit is contained in:
bors 2022-01-18 14:32:52 +00:00
commit 9ad5d82f82
21 changed files with 133 additions and 105 deletions

View file

@ -294,9 +294,8 @@ impl<'tcx> ExprVisitor<'tcx> {
// (!). In that case we still need the earlier check to verify that the
// register class is usable at all.
if let Some(feature) = feature {
let feat_sym = Symbol::intern(feature);
if !self.tcx.sess.target_features.contains(&feat_sym)
&& !target_features.contains(&feat_sym)
if !self.tcx.sess.target_features.contains(&feature)
&& !target_features.contains(&feature)
{
let msg = &format!("`{}` target feature is not enabled", feature);
let mut err = self.tcx.sess.struct_span_err(expr.span, msg);
@ -377,9 +376,8 @@ impl<'tcx> ExprVisitor<'tcx> {
{
match feature {
Some(feature) => {
let feat_sym = Symbol::intern(feature);
if self.tcx.sess.target_features.contains(&feat_sym)
|| attrs.target_features.contains(&feat_sym)
if self.tcx.sess.target_features.contains(&feature)
|| attrs.target_features.contains(&feature)
{
missing_required_features.clear();
break;
@ -413,7 +411,11 @@ impl<'tcx> ExprVisitor<'tcx> {
let msg = format!(
"register class `{}` requires at least one of the following target features: {}",
reg_class.name(),
features.join(", ")
features
.iter()
.map(|f| f.as_str())
.intersperse(", ")
.collect::<String>(),
);
self.tcx.sess.struct_span_err(*op_sp, &msg).emit();
// register isn't enabled, don't do more checks

View file

@ -6,6 +6,7 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(crate_visibility_modifier)]
#![feature(iter_intersperse)]
#![feature(let_else)]
#![feature(map_try_insert)]
#![feature(min_specialization)]