aboutsummaryrefslogtreecommitdiffstats
path: root/main.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2024-06-25 17:29:45 -0400
committerClyne Sullivan <clyne@bitgloo.com>2024-06-25 17:29:45 -0400
commit0d8932e96934dbeb0f1e21872693ca833a64341f (patch)
tree93c95a0bd94f143362144d8a0a7704a797eb8ac5 /main.cpp
parentb16e418091bad151ed064b56f6c4d195242044d7 (diff)
take env off stack; only save locals for recursion
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.cpp b/main.cpp
index 5ae41bc..2ac1ff5 100644
--- a/main.cpp
+++ b/main.cpp
@@ -53,7 +53,9 @@ int main()
auto envtype = llvm::VectorType::get(llvmState.inttype, ThunkAST::envidx, false);
auto [t0, _] = Var::lookup("__t0");
llvmState.builder.SetInsertPoint(entry);
- auto env = llvmState.builder.CreateAlloca(envtype, nullptr);
+ auto zerovec = llvm::ConstantVector::get(llvm::ArrayRef(llvmState.zero));
+ auto env = new llvm::GlobalVariable(llvmState.modul, envtype, false,
+ llvm::GlobalValue::InternalLinkage, zerovec, "env");
llvmState.builder.CreateCall(llvmState.ftype, t0, llvm::ArrayRef<llvm::Value *> {env});
llvmState.builder.CreateRetVoid();