Change InlineAsm to allow multiple targets instead

This commit is contained in:
Gary Guo 2023-12-26 15:28:42 +00:00
parent ac8c8b612d
commit 98dcd85054

View File

@ -445,7 +445,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
template, template,
operands, operands,
options, options,
destination, targets,
line_spans: _, line_spans: _,
unwind: _, unwind: _,
} => { } => {
@ -456,13 +456,25 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
); );
} }
let have_labels = if options.contains(InlineAsmOptions::NORETURN) {
!targets.is_empty()
} else {
targets.len() > 1
};
if have_labels {
fx.tcx.dcx().span_fatal(
source_info.span,
"cranelift doesn't support labels in inline assembly.",
);
}
crate::inline_asm::codegen_inline_asm_terminator( crate::inline_asm::codegen_inline_asm_terminator(
fx, fx,
source_info.span, source_info.span,
template, template,
operands, operands,
*options, *options,
*destination, targets.get(0).copied(),
); );
} }
TerminatorKind::UnwindTerminate(reason) => { TerminatorKind::UnwindTerminate(reason) => {