@@ -106,6 +106,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
106
106
let mut asm_gen = InlineAssemblyGenerator {
107
107
tcx : fx. tcx ,
108
108
arch : fx. tcx . sess . asm_arch . unwrap ( ) ,
109
+ enclosing_def_id : fx. instance . def_id ( ) ,
109
110
template,
110
111
operands,
111
112
options,
@@ -169,6 +170,7 @@ pub(crate) fn codegen_inline_asm<'tcx>(
169
170
struct InlineAssemblyGenerator < ' a , ' tcx > {
170
171
tcx : TyCtxt < ' tcx > ,
171
172
arch : InlineAsmArch ,
173
+ enclosing_def_id : DefId ,
172
174
template : & ' a [ InlineAsmTemplatePiece ] ,
173
175
operands : & ' a [ InlineAsmOperand < ' tcx > ] ,
174
176
options : InlineAsmOptions ,
@@ -182,7 +184,12 @@ struct InlineAssemblyGenerator<'a, 'tcx> {
182
184
impl < ' tcx > InlineAssemblyGenerator < ' _ , ' tcx > {
183
185
fn allocate_registers ( & mut self ) {
184
186
let sess = self . tcx . sess ;
185
- let map = allocatable_registers ( self . arch , & sess. target_features , & sess. target ) ;
187
+ let map = allocatable_registers (
188
+ self . arch ,
189
+ sess. relocation_model ( ) ,
190
+ self . tcx . asm_target_features ( self . enclosing_def_id ) ,
191
+ & sess. target ,
192
+ ) ;
186
193
let mut allocated = FxHashMap :: < _ , ( bool , bool ) > :: default ( ) ;
187
194
let mut regs = vec ! [ None ; self . operands. len( ) ] ;
188
195
@@ -313,14 +320,9 @@ impl<'tcx> InlineAssemblyGenerator<'_, 'tcx> {
313
320
let mut new_slot = |x| new_slot_fn ( & mut slot_size, x) ;
314
321
315
322
// Allocate stack slots for saving clobbered registers
316
- let abi_clobber = InlineAsmClobberAbi :: parse (
317
- self . arch ,
318
- & self . tcx . sess . target_features ,
319
- & self . tcx . sess . target ,
320
- sym:: C ,
321
- )
322
- . unwrap ( )
323
- . clobbered_regs ( ) ;
323
+ let abi_clobber = InlineAsmClobberAbi :: parse ( self . arch , & self . tcx . sess . target , sym:: C )
324
+ . unwrap ( )
325
+ . clobbered_regs ( ) ;
324
326
for ( i, reg) in self . registers . iter ( ) . enumerate ( ) . filter_map ( |( i, r) | r. map ( |r| ( i, r) ) ) {
325
327
let mut need_save = true ;
326
328
// If the register overlaps with a register clobbered by function call, then
0 commit comments