diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-03-08 20:43:24 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-03-08 20:43:24 +0000 |
| commit | 77dae8c881fc431f2bdfdf6fa786863e4c7492dd (patch) | |
| tree | ad51d20bee969e6823083f1de123ab2d9a52fe19 | |
| parent | 54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba (diff) | |
| parent | 5ec45d3d7a42234a03a1dc681e794ecb6f276725 (diff) | |
| download | rust-77dae8c881fc431f2bdfdf6fa786863e4c7492dd.tar.gz rust-77dae8c881fc431f2bdfdf6fa786863e4c7492dd.zip | |
Merge branch 'sync_from_rust'
| -rw-r--r-- | src/base.rs | 16 | ||||
| -rw-r--r-- | src/global_asm.rs | 3 | ||||
| -rw-r--r-- | src/inline_asm.rs | 3 |
3 files changed, 19 insertions, 3 deletions
diff --git a/src/base.rs b/src/base.rs index a7e76fbc128..1ce920f3bdb 100644 --- a/src/base.rs +++ b/src/base.rs @@ -445,7 +445,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) { template, operands, options, - destination, + targets, line_spans: _, 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( fx, source_info.span, template, operands, *options, - *destination, + targets.get(0).copied(), ); } TerminatorKind::UnwindTerminate(reason) => { diff --git a/src/global_asm.rs b/src/global_asm.rs index da07b66c762..44650898de8 100644 --- a/src/global_asm.rs +++ b/src/global_asm.rs @@ -78,7 +78,8 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String, InlineAsmOperand::In { .. } | InlineAsmOperand::Out { .. } | InlineAsmOperand::InOut { .. } - | InlineAsmOperand::SplitInOut { .. } => { + | InlineAsmOperand::SplitInOut { .. } + | InlineAsmOperand::Label { .. } => { span_bug!(op_sp, "invalid operand type for global_asm!") } } diff --git a/src/inline_asm.rs b/src/inline_asm.rs index 7793b1b7092..171ee88a11c 100644 --- a/src/inline_asm.rs +++ b/src/inline_asm.rs @@ -129,6 +129,9 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>( let instance = Instance::mono(fx.tcx, def_id).polymorphize(fx.tcx); CInlineAsmOperand::Symbol { symbol: fx.tcx.symbol_name(instance).name.to_owned() } } + InlineAsmOperand::Label { .. } => { + span_bug!(span, "asm! label operands are not yet supported"); + } }) .collect::<Vec<_>>(); |
