Merge pull request #1395 from hdooley/master

factor out alloca generation into a helper
This commit is contained in:
gingerBill
2022-06-12 17:17:12 +01:00
committed by GitHub
3 changed files with 19 additions and 13 deletions
+3 -5
View File
@@ -410,12 +410,10 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc
// NOTE(bill, 2020-06-08): This is a bit of a hack but a "constant" slice needs
// its backing data on the stack
lbProcedure *p = m->curr_procedure;
LLVMPositionBuilderAtEnd(p->builder, p->decl_block->block);
LLVMTypeRef llvm_type = lb_type(m, t);
array_data = LLVMBuildAlloca(p->builder, llvm_type, "");
LLVMSetAlignment(array_data, 16); // TODO(bill): Make this configurable
LLVMPositionBuilderAtEnd(p->builder, p->curr_block->block);
array_data = llvm_alloca(p, llvm_type, 16);
LLVMBuildStore(p->builder, backing_array.value, array_data);
{