1
Fork 0

cg_llvm: inline check_store

This commit is contained in:
Erik Desjardins 2023-07-29 16:31:53 -04:00
parent 04303cfb3a
commit def44c5669

View file

@ -652,7 +652,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
flags: MemFlags, flags: MemFlags,
) -> &'ll Value { ) -> &'ll Value {
debug!("Store {:?} -> {:?} ({:?})", val, ptr, flags); debug!("Store {:?} -> {:?} ({:?})", val, ptr, flags);
let ptr = self.check_store(ptr); assert_eq!(self.cx.type_kind(self.cx.val_ty(ptr)), TypeKind::Pointer);
unsafe { unsafe {
let store = llvm::LLVMBuildStore(self.llbuilder, val, ptr); let store = llvm::LLVMBuildStore(self.llbuilder, val, ptr);
let align = let align =
@ -682,7 +682,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
size: Size, size: Size,
) { ) {
debug!("Store {:?} -> {:?}", val, ptr); debug!("Store {:?} -> {:?}", val, ptr);
let ptr = self.check_store(ptr); assert_eq!(self.cx.type_kind(self.cx.val_ty(ptr)), TypeKind::Pointer);
unsafe { unsafe {
let store = llvm::LLVMRustBuildAtomicStore( let store = llvm::LLVMRustBuildAtomicStore(
self.llbuilder, self.llbuilder,
@ -1382,14 +1382,6 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
ret.expect("LLVM does not have support for catchret") ret.expect("LLVM does not have support for catchret")
} }
fn check_store(&mut self, ptr: &'ll Value) -> &'ll Value {
let dest_ptr_ty = self.cx.val_ty(ptr);
assert_eq!(self.cx.type_kind(dest_ptr_ty), TypeKind::Pointer);
ptr
}
fn check_call<'b>( fn check_call<'b>(
&mut self, &mut self,
typ: &str, typ: &str,