@@ -980,7 +980,7 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
980980 llvm::Value *inRange = m_builder.CreateAnd (m_builder.CreateFCmpOGE (index, min), m_builder.CreateFCmpOLT (index, size));
981981
982982 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));
984984
985985 index = m_builder.CreateFPToUI (index, m_builder.getInt64Ty ());
986986 step.functionReturnReg ->value = m_builder.CreateSelect (inRange, getListItem (listPtr, index), null);
@@ -1378,7 +1378,7 @@ CompilerValue *LLVMCodeBuilder::addFunctionCall(const std::string &functionName,
13781378 ins->functionName = functionName;
13791379
13801380 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]) });
13821382
13831383 if (returnType != Compiler::StaticType::Void) {
13841384 auto reg = std::make_shared<LLVMRegister>(returnType);
@@ -1409,9 +1409,9 @@ CompilerValue *LLVMCodeBuilder::addFunctionCallWithCtx(const std::string &functi
14091409CompilerConstant *LLVMCodeBuilder::addConstValue (const Value &value)
14101410{
14111411 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);
14131413 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 )));
14151415}
14161416
14171417CompilerValue *LLVMCodeBuilder::addStringChar (CompilerValue *string, CompilerValue *index)
@@ -1470,7 +1470,7 @@ CompilerValue *LLVMCodeBuilder::addListItem(List *list, CompilerValue *index)
14701470 if (m_listPtrs.find (list) == m_listPtrs.cend ())
14711471 m_listPtrs[list] = LLVMListPtr ();
14721472
1473- ins->args .push_back ({ Compiler::StaticType::Number, static_cast <LLVMRegister *>(index) });
1473+ ins->args .push_back ({ Compiler::StaticType::Number, dynamic_cast <LLVMRegister *>(index) });
14741474
14751475 auto ret = std::make_shared<LLVMRegister>(Compiler::StaticType::Unknown);
14761476 ret->isRawValue = false ;
@@ -1807,7 +1807,7 @@ void LLVMCodeBuilder::createListReplace(List *list, CompilerValue *index, Compil
18071807void LLVMCodeBuilder::beginIfStatement (CompilerValue *cond)
18081808{
18091809 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) });
18111811 m_instructions.push_back (ins);
18121812}
18131813
@@ -1826,7 +1826,7 @@ void LLVMCodeBuilder::beginRepeatLoop(CompilerValue *count)
18261826 assert (!m_loopCondition);
18271827
18281828 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) });
18301830 m_instructions.push_back (ins);
18311831 pushLoopScope (false );
18321832}
@@ -1837,7 +1837,7 @@ void LLVMCodeBuilder::beginWhileLoop(CompilerValue *cond)
18371837 m_loopCondition = false ;
18381838
18391839 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) });
18411841 m_instructions.push_back (ins);
18421842 pushLoopScope (false );
18431843}
@@ -1848,7 +1848,7 @@ void LLVMCodeBuilder::beginRepeatUntilLoop(CompilerValue *cond)
18481848 m_loopCondition = false ;
18491849
18501850 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) });
18521852 m_instructions.push_back (ins);
18531853 pushLoopScope (false );
18541854}
@@ -2687,7 +2687,7 @@ LLVMRegister *LLVMCodeBuilder::createOp(const LLVMInstruction &ins, Compiler::St
26872687 m_instructions.push_back (createdIns);
26882688
26892689 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]) });
26912691
26922692 if (retType != Compiler::StaticType::Void) {
26932693 auto ret = std::make_shared<LLVMRegister>(retType);
0 commit comments