@@ -102,13 +102,12 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
102
102
// Pass a wrapper rather than the function itself as the function itself may not
103
103
// be exported from the main codegen unit and may thus be unreachable from the
104
104
// object file created by an external assembler.
105
- let inline_asm_index = fx. cx . inline_asm_index . get ( ) ;
106
- fx. cx . inline_asm_index . set ( inline_asm_index + 1 ) ;
107
105
let wrapper_name = format ! (
108
106
"__inline_asm_{}_wrapper_n{}" ,
109
107
fx. cx. cgu_name. as_str( ) . replace( '.' , "__" ) . replace( '-' , "_" ) ,
110
- inline_asm_index
108
+ fx . cx . inline_asm_index
111
109
) ;
110
+ fx. cx . inline_asm_index += 1 ;
112
111
let sig =
113
112
get_function_sig ( fx. tcx , fx. target_config . default_call_conv , instance) ;
114
113
create_wrapper_function ( fx. module , sig, & wrapper_name, symbol. name ) ;
@@ -167,13 +166,12 @@ pub(crate) fn codegen_inline_asm_inner<'tcx>(
167
166
asm_gen. allocate_registers ( ) ;
168
167
asm_gen. allocate_stack_slots ( ) ;
169
168
170
- let inline_asm_index = fx. cx . inline_asm_index . get ( ) ;
171
- fx. cx . inline_asm_index . set ( inline_asm_index + 1 ) ;
172
169
let asm_name = format ! (
173
170
"__inline_asm_{}_n{}" ,
174
171
fx. cx. cgu_name. as_str( ) . replace( '.' , "__" ) . replace( '-' , "_" ) ,
175
- inline_asm_index
172
+ fx . cx . inline_asm_index
176
173
) ;
174
+ fx. cx . inline_asm_index += 1 ;
177
175
178
176
let generated_asm = asm_gen. generate_asm_wrapper ( & asm_name) ;
179
177
fx. cx . global_asm . push_str ( & generated_asm) ;
@@ -266,13 +264,12 @@ pub(crate) fn codegen_naked_asm<'tcx>(
266
264
// Pass a wrapper rather than the function itself as the function itself may not
267
265
// be exported from the main codegen unit and may thus be unreachable from the
268
266
// object file created by an external assembler.
269
- let inline_asm_index = cx. inline_asm_index . get ( ) ;
270
- cx. inline_asm_index . set ( inline_asm_index + 1 ) ;
271
267
let wrapper_name = format ! (
272
268
"__inline_asm_{}_wrapper_n{}" ,
273
269
cx. cgu_name. as_str( ) . replace( '.' , "__" ) . replace( '-' , "_" ) ,
274
- inline_asm_index
270
+ cx . inline_asm_index
275
271
) ;
272
+ cx. inline_asm_index += 1 ;
276
273
let sig =
277
274
get_function_sig ( tcx, module. target_config ( ) . default_call_conv , instance) ;
278
275
create_wrapper_function ( module, sig, & wrapper_name, symbol. name ) ;
0 commit comments