add alloca as an expression

This commit is contained in:
Folkert 2023-07-29 20:10:52 +02:00
parent 750234f2de
commit cdd2aab217
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
15 changed files with 171 additions and 14 deletions

View file

@ -1600,6 +1600,24 @@ pub(crate) fn build_exp_expr<'a, 'ctx>(
get_tag_id(env, layout_interner, parent, union_layout, argument).into()
}
Alloca {
initializer,
element_layout,
} => {
let element_type = basic_type_from_layout(
env,
layout_interner,
layout_interner.get_repr(*element_layout),
);
let ptr = entry_block_alloca_zerofill(env, element_type, "stack_value");
if let Some(initializer) = initializer {
env.builder.build_store(ptr, scope.load_symbol(initializer));
}
ptr.into()
}
}
}

View file

@ -1396,6 +1396,8 @@ pub(crate) fn run_low_level<'a, 'ctx>(
call_bitcode_fn(env, &[], bitcode::UTILS_DICT_PSEUDO_SEED)
}
SetJmp | LongJmp | SetLongJmpBuffer => unreachable!("only inserted in dev backend codegen"),
}
}