Pass tag target ptr rather than alloca

This commit is contained in:
Ayaz Hafiz 2023-06-16 21:06:49 -05:00
parent a7978abdc9
commit 6c4f76c5c9
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 23 additions and 21 deletions

View file

@ -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
}
}