]> git.lizzy.rs Git - rust.git/commitdiff
Dispatch inline asm to the correct arch
authorGary Guo <gary@garyguo.net>
Mon, 22 Nov 2021 03:01:42 +0000 (03:01 +0000)
committerGary Guo <gary@garyguo.net>
Mon, 22 Nov 2021 16:28:14 +0000 (16:28 +0000)
src/inline_asm.rs

index 35876e57f3579d80814eb38def9926cd6fb27d7a..688fda753b68b8d0a9192b67de27d555ab22d174 100644 (file)
@@ -108,7 +108,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
 
     let mut asm_gen = InlineAssemblyGenerator {
         tcx: fx.tcx,
-        arch: InlineAsmArch::X86_64,
+        arch: fx.tcx.sess.asm_arch.unwrap(),
         template,
         operands,
         options,
@@ -306,12 +306,8 @@ fn allocate_stack_slots(&mut self) {
         let mut slots_output = vec![None; self.operands.len()];
 
         let new_slot_fn = |slot_size: &mut Size, reg_class: InlineAsmRegClass| {
-            let reg_size = reg_class
-                .supported_types(InlineAsmArch::X86_64)
-                .iter()
-                .map(|(ty, _)| ty.size())
-                .max()
-                .unwrap();
+            let reg_size =
+                reg_class.supported_types(self.arch).iter().map(|(ty, _)| ty.size()).max().unwrap();
             let align = rustc_target::abi::Align::from_bytes(reg_size.bytes()).unwrap();
             let offset = slot_size.align_to(align);
             *slot_size = offset + reg_size;