Skip to content

Commit 0fdcc76

Browse files
committed
LLVMCodeBuilder: Store list read/write instructions
1 parent c1674b2 commit 0fdcc76

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/engine/internal/llvm/llvmcodebuilder.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,7 @@ CompilerValue *LLVMCodeBuilder::addListItem(List *list, CompilerValue *index)
13191319
ins->functionReturnReg = ret.get();
13201320

13211321
m_instructions.push_back(ins);
1322+
m_listInstructions.push_back(m_instructions.back());
13221323
return addReg(ret, ins);
13231324
}
13241325

@@ -1330,6 +1331,7 @@ CompilerValue *LLVMCodeBuilder::addListItemIndex(List *list, CompilerValue *item
13301331
if (m_listPtrs.find(list) == m_listPtrs.cend())
13311332
m_listPtrs[list] = LLVMListPtr();
13321333

1334+
m_listInstructions.push_back(m_instructions.back());
13331335
return createOp(ins, Compiler::StaticType::Number, Compiler::StaticType::Unknown, { item });
13341336
}
13351337

@@ -1341,6 +1343,7 @@ CompilerValue *LLVMCodeBuilder::addListContains(List *list, CompilerValue *item)
13411343
if (m_listPtrs.find(list) == m_listPtrs.cend())
13421344
m_listPtrs[list] = LLVMListPtr();
13431345

1346+
m_listInstructions.push_back(m_instructions.back());
13441347
return createOp(ins, Compiler::StaticType::Bool, Compiler::StaticType::Unknown, { item });
13451348
}
13461349

@@ -1593,6 +1596,8 @@ void LLVMCodeBuilder::createListAppend(List *list, CompilerValue *item)
15931596

15941597
if (m_listPtrs.find(list) == m_listPtrs.cend())
15951598
m_listPtrs[list] = LLVMListPtr();
1599+
1600+
m_listInstructions.push_back(m_instructions.back());
15961601
}
15971602

15981603
void LLVMCodeBuilder::createListInsert(List *list, CompilerValue *index, CompilerValue *item)
@@ -1603,6 +1608,8 @@ void LLVMCodeBuilder::createListInsert(List *list, CompilerValue *index, Compile
16031608

16041609
if (m_listPtrs.find(list) == m_listPtrs.cend())
16051610
m_listPtrs[list] = LLVMListPtr();
1611+
1612+
m_listInstructions.push_back(m_instructions.back());
16061613
}
16071614

16081615
void LLVMCodeBuilder::createListReplace(List *list, CompilerValue *index, CompilerValue *item)
@@ -1613,6 +1620,8 @@ void LLVMCodeBuilder::createListReplace(List *list, CompilerValue *index, Compil
16131620

16141621
if (m_listPtrs.find(list) == m_listPtrs.cend())
16151622
m_listPtrs[list] = LLVMListPtr();
1623+
1624+
m_listInstructions.push_back(m_instructions.back());
16161625
}
16171626

16181627
void LLVMCodeBuilder::beginIfStatement(CompilerValue *cond)

src/engine/internal/llvm/llvmcodebuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ class LLVMCodeBuilder : public ICodeBuilder
238238
std::vector<long> m_loopScopeTree;
239239
bool m_loopCondition = false; // whether we're currently compiling a loop condition
240240
std::vector<std::shared_ptr<LLVMInstruction>> m_variableInstructions;
241+
std::vector<std::shared_ptr<LLVMInstruction>> m_listInstructions;
241242
std::vector<std::vector<llvm::Value *>> m_heap; // scopes
242243

243244
std::shared_ptr<ExecutableCode> m_output;

0 commit comments

Comments
 (0)