Update fmt and use of memcpy

I'm still not totally sure if this is the right way to implement the memcpy, but that portion
compiles correctly now. Now to fix the compile errors everywhere else :).
This commit is contained in:
kadmin 2020-10-05 20:13:36 +00:00
parent 0fdc07e197
commit 72c734d001
2 changed files with 15 additions and 10 deletions

View File

@ -120,15 +120,20 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
ref dst,
ref size,
}) => {
bx.memcpy(
dst,
todo!(),
src,
todo!(),
size,
todo!(),
);
bx
let dst_val = self.codegen_place(&mut bx, dst.as_ref());
let src_val = self.codegen_place(&mut bx, src.as_ref());
let size_val = self.codegen_operand(&mut bx, size);
let size = size_val.immediate_or_packed_pair(&mut bx);
bx.memcpy(
dst_val.llval,
dst_val.align,
src_val.llval,
src_val.align,
size,
// TODO probably want to have this change based on alignment above?
crate::MemFlags::empty(),
);
bx
}
mir::StatementKind::FakeRead(..)
| mir::StatementKind::Retag { .. }

View File

@ -1668,7 +1668,7 @@ impl Debug for Statement<'_> {
ref src,
ref dst,
ref size,
}) => write!(fmt, "src {:?} -> dst {:?}, {:?} bytes", src, dst, size),
}) => write!(fmt, "copy_nonoverlapping(src={:?}, dst={:?},bytes={:?})", src, dst, size),
Nop => write!(fmt, "nop"),
}
}