Use Symbol for target features in asm handling

This saves a couple of Symbol::intern calls
This commit is contained in:
bjorn3 2022-01-10 15:32:45 +01:00
parent 0b58e52786
commit 48abe3c6fa

View File

@ -6,7 +6,7 @@
use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_middle::mir::InlineAsmOperand; use rustc_middle::mir::InlineAsmOperand;
use rustc_span::Symbol; use rustc_span::sym;
use rustc_target::asm::*; use rustc_target::asm::*;
pub(crate) fn codegen_inline_asm<'tcx>( pub(crate) fn codegen_inline_asm<'tcx>(
@ -184,7 +184,7 @@ fn allocate_registers(&mut self) {
let sess = self.tcx.sess; let sess = self.tcx.sess;
let map = allocatable_registers( let map = allocatable_registers(
self.arch, self.arch,
|feature| sess.target_features.contains(&Symbol::intern(feature)), |feature| sess.target_features.contains(&feature),
&sess.target, &sess.target,
); );
let mut allocated = FxHashMap::<_, (bool, bool)>::default(); let mut allocated = FxHashMap::<_, (bool, bool)>::default();
@ -319,9 +319,9 @@ fn allocate_stack_slots(&mut self) {
// Allocate stack slots for saving clobbered registers // Allocate stack slots for saving clobbered registers
let abi_clobber = InlineAsmClobberAbi::parse( let abi_clobber = InlineAsmClobberAbi::parse(
self.arch, self.arch,
|feature| self.tcx.sess.target_features.contains(&Symbol::intern(feature)), |feature| self.tcx.sess.target_features.contains(&feature),
&self.tcx.sess.target, &self.tcx.sess.target,
Symbol::intern("C"), sym::C,
) )
.unwrap() .unwrap()
.clobbered_regs(); .clobbered_regs();