From 4c553ee9a3e4f9467f2472883e6ccdc258339292 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Sun, 12 Jun 2022 10:57:28 -0700 Subject: [PATCH] Fixed explicit non-volatile register preservation --- IDEHelper/Backend/BeMCContext.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Backend/BeMCContext.cpp b/IDEHelper/Backend/BeMCContext.cpp index af011570..cde736bd 100644 --- a/IDEHelper/Backend/BeMCContext.cpp +++ b/IDEHelper/Backend/BeMCContext.cpp @@ -9035,8 +9035,12 @@ bool BeMCContext::DoLegalization() auto scratchVRegInfo = mVRegInfo[scratchReg.mVRegIdx]; // If a scratch vreg needs to preserve a register like the remapped vreg + scratchVRegInfo->mDisableR11 |= remappedVRegInfo->mDisableR11; + scratchVRegInfo->mDisableR12 |= remappedVRegInfo->mDisableR12; + scratchVRegInfo->mDisableR13 |= remappedVRegInfo->mDisableR13; scratchVRegInfo->mDisableRAX |= remappedVRegInfo->mDisableRAX; scratchVRegInfo->mDisableRDX |= remappedVRegInfo->mDisableRDX; + scratchVRegInfo->mDisableEx |= remappedVRegInfo->mDisableEx; if ((insertPos == instIdx) || (!scratchForceReg)) { @@ -11556,7 +11560,7 @@ void BeMCContext::DoRegFinalization() continue; } - if (IsVolatileReg(vregInfo->mReg)) + if ((inst->mArg0) || (IsVolatileReg(vregInfo->mReg))) { if (vregInfo->mVolatileVRegSave == -1) { @@ -16139,7 +16143,7 @@ void BeMCContext::Generate(BeFunction* function) mDbgPreferredRegs[32] = X64Reg_R8;*/ //mDbgPreferredRegs[8] = X64Reg_RAX; - //mDebugging = (function->mName == "?Main@TestProgram@BeefTest@bf@@CAXXZ"); + //mDebugging = (function->mName == "?CreateEntity@ModelLoader@Content@GlitchyEngine@bf@@CA?AU?$__TUPLE_Entity_Transform@VEcsEntity@World@GlitchyEngine@bf@@PEA?AUTransformComponent@123@@4@PEAVEcsWorld@World@34@U?$Nullable@UStringView@System@bf@@@System@4@VEcsEntity@734@@Z"); // || (function->mName == "?MethodA@TestProgram@BeefTest@bf@@CAXXZ"); // || (function->mName == "?Hey@Blurg@bf@@SAXXZ") // ;