various fixes for naked_asm!
implementation
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
This commit is contained in:
parent
0bd0b99729
commit
2811ce715d
@ -726,6 +726,12 @@ fn index(&self, index: usize) -> &Self::Output {
|
|||||||
/* compiler built-in */
|
/* compiler built-in */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[rustc_builtin_macro]
|
||||||
|
#[rustc_macro_transparency = "semitransparent"]
|
||||||
|
pub macro naked_asm() {
|
||||||
|
/* compiler built-in */
|
||||||
|
}
|
||||||
|
|
||||||
pub static A_STATIC: u8 = 42;
|
pub static A_STATIC: u8 = 42;
|
||||||
|
|
||||||
#[lang = "panic_location"]
|
#[lang = "panic_location"]
|
||||||
|
@ -390,7 +390,7 @@ fn stack_val_align() {
|
|||||||
#[naked]
|
#[naked]
|
||||||
extern "C" fn naked_test() {
|
extern "C" fn naked_test() {
|
||||||
unsafe {
|
unsafe {
|
||||||
asm!("ret", options(noreturn));
|
naked_asm!("ret");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
|
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
|
||||||
use rustc_index::IndexVec;
|
use rustc_index::IndexVec;
|
||||||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||||
|
use rustc_middle::mir::InlineAsmMacro;
|
||||||
use rustc_middle::ty::TypeVisitableExt;
|
use rustc_middle::ty::TypeVisitableExt;
|
||||||
use rustc_middle::ty::adjustment::PointerCoercion;
|
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||||
use rustc_middle::ty::layout::FnAbiOf;
|
use rustc_middle::ty::layout::FnAbiOf;
|
||||||
@ -57,6 +58,7 @@ pub(crate) fn codegen_fn<'tcx>(
|
|||||||
|
|
||||||
match &mir.basic_blocks[START_BLOCK].terminator().kind {
|
match &mir.basic_blocks[START_BLOCK].terminator().kind {
|
||||||
TerminatorKind::InlineAsm {
|
TerminatorKind::InlineAsm {
|
||||||
|
asm_macro: InlineAsmMacro::NakedAsm,
|
||||||
template,
|
template,
|
||||||
operands,
|
operands,
|
||||||
options,
|
options,
|
||||||
@ -498,6 +500,7 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
|
|||||||
"tail calls are not yet supported in `rustc_codegen_cranelift` backend"
|
"tail calls are not yet supported in `rustc_codegen_cranelift` backend"
|
||||||
),
|
),
|
||||||
TerminatorKind::InlineAsm {
|
TerminatorKind::InlineAsm {
|
||||||
|
asm_macro: _,
|
||||||
template,
|
template,
|
||||||
operands,
|
operands,
|
||||||
options,
|
options,
|
||||||
|
Loading…
Reference in New Issue
Block a user