Implement support for explicit tail calls in the MIR block builders and the LLVM codegen backend.
This commit is contained in:
@@ -4,3 +4,5 @@ codegen_gcc_unwinding_inline_asm =
|
||||
codegen_gcc_copy_bitcode = failed to copy bitcode to object file: {$err}
|
||||
|
||||
codegen_gcc_lto_bitcode_from_rlib = failed to get bitcode from object file for LTO ({$gcc_err})
|
||||
|
||||
codegen_gcc_explicit_tail_calls_unsupported = explicit tail calls with the 'become' keyword are not implemented in the GCC backend
|
||||
|
||||
@@ -34,6 +34,7 @@ use rustc_target::spec::{HasTargetSpec, HasX86AbiOpt, Target, X86Abi};
|
||||
|
||||
use crate::common::{SignType, TypeReflection, type_is_pointer};
|
||||
use crate::context::CodegenCx;
|
||||
use crate::errors;
|
||||
use crate::intrinsic::llvm;
|
||||
use crate::type_of::LayoutGccExt;
|
||||
|
||||
@@ -1742,6 +1743,20 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||
call
|
||||
}
|
||||
|
||||
fn tail_call(
|
||||
&mut self,
|
||||
_llty: Self::Type,
|
||||
_fn_attrs: Option<&CodegenFnAttrs>,
|
||||
_fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
||||
_llfn: Self::Value,
|
||||
_args: &[Self::Value],
|
||||
_funclet: Option<&Self::Funclet>,
|
||||
_instance: Option<Instance<'tcx>>,
|
||||
) {
|
||||
// FIXME: implement support for explicit tail calls like rustc_codegen_llvm.
|
||||
self.tcx.dcx().emit_fatal(errors::ExplicitTailCallsUnsupported);
|
||||
}
|
||||
|
||||
fn zext(&mut self, value: RValue<'gcc>, dest_typ: Type<'gcc>) -> RValue<'gcc> {
|
||||
// FIXME(antoyo): this does not zero-extend.
|
||||
self.gcc_int_cast(value, dest_typ)
|
||||
|
||||
@@ -19,3 +19,7 @@ pub(crate) struct CopyBitcode {
|
||||
pub(crate) struct LtoBitcodeFromRlib {
|
||||
pub gcc_err: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag(codegen_gcc_explicit_tail_calls_unsupported)]
|
||||
pub(crate) struct ExplicitTailCallsUnsupported;
|
||||
|
||||
Reference in New Issue
Block a user