1
Fork 0

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,4 +1,5 @@
use super::{InlineAsmArch, InlineAsmType, Target};
use rustc_data_structures::stable_set::FxHashSet;
use rustc_macros::HashStable_Generic;
use rustc_span::{sym, Symbol};
use std::fmt;
@ -44,10 +45,10 @@ impl BpfInlineAsmRegClass {
fn only_alu32(
_arch: InlineAsmArch,
mut has_feature: impl FnMut(Symbol) -> bool,
target_features: &FxHashSet<Symbol>,
_target: &Target,
) -> Result<(), &'static str> {
if !has_feature(sym::alu32) {
if !target_features.contains(&sym::alu32) {
Err("register can't be used without the `alu32` target feature")
} else {
Ok(())