Use Symbol for target features in asm handling
This saves a couple of Symbol::intern calls
This commit is contained in:
parent
a34c079752
commit
991cbd1503
20 changed files with 91 additions and 69 deletions
|
@ -1,5 +1,6 @@
|
|||
use super::{InlineAsmArch, InlineAsmType, Target};
|
||||
use rustc_macros::HashStable_Generic;
|
||||
use rustc_span::{sym, Symbol};
|
||||
use std::fmt;
|
||||
|
||||
def_reg_class! {
|
||||
|
@ -33,20 +34,20 @@ impl BpfInlineAsmRegClass {
|
|||
pub fn supported_types(
|
||||
self,
|
||||
_arch: InlineAsmArch,
|
||||
) -> &'static [(InlineAsmType, Option<&'static str>)] {
|
||||
) -> &'static [(InlineAsmType, Option<Symbol>)] {
|
||||
match self {
|
||||
Self::reg => types! { _: I8, I16, I32, I64; },
|
||||
Self::wreg => types! { "alu32": I8, I16, I32; },
|
||||
Self::wreg => types! { alu32: I8, I16, I32; },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn only_alu32(
|
||||
_arch: InlineAsmArch,
|
||||
mut has_feature: impl FnMut(&str) -> bool,
|
||||
mut has_feature: impl FnMut(Symbol) -> bool,
|
||||
_target: &Target,
|
||||
) -> Result<(), &'static str> {
|
||||
if !has_feature("alu32") {
|
||||
if !has_feature(sym::alu32) {
|
||||
Err("register can't be used without the `alu32` target feature")
|
||||
} else {
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue