mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-13 07:16:18 +00:00
add alloca as an expression
This commit is contained in:
parent
750234f2de
commit
cdd2aab217
15 changed files with 171 additions and 14 deletions
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue