diff --git a/src/base.rs b/src/base.rs index f7fdea651402..57396004c12d 100644 --- a/src/base.rs +++ b/src/base.rs @@ -53,6 +53,8 @@ pub(crate) fn trans_fn<'tcx, B: Backend + 'static>( vtables: &mut cx.vtables, source_info_set: indexmap::IndexSet::new(), next_ssa_var: 0, + + inline_asm_index: 0, }; let arg_uninhabited = fx.mir.args_iter().any(|arg| fx.layout_of(fx.monomorphize(&fx.mir.local_decls[arg].ty)).abi.is_uninhabited()); diff --git a/src/common.rs b/src/common.rs index c8fcbbe1d37f..39a918b60f30 100644 --- a/src/common.rs +++ b/src/common.rs @@ -278,6 +278,8 @@ pub(crate) struct FunctionCx<'clif, 'tcx, B: Backend + 'static> { /// This should only be accessed by `CPlace::new_var`. pub(crate) next_ssa_var: u32, + + pub(crate) inline_asm_index: u32, } impl<'tcx, B: Backend> LayoutOf for FunctionCx<'_, 'tcx, B> { diff --git a/src/inline_asm.rs b/src/inline_asm.rs index e2bbdd5ce917..4c3fe87dae3d 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -68,7 +68,9 @@ pub(crate) fn codegen_inline_asm<'tcx>( } } - let asm_name = format!("{}__inline_asm_{}", fx.tcx.symbol_name(fx.instance).name, /*FIXME*/0); + let inline_asm_index = fx.inline_asm_index; + fx.inline_asm_index += 1; + let asm_name = format!("{}__inline_asm_{}", fx.tcx.symbol_name(fx.instance).name, inline_asm_index); let generated_asm = generate_asm_wrapper(&asm_name, InlineAsmArch::X86_64, options, template, clobbered_regs, &inputs, &outputs); fx.global_asm.push_str(&generated_asm);