Pass target_features set instead of has_feature closure

This avoids unnecessary monomorphizations in codegen backends
This commit is contained in:
bjorn3
2022-01-10 15:48:05 +01:00
parent 991cbd1503
commit 042aa379a5
8 changed files with 63 additions and 62 deletions

View File

@@ -1,5 +1,6 @@
use super::{InlineAsmArch, InlineAsmType};
use crate::spec::Target;
use rustc_data_structures::stable_set::FxHashSet;
use rustc_macros::HashStable_Generic;
use rustc_span::{sym, Symbol};
use std::fmt;
@@ -53,10 +54,10 @@ impl RiscVInlineAsmRegClass {
fn not_e(
_arch: InlineAsmArch,
mut has_feature: impl FnMut(Symbol) -> bool,
target_features: &FxHashSet<Symbol>,
_target: &Target,
) -> Result<(), &'static str> {
if has_feature(sym::e) {
if target_features.contains(&sym::e) {
Err("register can't be used with the `e` target feature")
} else {
Ok(())