Update match branches

This updates all places where match branches check on StatementKind or UseContext.
This doesn't properly implement them, but adds TODOs where they are, and also adds some best
guesses to what they should be in some cases.
This commit is contained in:
kadmin 2020-10-05 22:53:00 +00:00
parent 72c734d001
commit 89f45ed9f3
19 changed files with 1346 additions and 24 deletions

View file

@ -293,8 +293,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
| MutatingUseContext::AsmOutput
| MutatingUseContext::Borrow
| MutatingUseContext::AddressOf
| MutatingUseContext::Projection
| MutatingUseContext::CopyNonOverlapping,
| MutatingUseContext::Projection,
)
| PlaceContext::NonMutatingUse(
NonMutatingUseContext::Inspect
@ -302,8 +301,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
| NonMutatingUseContext::UniqueBorrow
| NonMutatingUseContext::ShallowBorrow
| NonMutatingUseContext::AddressOf
| NonMutatingUseContext::Projection
| NonMutatingUseContext::CopyNonOverlapping,
| NonMutatingUseContext::Projection,
) => {
self.not_ssa(local);
}

View file

@ -120,18 +120,22 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
ref dst,
ref size,
}) => {
let dst_val = self.codegen_place(&mut bx, dst.as_ref());
let src_val = self.codegen_place(&mut bx, src.as_ref());
let dst_val = self.codegen_operand(&mut bx, dst);
let src_val = self.codegen_operand(&mut bx, src);
let size_val = self.codegen_operand(&mut bx, size);
let size = size_val.immediate_or_packed_pair(&mut bx);
let dst = dst_val.immediate_or_packed_pair(&mut bx);
let src = src_val.immediate_or_packed_pair(&mut bx);
use crate::MemFlags;
let flags =
(!MemFlags::UNALIGNED) & (!MemFlags::VOLATILE) & (!MemFlags::NONTEMPORAL);
bx.memcpy(
dst_val.llval,
dst_val.align,
src_val.llval,
src_val.align,
dst,
dst_val.layout.layout.align.pref,
src,
src_val.layout.layout.align.pref,
size,
// TODO probably want to have this change based on alignment above?
crate::MemFlags::empty(),
flags,
);
bx
}