diff --git a/IDEHelper/Backend/BeMCContext.cpp b/IDEHelper/Backend/BeMCContext.cpp index b1fc9b57..4e1c6718 100644 --- a/IDEHelper/Backend/BeMCContext.cpp +++ b/IDEHelper/Backend/BeMCContext.cpp @@ -3622,7 +3622,7 @@ BeMCOperand BeMCContext::AllocVirtualReg(BeType* type, int refCount, bool mustBe if (mDebugging) { - if (mcOperand.mVRegIdx == 15) + if (mcOperand.mVRegIdx == 4) { NOP; } @@ -3840,6 +3840,16 @@ bool BeMCContext::HasSymbolAddr(const BeMCOperand& operand) BeMCOperand BeMCContext::ReplaceWithNewVReg(BeMCOperand& operand, int& instIdx, bool isInput, bool mustBeReg) { + if ((isInput) && (operand.mKind == BeMCOperandKind_VRegLoad)) + { + BeMCOperand addrOperand = BeMCOperand::ToAddr(operand); + BeMCOperand scratchReg = AllocVirtualReg(GetType(addrOperand), 2, mustBeReg); + CreateDefineVReg(scratchReg, instIdx++); + AllocInst(BeMCInstKind_Mov, scratchReg, addrOperand, instIdx++); + operand = BeMCOperand::ToLoad(scratchReg); + return scratchReg; + } + BeMCOperand scratchReg = AllocVirtualReg(GetType(operand), 2, mustBeReg); CreateDefineVReg(scratchReg, instIdx++); if (isInput) diff --git a/IDEHelper/Tests/BeefSpace.toml b/IDEHelper/Tests/BeefSpace.toml index c443adf2..394fb56b 100644 --- a/IDEHelper/Tests/BeefSpace.toml +++ b/IDEHelper/Tests/BeefSpace.toml @@ -9,10 +9,6 @@ StartupProject = "Tests" BfOptimizationLevel = "O0" IntermediateType = "ObjectAndIRCode" -[Configs.Debug.Linux64] -Toolset = "GNU" -EnableRealtimeLeakCheck = false - [Configs.Test.Win64] IntermediateType = "ObjectAndIRCode" COptimizationLevel = "O2" diff --git a/IDEHelper/Tests/src/SizedArrays.bf b/IDEHelper/Tests/src/SizedArrays.bf index 9f58a344..f03915ad 100644 --- a/IDEHelper/Tests/src/SizedArrays.bf +++ b/IDEHelper/Tests/src/SizedArrays.bf @@ -4,6 +4,8 @@ namespace Tests { class SizedArrays { + public static int[8] iArr = .(123, 234, 345, ); + [Test] static void TestBasics() { @@ -23,5 +25,24 @@ namespace Tests Test.Assert(val0 != val2); Test.Assert(val2[1] == val1); } + + [Test] + static void TestStatic() + { + Test.Assert(iArr[0] == 123); + Test.Assert(iArr[1] == 234); + Test.Assert(iArr[2] == 345); + Test.Assert(iArr[3] == 0); + + iArr[0] += 1000; + iArr[2] += 2000; + iArr[3] += 3000; + iArr[3] += 4000; + + Test.Assert(iArr[0] == 1123); + Test.Assert(iArr[1] == 2234); + Test.Assert(iArr[2] == 3345); + Test.Assert(iArr[3] == 4000); + } } }