diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2022-06-12 17:17:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-12 17:17:12 +0100 |
| commit | a8bd3402674963f903d415f2fd6fcd52fe12139d (patch) | |
| tree | fc5158fbf90110eb4ebad095de06a033599f3eb2 /src/llvm_backend_const.cpp | |
| parent | ca1f419dc28c2fb611b03afbe9661b3335554a40 (diff) | |
| parent | 865d88dd56a8b048e861787e048f364a4579da2b (diff) | |
Merge pull request #1395 from hdooley/master
factor out alloca generation into a helper
Diffstat (limited to 'src/llvm_backend_const.cpp')
| -rw-r--r-- | src/llvm_backend_const.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index bd76400de..00452eb50 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -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); { |