switch over to alloca expr

This commit is contained in:
Folkert 2023-07-29 20:20:40 +02:00
parent cdd2aab217
commit 44d03eebfa
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
8 changed files with 9 additions and 67 deletions

View file

@ -1615,7 +1615,6 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC {
PtrStore => RC::NoRc,
PtrLoad => RC::NoRc,
PtrCast => RC::NoRc,
Alloca => RC::NoRc,
PtrClearTagId | RefCountIncRcPtr | RefCountDecRcPtr | RefCountIncDataPtr
| RefCountDecDataPtr | RefCountIsUnique => {

View file

@ -1138,8 +1138,10 @@ fn insert_refcount_operations_binding<'a>(
Expr::Reset { .. } | Expr::ResetRef { .. } => {
unreachable!("Reset(ref) should not exist at this point")
}
Expr::Alloca { .. } => {
unreachable!("Alloca should not exist at this point")
Expr::Alloca { initializer, .. } => {
let new_let = new_let!(stmt);
inc_owned!(initializer.as_ref().copied().into_iter(), new_let)
}
}
}
@ -1367,7 +1369,6 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] {
PtrStore => arena.alloc_slice_copy(&[owned, owned]),
PtrLoad => arena.alloc_slice_copy(&[owned]),
PtrCast => arena.alloc_slice_copy(&[owned]),
Alloca => arena.alloc_slice_copy(&[owned]),
SetJmp | LongJmp | SetLongJmpBuffer => {
unreachable!("only inserted in dev backend codegen")

View file

@ -741,15 +741,10 @@ impl<'a> TrmcEnv<'a> {
.interner
.insert_direct_no_semantic(LayoutRepr::Ptr(return_layout));
let call = Call {
call_type: CallType::LowLevel {
op: LowLevel::Alloca,
update_mode: UpdateModeId::BACKEND_DUMMY,
},
arguments: arena.alloc([null_symbol]),
let ptr_null = Expr::Alloca {
initializer: Some(null_symbol),
element_layout: return_layout,
};
let ptr_null = Expr::Call(call);
let let_ptr = |next| Stmt::Let(initial_ptr_symbol, ptr_null, ptr_return_layout, next);
let joinpoint_id = JoinPointId(env.named_unique_symbol("trmc"));