Pass PlaceRef rather than Bx::Value to codegen_intrinsic_call
This commit is contained in:
@@ -965,12 +965,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
let args: Vec<_> =
|
||||
args.iter().map(|arg| self.codegen_operand(bx, &arg.node)).collect();
|
||||
|
||||
let result = PlaceRef::new_sized(dest, fn_abi.ret.layout);
|
||||
|
||||
match self.codegen_intrinsic_call(
|
||||
bx,
|
||||
instance,
|
||||
fn_abi,
|
||||
&args,
|
||||
dest,
|
||||
result,
|
||||
source_info,
|
||||
) {
|
||||
Ok(()) => {
|
||||
|
||||
@@ -58,7 +58,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
instance: ty::Instance<'tcx>,
|
||||
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
||||
args: &[OperandRef<'tcx, Bx::Value>],
|
||||
llresult: Bx::Value,
|
||||
result: PlaceRef<'tcx, Bx::Value>,
|
||||
source_info: SourceInfo,
|
||||
) -> Result<(), ty::Instance<'tcx>> {
|
||||
let span = source_info.span;
|
||||
@@ -100,7 +100,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
|
||||
let llret_ty = bx.backend_type(bx.layout_of(ret_ty));
|
||||
let result = PlaceRef::new_sized(llresult, fn_abi.ret.layout);
|
||||
|
||||
let llval = match name {
|
||||
sym::abort => {
|
||||
@@ -537,7 +536,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|
||||
_ => {
|
||||
// Need to use backend-specific things in the implementation.
|
||||
return bx.codegen_intrinsic_call(instance, fn_abi, args, llresult, span);
|
||||
return bx.codegen_intrinsic_call(instance, fn_abi, args, result, span);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ use rustc_target::callconv::FnAbi;
|
||||
|
||||
use super::BackendTypes;
|
||||
use crate::mir::operand::OperandRef;
|
||||
use crate::mir::place::PlaceRef;
|
||||
|
||||
pub trait IntrinsicCallBuilderMethods<'tcx>: BackendTypes {
|
||||
/// Remember to add all intrinsics here, in `compiler/rustc_hir_analysis/src/check/mod.rs`,
|
||||
@@ -16,7 +17,7 @@ pub trait IntrinsicCallBuilderMethods<'tcx>: BackendTypes {
|
||||
instance: ty::Instance<'tcx>,
|
||||
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
|
||||
args: &[OperandRef<'tcx, Self::Value>],
|
||||
llresult: Self::Value,
|
||||
result: PlaceRef<'tcx, Self::Value>,
|
||||
span: Span,
|
||||
) -> Result<(), ty::Instance<'tcx>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user