Skip to content

Commit 77dae8c

Browse files
committed
Merge branch 'sync_from_rust'
2 parents 54cbb6e + 5ec45d3 commit 77dae8c

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

src/base.rs

+14-2
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
445445
template,
446446
operands,
447447
options,
448-
destination,
448+
targets,
449449
line_spans: _,
450450
unwind: _,
451451
} => {
@@ -456,13 +456,25 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
456456
);
457457
}
458458

459+
let have_labels = if options.contains(InlineAsmOptions::NORETURN) {
460+
!targets.is_empty()
461+
} else {
462+
targets.len() > 1
463+
};
464+
if have_labels {
465+
fx.tcx.dcx().span_fatal(
466+
source_info.span,
467+
"cranelift doesn't support labels in inline assembly.",
468+
);
469+
}
470+
459471
crate::inline_asm::codegen_inline_asm_terminator(
460472
fx,
461473
source_info.span,
462474
template,
463475
operands,
464476
*options,
465-
*destination,
477+
targets.get(0).copied(),
466478
);
467479
}
468480
TerminatorKind::UnwindTerminate(reason) => {

src/global_asm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String,
7878
InlineAsmOperand::In { .. }
7979
| InlineAsmOperand::Out { .. }
8080
| InlineAsmOperand::InOut { .. }
81-
| InlineAsmOperand::SplitInOut { .. } => {
81+
| InlineAsmOperand::SplitInOut { .. }
82+
| InlineAsmOperand::Label { .. } => {
8283
span_bug!(op_sp, "invalid operand type for global_asm!")
8384
}
8485
}

src/inline_asm.rs

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
129129
let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx);
130130
CInlineAsmOperand::Symbol { symbol: fx.tcx.symbol_name(instance).name.to_owned() }
131131
}
132+
InlineAsmOperand::Label { .. } => {
133+
span_bug!(span, "asm! label operands are not yet supported");
134+
}
132135
})
133136
.collect::<Vec<_>>();
134137

0 commit comments

Comments
 (0)