@@ -53,11 +53,11 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
5353{
5454 if (!m_warp) {
5555 // Do not create coroutine if there are no yield instructions nor non-warp procedure calls
56- auto it = std::find_if (m_instructions .begin (), m_instructions .end (), [](const std::shared_ptr<LLVMInstruction> &step) {
56+ auto it = std::find_if (m_instructionList .begin (), m_instructionList .end (), [](const std::shared_ptr<LLVMInstruction> &step) {
5757 return step->type == LLVMInstruction::Type::Yield || (step->type == LLVMInstruction::Type::CallProcedure && step->procedurePrototype && !step->procedurePrototype ->warp ());
5858 });
5959
60- if (it == m_instructions .end ())
60+ if (it == m_instructionList .end ())
6161 m_warp = true ;
6262
6363 // Only create coroutines in scripts
@@ -153,7 +153,7 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
153153 pushScopeLevel ();
154154
155155 // Execute recorded steps
156- for (const auto insPtr : m_instructions ) {
156+ for (const auto insPtr : m_instructionList ) {
157157 const LLVMInstruction &step = *insPtr;
158158
159159 switch (step.type ) {
@@ -1340,21 +1340,21 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
13401340
13411341 case Compiler::CodeType::Reporter: {
13421342 // Use last instruction return value (or last constant) and create a ValueData instance
1343- assert (!m_instructions .empty () || m_lastConstValue);
1344- LLVMRegister *ret = m_instructions .empty () ? m_lastConstValue : m_instructions .back ()->functionReturnReg ;
1343+ assert (!m_instructionList .empty () || m_lastConstValue);
1344+ LLVMRegister *ret = m_instructionList .empty () ? m_lastConstValue : m_instructionList .back ()->functionReturnReg ;
13451345 llvm::Value *copy = createNewValue (ret);
13461346 m_builder.CreateRet (m_builder.CreateLoad (m_valueDataType, copy));
13471347 break ;
13481348 }
13491349
13501350 case Compiler::CodeType::HatPredicate:
13511351 // Use last instruction return value (or last constant)
1352- assert (!m_instructions .empty () || m_lastConstValue);
1352+ assert (!m_instructionList .empty () || m_lastConstValue);
13531353
1354- if (m_instructions .empty ())
1354+ if (m_instructionList .empty ())
13551355 m_builder.CreateRet (castValue (m_lastConstValue, Compiler::StaticType::Bool));
13561356 else
1357- m_builder.CreateRet (castValue (m_instructions .back ()->functionReturnReg , Compiler::StaticType::Bool));
1357+ m_builder.CreateRet (castValue (m_instructionList .back ()->functionReturnReg , Compiler::StaticType::Bool));
13581358 break ;
13591359 }
13601360
@@ -1394,25 +1394,25 @@ CompilerValue *LLVMCodeBuilder::addFunctionCall(const std::string &functionName,
13941394 auto reg = std::make_shared<LLVMRegister>(returnType);
13951395 reg->isRawValue = true ;
13961396 ins->functionReturnReg = reg.get ();
1397- m_instructions .push_back (ins);
1397+ m_instructionList .push_back (ins);
13981398 return addReg (reg, ins);
13991399 }
14001400
1401- m_instructions .push_back (ins);
1401+ m_instructionList .push_back (ins);
14021402 return nullptr ;
14031403}
14041404
14051405CompilerValue *LLVMCodeBuilder::addTargetFunctionCall (const std::string &functionName, Compiler::StaticType returnType, const Compiler::ArgTypes &argTypes, const Compiler::Args &args)
14061406{
14071407 CompilerValue *ret = addFunctionCall (functionName, returnType, argTypes, args);
1408- m_instructions .back ()->functionTargetArg = true ;
1408+ m_instructionList .back ()->functionTargetArg = true ;
14091409 return ret;
14101410}
14111411
14121412CompilerValue *LLVMCodeBuilder::addFunctionCallWithCtx (const std::string &functionName, Compiler::StaticType returnType, const Compiler::ArgTypes &argTypes, const Compiler::Args &args)
14131413{
14141414 CompilerValue *ret = addFunctionCall (functionName, returnType, argTypes, args);
1415- m_instructions .back ()->functionCtxArg = true ;
1415+ m_instructionList .back ()->functionCtxArg = true ;
14161416 return ret;
14171417}
14181418
@@ -1456,8 +1456,8 @@ CompilerValue *LLVMCodeBuilder::addVariableValue(Variable *variable)
14561456 ret->isRawValue = false ;
14571457 ins->functionReturnReg = ret.get ();
14581458
1459- m_instructions .push_back (ins);
1460- m_variableInstructions.push_back (m_instructions .back ());
1459+ m_instructionList .push_back (ins);
1460+ m_variableInstructions.push_back (m_instructionList .back ());
14611461 return addReg (ret, ins);
14621462}
14631463
@@ -1486,8 +1486,8 @@ CompilerValue *LLVMCodeBuilder::addListItem(List *list, CompilerValue *index)
14861486 ret->isRawValue = false ;
14871487 ins->functionReturnReg = ret.get ();
14881488
1489- m_instructions .push_back (ins);
1490- m_listInstructions.push_back (m_instructions .back ());
1489+ m_instructionList .push_back (ins);
1490+ m_listInstructions.push_back (m_instructionList .back ());
14911491 return addReg (ret, ins);
14921492}
14931493
@@ -1500,7 +1500,7 @@ CompilerValue *LLVMCodeBuilder::addListItemIndex(List *list, CompilerValue *item
15001500 m_listPtrs[list] = LLVMListPtr ();
15011501
15021502 auto ret = createOp (ins, Compiler::StaticType::Number, Compiler::StaticType::Unknown, { item });
1503- m_listInstructions.push_back (m_instructions .back ());
1503+ m_listInstructions.push_back (m_instructionList .back ());
15041504 return ret;
15051505}
15061506
@@ -1513,7 +1513,7 @@ CompilerValue *LLVMCodeBuilder::addListContains(List *list, CompilerValue *item)
15131513 m_listPtrs[list] = LLVMListPtr ();
15141514
15151515 auto ret = createOp (ins, Compiler::StaticType::Bool, Compiler::StaticType::Unknown, { item });
1516- m_listInstructions.push_back (m_instructions .back ());
1516+ m_listInstructions.push_back (m_instructionList .back ());
15171517 return ret;
15181518}
15191519
@@ -1549,7 +1549,7 @@ CompilerValue *LLVMCodeBuilder::addProcedureArgument(const std::string &name)
15491549 ins->functionReturnReg = ret.get ();
15501550 ins->procedureArgIndex = index;
15511551
1552- m_instructions .push_back (ins);
1552+ m_instructionList .push_back (ins);
15531553 return addReg (ret, ins);
15541554}
15551555
@@ -1737,10 +1737,10 @@ void LLVMCodeBuilder::createVariableWrite(Variable *variable, CompilerValue *val
17371737
17381738 if (m_loopScope >= 0 ) {
17391739 auto scope = m_loopScopes[m_loopScope];
1740- m_variablePtrs[variable].loopVariableWrites [scope.get ()].push_back (m_instructions .back ());
1740+ m_variablePtrs[variable].loopVariableWrites [scope.get ()].push_back (m_instructionList .back ());
17411741 }
17421742
1743- m_variableInstructions.push_back (m_instructions .back ());
1743+ m_variableInstructions.push_back (m_instructionList .back ());
17441744}
17451745
17461746void LLVMCodeBuilder::createListClear (List *list)
@@ -1774,10 +1774,10 @@ void LLVMCodeBuilder::createListAppend(List *list, CompilerValue *item)
17741774
17751775 if (m_loopScope >= 0 ) {
17761776 auto scope = m_loopScopes[m_loopScope];
1777- m_listPtrs[list].loopListWrites [scope.get ()].push_back (m_instructions .back ());
1777+ m_listPtrs[list].loopListWrites [scope.get ()].push_back (m_instructionList .back ());
17781778 }
17791779
1780- m_listInstructions.push_back (m_instructions .back ());
1780+ m_listInstructions.push_back (m_instructionList .back ());
17811781}
17821782
17831783void LLVMCodeBuilder::createListInsert (List *list, CompilerValue *index, CompilerValue *item)
@@ -1791,10 +1791,10 @@ void LLVMCodeBuilder::createListInsert(List *list, CompilerValue *index, Compile
17911791
17921792 if (m_loopScope >= 0 ) {
17931793 auto scope = m_loopScopes[m_loopScope];
1794- m_listPtrs[list].loopListWrites [scope.get ()].push_back (m_instructions .back ());
1794+ m_listPtrs[list].loopListWrites [scope.get ()].push_back (m_instructionList .back ());
17951795 }
17961796
1797- m_listInstructions.push_back (m_instructions .back ());
1797+ m_listInstructions.push_back (m_instructionList .back ());
17981798}
17991799
18001800void LLVMCodeBuilder::createListReplace (List *list, CompilerValue *index, CompilerValue *item)
@@ -1808,27 +1808,27 @@ void LLVMCodeBuilder::createListReplace(List *list, CompilerValue *index, Compil
18081808
18091809 if (m_loopScope >= 0 ) {
18101810 auto scope = m_loopScopes[m_loopScope];
1811- m_listPtrs[list].loopListWrites [scope.get ()].push_back (m_instructions .back ());
1811+ m_listPtrs[list].loopListWrites [scope.get ()].push_back (m_instructionList .back ());
18121812 }
18131813
1814- m_listInstructions.push_back (m_instructions .back ());
1814+ m_listInstructions.push_back (m_instructionList .back ());
18151815}
18161816
18171817void LLVMCodeBuilder::beginIfStatement (CompilerValue *cond)
18181818{
18191819 auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginIf, currentLoopScope (), m_loopCondition);
18201820 ins->args .push_back ({ Compiler::StaticType::Bool, dynamic_cast <LLVMRegister *>(cond) });
1821- m_instructions .push_back (ins);
1821+ m_instructionList .push_back (ins);
18221822}
18231823
18241824void LLVMCodeBuilder::beginElseBranch ()
18251825{
1826- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginElse, currentLoopScope (), m_loopCondition));
1826+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginElse, currentLoopScope (), m_loopCondition));
18271827}
18281828
18291829void LLVMCodeBuilder::endIf ()
18301830{
1831- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::EndIf, currentLoopScope (), m_loopCondition));
1831+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::EndIf, currentLoopScope (), m_loopCondition));
18321832}
18331833
18341834void LLVMCodeBuilder::beginRepeatLoop (CompilerValue *count)
@@ -1837,7 +1837,7 @@ void LLVMCodeBuilder::beginRepeatLoop(CompilerValue *count)
18371837
18381838 auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginRepeatLoop, currentLoopScope (), m_loopCondition);
18391839 ins->args .push_back ({ Compiler::StaticType::Number, dynamic_cast <LLVMRegister *>(count) });
1840- m_instructions .push_back (ins);
1840+ m_instructionList .push_back (ins);
18411841 pushLoopScope (false );
18421842}
18431843
@@ -1848,7 +1848,7 @@ void LLVMCodeBuilder::beginWhileLoop(CompilerValue *cond)
18481848
18491849 auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginWhileLoop, currentLoopScope (), m_loopCondition);
18501850 ins->args .push_back ({ Compiler::StaticType::Bool, dynamic_cast <LLVMRegister *>(cond) });
1851- m_instructions .push_back (ins);
1851+ m_instructionList .push_back (ins);
18521852 pushLoopScope (false );
18531853}
18541854
@@ -1859,37 +1859,37 @@ void LLVMCodeBuilder::beginRepeatUntilLoop(CompilerValue *cond)
18591859
18601860 auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginRepeatUntilLoop, currentLoopScope (), m_loopCondition);
18611861 ins->args .push_back ({ Compiler::StaticType::Bool, dynamic_cast <LLVMRegister *>(cond) });
1862- m_instructions .push_back (ins);
1862+ m_instructionList .push_back (ins);
18631863 pushLoopScope (false );
18641864}
18651865
18661866void LLVMCodeBuilder::beginLoopCondition ()
18671867{
18681868 assert (!m_loopCondition);
1869- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginLoopCondition, currentLoopScope (), m_loopCondition));
1869+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginLoopCondition, currentLoopScope (), m_loopCondition));
18701870 m_loopCondition = true ;
18711871}
18721872
18731873void LLVMCodeBuilder::endLoop ()
18741874{
18751875 if (!m_warp)
1876- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Yield, currentLoopScope (), m_loopCondition));
1876+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Yield, currentLoopScope (), m_loopCondition));
18771877
1878- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::EndLoop, currentLoopScope (), m_loopCondition));
1878+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::EndLoop, currentLoopScope (), m_loopCondition));
18791879 popLoopScope ();
18801880}
18811881
18821882void LLVMCodeBuilder::yield ()
18831883{
1884- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Yield, currentLoopScope (), m_loopCondition));
1884+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Yield, currentLoopScope (), m_loopCondition));
18851885
18861886 if (m_loopScope >= 0 )
18871887 m_loopScopes[m_loopScope]->containsYield = true ;
18881888}
18891889
18901890void LLVMCodeBuilder::createStop ()
18911891{
1892- m_instructions .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Stop, currentLoopScope (), m_loopCondition));
1892+ m_instructionList .push_back (std::make_shared<LLVMInstruction>(LLVMInstruction::Type::Stop, currentLoopScope (), m_loopCondition));
18931893}
18941894
18951895void LLVMCodeBuilder::createProcedureCall (BlockPrototype *prototype, const Compiler::Args &args)
@@ -2551,7 +2551,7 @@ bool LLVMCodeBuilder::isVarOrListTypeSafe(std::shared_ptr<LLVMInstruction> ins,
25512551 else
25522552 log.insert (ins.get ());
25532553
2554- assert (std::find (m_instructions .begin (), m_instructions .end (), ins) != m_instructions .end ());
2554+ assert (std::find (m_instructionList .begin (), m_instructionList .end (), ins) != m_instructionList .end ());
25552555 const LLVMVariablePtr *varPtr = ins->workVariable ? &m_variablePtrs.at (ins->workVariable ) : nullptr ;
25562556 const LLVMListPtr *listPtr = ins->workList ? &m_listPtrs.at (ins->workList ) : nullptr ;
25572557 assert ((varPtr || listPtr) && !(varPtr && listPtr));
@@ -2715,7 +2715,7 @@ LLVMRegister *LLVMCodeBuilder::createOp(const LLVMInstruction &ins, Compiler::St
27152715LLVMRegister *LLVMCodeBuilder::createOp (const LLVMInstruction &ins, Compiler::StaticType retType, const Compiler::ArgTypes &argTypes, const Compiler::Args &args)
27162716{
27172717 auto createdIns = std::make_shared<LLVMInstruction>(ins);
2718- m_instructions .push_back (createdIns);
2718+ m_instructionList .push_back (createdIns);
27192719
27202720 for (size_t i = 0 ; i < args.size (); i++)
27212721 createdIns->args .push_back ({ argTypes[i], dynamic_cast <LLVMRegister *>(args[i]) });
0 commit comments