factor out alloca generation into a helper

This commit is contained in:
Henry Dooley
2021-12-25 16:27:52 -06:00
parent 6f370fdbf2
commit 516065d7c2
3 changed files with 16 additions and 10 deletions

View File

@@ -413,9 +413,9 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc
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);
{