1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

sret calling convention fix

This commit is contained in:
Brian Fiete 2020-11-19 13:09:58 -08:00
parent ee4aa8a592
commit 84a0cf329f

View file

@ -15742,7 +15742,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX;
//mDebugging = (function->mName == "?__BfCtor@SpriteBatchRenderer@Repo@bf@@QEAAXTint@@@Z");
//mDebugging = (function->mName == "DoCallback");
// || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ");
// || (function->mName == "?Hey@Blurg@bf@@SAXXZ")
// ;
@ -16903,7 +16903,7 @@ void BeMCContext::Generate(BeFunction* function)
BF_ASSERT(retVal.IsVReg());
auto vregInfo = GetVRegInfo(retVal);
vregInfo->SetRetVal();
vregInfo->SetRetVal();
}
else if (retType->IsVector())
{
@ -16930,6 +16930,19 @@ void BeMCContext::Generate(BeFunction* function)
}
}
if (mBeFunction->HasStructRet())
{
for (int vregIdx = 0; vregIdx < (int)mVRegInfo.size(); vregIdx++)
{
auto vregInfo = mVRegInfo[vregIdx];
if (vregInfo->mIsRetVal)
{
AllocInst(BeMCInstKind_Mov, BeMCOperand::FromReg(X64Reg_RAX), BeMCOperand::FromVReg(vregIdx));
break;
}
}
}
auto mcInst = AllocInst();
mcInst->mKind = BeMCInstKind_Ret;
retCount++;