mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Pass tag target ptr rather than alloca
This commit is contained in:
parent
a7978abdc9
commit
6c4f76c5c9
2 changed files with 23 additions and 21 deletions
|
@ -407,18 +407,19 @@ impl<'ctx> RocUnion<'ctx> {
|
|||
width
|
||||
}
|
||||
|
||||
pub fn as_struct_alloca<'a, 'env>(
|
||||
pub fn write_struct_data<'a, 'env>(
|
||||
&self,
|
||||
env: &Env<'a, 'ctx, 'env>,
|
||||
layout_interner: &STLayoutInterner<'a>,
|
||||
// The allocation of the tag to write into.
|
||||
tag_alloca: PointerValue<'ctx>,
|
||||
// The data to write into the union.
|
||||
data: RocStruct<'ctx>,
|
||||
data_layout: LayoutRepr<'a>,
|
||||
tag_id: Option<usize>,
|
||||
) -> PointerValue<'ctx> {
|
||||
) {
|
||||
debug_assert_eq!(tag_id.is_some(), self.tag_type.is_some());
|
||||
|
||||
let tag_alloca = env.builder.build_alloca(self.struct_type(), "tag_alloca");
|
||||
|
||||
let data_buffer = env
|
||||
.builder
|
||||
.new_build_struct_gep(
|
||||
|
@ -482,8 +483,6 @@ impl<'ctx> RocUnion<'ctx> {
|
|||
|
||||
env.builder.build_store(tag_id_ptr, tag_id);
|
||||
}
|
||||
|
||||
tag_alloca
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue