@@ -980,7 +980,7 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
980
980
llvm::Value *inRange = m_builder.CreateAnd (m_builder.CreateFCmpOGE (index , min), m_builder.CreateFCmpOLT (index , size));
981
981
982
982
LLVMConstantRegister nullReg (listPtr.type == Compiler::StaticType::Unknown ? Compiler::StaticType::Number : listPtr.type , Value ());
983
- llvm::Value *null = createValue (static_cast <LLVMRegister *>(static_cast <CompilerValue *>( &nullReg) ));
983
+ llvm::Value *null = createValue (static_cast <LLVMRegister *>(&nullReg));
984
984
985
985
index = m_builder.CreateFPToUI (index , m_builder.getInt64Ty ());
986
986
step.functionReturnReg ->value = m_builder.CreateSelect (inRange, getListItem (listPtr, index ), null);
@@ -1378,7 +1378,7 @@ CompilerValue *LLVMCodeBuilder::addFunctionCall(const std::string &functionName,
1378
1378
ins->functionName = functionName;
1379
1379
1380
1380
for (size_t i = 0 ; i < args.size (); i++)
1381
- ins->args .push_back ({ argTypes[i], static_cast <LLVMRegister *>(args[i]) });
1381
+ ins->args .push_back ({ argTypes[i], dynamic_cast <LLVMRegister *>(args[i]) });
1382
1382
1383
1383
if (returnType != Compiler::StaticType::Void) {
1384
1384
auto reg = std::make_shared<LLVMRegister>(returnType);
@@ -1409,9 +1409,9 @@ CompilerValue *LLVMCodeBuilder::addFunctionCallWithCtx(const std::string &functi
1409
1409
CompilerConstant *LLVMCodeBuilder::addConstValue (const Value &value)
1410
1410
{
1411
1411
auto constReg = std::make_shared<LLVMConstantRegister>(TYPE_MAP[value.type ()], value);
1412
- auto reg = std::reinterpret_pointer_cast <LLVMRegister>(constReg);
1412
+ auto reg = std::static_pointer_cast <LLVMRegister>(constReg);
1413
1413
m_lastConstValue = reg.get ();
1414
- return static_cast <CompilerConstant *>(static_cast <CompilerValue *>(addReg (reg, nullptr )));
1414
+ return static_cast <CompilerConstant *>(static_cast <LLVMConstantRegister *>(addReg (reg, nullptr )));
1415
1415
}
1416
1416
1417
1417
CompilerValue *LLVMCodeBuilder::addStringChar (CompilerValue *string, CompilerValue *index)
@@ -1470,7 +1470,7 @@ CompilerValue *LLVMCodeBuilder::addListItem(List *list, CompilerValue *index)
1470
1470
if (m_listPtrs.find (list) == m_listPtrs.cend ())
1471
1471
m_listPtrs[list] = LLVMListPtr ();
1472
1472
1473
- ins->args .push_back ({ Compiler::StaticType::Number, static_cast <LLVMRegister *>(index ) });
1473
+ ins->args .push_back ({ Compiler::StaticType::Number, dynamic_cast <LLVMRegister *>(index ) });
1474
1474
1475
1475
auto ret = std::make_shared<LLVMRegister>(Compiler::StaticType::Unknown);
1476
1476
ret->isRawValue = false ;
@@ -1807,7 +1807,7 @@ void LLVMCodeBuilder::createListReplace(List *list, CompilerValue *index, Compil
1807
1807
void LLVMCodeBuilder::beginIfStatement (CompilerValue *cond)
1808
1808
{
1809
1809
auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginIf, currentLoopScope (), m_loopCondition);
1810
- ins->args .push_back ({ Compiler::StaticType::Bool, static_cast <LLVMRegister *>(cond) });
1810
+ ins->args .push_back ({ Compiler::StaticType::Bool, dynamic_cast <LLVMRegister *>(cond) });
1811
1811
m_instructions.push_back (ins);
1812
1812
}
1813
1813
@@ -1826,7 +1826,7 @@ void LLVMCodeBuilder::beginRepeatLoop(CompilerValue *count)
1826
1826
assert (!m_loopCondition);
1827
1827
1828
1828
auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginRepeatLoop, currentLoopScope (), m_loopCondition);
1829
- ins->args .push_back ({ Compiler::StaticType::Number, static_cast <LLVMRegister *>(count) });
1829
+ ins->args .push_back ({ Compiler::StaticType::Number, dynamic_cast <LLVMRegister *>(count) });
1830
1830
m_instructions.push_back (ins);
1831
1831
pushLoopScope (false );
1832
1832
}
@@ -1837,7 +1837,7 @@ void LLVMCodeBuilder::beginWhileLoop(CompilerValue *cond)
1837
1837
m_loopCondition = false ;
1838
1838
1839
1839
auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginWhileLoop, currentLoopScope (), m_loopCondition);
1840
- ins->args .push_back ({ Compiler::StaticType::Bool, static_cast <LLVMRegister *>(cond) });
1840
+ ins->args .push_back ({ Compiler::StaticType::Bool, dynamic_cast <LLVMRegister *>(cond) });
1841
1841
m_instructions.push_back (ins);
1842
1842
pushLoopScope (false );
1843
1843
}
@@ -1848,7 +1848,7 @@ void LLVMCodeBuilder::beginRepeatUntilLoop(CompilerValue *cond)
1848
1848
m_loopCondition = false ;
1849
1849
1850
1850
auto ins = std::make_shared<LLVMInstruction>(LLVMInstruction::Type::BeginRepeatUntilLoop, currentLoopScope (), m_loopCondition);
1851
- ins->args .push_back ({ Compiler::StaticType::Bool, static_cast <LLVMRegister *>(cond) });
1851
+ ins->args .push_back ({ Compiler::StaticType::Bool, dynamic_cast <LLVMRegister *>(cond) });
1852
1852
m_instructions.push_back (ins);
1853
1853
pushLoopScope (false );
1854
1854
}
@@ -2687,7 +2687,7 @@ LLVMRegister *LLVMCodeBuilder::createOp(const LLVMInstruction &ins, Compiler::St
2687
2687
m_instructions.push_back (createdIns);
2688
2688
2689
2689
for (size_t i = 0 ; i < args.size (); i++)
2690
- createdIns->args .push_back ({ argTypes[i], static_cast <LLVMRegister *>(args[i]) });
2690
+ createdIns->args .push_back ({ argTypes[i], dynamic_cast <LLVMRegister *>(args[i]) });
2691
2691
2692
2692
if (retType != Compiler::StaticType::Void) {
2693
2693
auto ret = std::make_shared<LLVMRegister>(retType);
0 commit comments