diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index adb477a..9f7663c 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -8096,6 +8096,35 @@ void InterCodeBasicBlock::PeepholeOptimization(void) mInstructions[i + 1]->mSrc[0] = io; changed = true; } + else if ( + mInstructions[i + 0]->mCode == IC_BINARY_OPERATOR && mInstructions[i + 0]->mOperator == IA_ADD && + mInstructions[i + 1]->mCode == IC_LEA && mInstructions[i + 1]->mSrc[0].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[0].mFinal && + mInstructions[i + 0]->mSrc[1].IsUByte() && !mInstructions[i + 0]->mSrc[0].IsUByte()) + { + mInstructions[i + 1]->mSrc[0] = mInstructions[i + 0]->mSrc[1]; + + mInstructions[i + 0]->mCode = IC_LEA; + mInstructions[i + 0]->mSrc[1] = mInstructions[i + 1]->mSrc[1]; + mInstructions[i + 0]->mDst.mType = IT_POINTER; + + mInstructions[i + 1]->mSrc[1] = mInstructions[i + 0]->mDst; + changed = true; + } + else if ( + mInstructions[i + 0]->mCode == IC_BINARY_OPERATOR && mInstructions[i + 0]->mOperator == IA_ADD && + mInstructions[i + 1]->mCode == IC_LEA && mInstructions[i + 1]->mSrc[0].mTemp == mInstructions[i + 0]->mDst.mTemp && mInstructions[i + 1]->mSrc[0].mFinal && + mInstructions[i + 0]->mSrc[0].IsUByte() && !mInstructions[i + 0]->mSrc[1].IsUByte()) + { + mInstructions[i + 1]->mSrc[0] = mInstructions[i + 0]->mSrc[0]; + + mInstructions[i + 0]->mCode = IC_LEA; + mInstructions[i + 0]->mSrc[0] = mInstructions[i + 0]->mSrc[1]; + mInstructions[i + 0]->mSrc[1] = mInstructions[i + 1]->mSrc[1]; + mInstructions[i + 0]->mDst.mType = IT_POINTER; + + mInstructions[i + 1]->mSrc[1] = mInstructions[i + 0]->mDst; + changed = true; + } #if 1 // Postincrement artifact @@ -9038,6 +9067,17 @@ void InterCodeProcedure::Close(void) #endif +#if 1 + ResetVisited(); + mEntryBlock->PeepholeOptimization(); + + TempForwarding(); + RemoveUnusedInstructions(); + + DisassembleDebug("Peephole optimized"); + +#endif + #if 1 BuildLoopPrefix(); DisassembleDebug("added dominators"); diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index edc886a..50550b7 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -11336,6 +11336,16 @@ bool NativeCodeBasicBlock::OptimizeSimpleLoopInvariant(NativeCodeProcedure* proc return true; } + if (sz >= 3 && mIns[0].mType == ASMIT_LDA && mIns[sz - 2].mType == ASMIT_LDA && mIns[0].SameEffectiveAddress(mIns[sz - 2]) && mIns[sz - 1].mType == ASMIT_CMP) + { + if (!prevBlock) + return OptimizeSimpleLoopInvariant(proc); + + prevBlock->mIns.Push(mIns[0]); + mIns.Remove(0); + return true; + } + if (sz >= 3 && mIns[0].mType == ASMIT_LDY && mIns[sz - 2].mType == ASMIT_LDA && mIns[0].SameEffectiveAddress(mIns[sz - 2]) && mIns[sz - 1].mType == ASMIT_CMP && HasAsmInstructionMode(ASMIT_CPY, mIns[sz - 1].mMode) && !(mIns[sz - 1].mLive & LIVE_CPU_REG_A)) { diff --git a/oscar64/oscar64.cpp b/oscar64/oscar64.cpp index 7a21605..45f130d 100644 --- a/oscar64/oscar64.cpp +++ b/oscar64/oscar64.cpp @@ -73,7 +73,7 @@ int main2(int argc, const char** argv) #else strcpy(strProductName, "oscar64"); - strcpy(strProductVersion, "1.4.92"); + strcpy(strProductVersion, "1.4.93"); #ifdef __APPLE__ uint32_t length = sizeof(basePath); diff --git a/oscar64/oscar64.rc b/oscar64/oscar64.rc index 6bf2eba..e4aa361 100644 --- a/oscar64/oscar64.rc +++ b/oscar64/oscar64.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,4,92,0 - PRODUCTVERSION 1,4,92,0 + FILEVERSION 1,4,93,0 + PRODUCTVERSION 1,4,93,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,12 +43,12 @@ BEGIN BEGIN VALUE "CompanyName", "oscar64" VALUE "FileDescription", "oscar64 compiler" - VALUE "FileVersion", "1.4.92.0" + VALUE "FileVersion", "1.4.93.0" VALUE "InternalName", "oscar64.exe" VALUE "LegalCopyright", "Copyright (C) 2021" VALUE "OriginalFilename", "oscar64.exe" VALUE "ProductName", "oscar64" - VALUE "ProductVersion", "1.4.92.0" + VALUE "ProductVersion", "1.4.93.0" END END BLOCK "VarFileInfo" diff --git a/oscar64setup/oscar64setup.vdproj b/oscar64setup/oscar64setup.vdproj index b94e9ef..0c455d5 100644 --- a/oscar64setup/oscar64setup.vdproj +++ b/oscar64setup/oscar64setup.vdproj @@ -34,6 +34,12 @@ } "Entry" { + "MsmKey" = "8:_03D7013B0D39A89CEA9D267005ADCE39" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_04ABABC55200450383686DD782DD1548" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -136,6 +142,12 @@ } "Entry" { + "MsmKey" = "8:_2CA3A525072974368303677563606FFE" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_2D828D0247F144CDB0112B2AD4004C2C" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -196,6 +208,12 @@ } "Entry" { + "MsmKey" = "8:_3FA71395262A4AB4A1C2839FD6B91190" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_3FFD08277B804985BDF072C0C1877287" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -340,12 +358,24 @@ } "Entry" { + "MsmKey" = "8:_777CE896BB0B3C09C1B5FB6CB3BFE84F" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_79985361F09A43299E258E1A8E5ED934" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" } "Entry" { + "MsmKey" = "8:_7A40466D5E5D2D3FD71213A0C0AA5075" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_7A9E700FC438425580655F7C1BC07FD3" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -544,6 +574,12 @@ } "Entry" { + "MsmKey" = "8:_B2B920A649CF4027457BBAB004078A03" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_B4265CBF352343D2867DBCCE67D9F493" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -682,6 +718,18 @@ } "Entry" { + "MsmKey" = "8:_DC9FDF52011EB7C47318682BA0B3F26F" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { + "MsmKey" = "8:_DE2BF7C92569053E7C3DCE88AB7E2566" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_DEADBEA270134B77800770802B21859C" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -742,6 +790,12 @@ } "Entry" { + "MsmKey" = "8:_EA3C0BCB01F2639DFA2E37EC8436E5F6" + "OwnerKey" = "8:_FB2E467BC172457785F4279BB0BFE8B6" + "MsmSig" = "8:_UNDEFINED" + } + "Entry" + { "MsmKey" = "8:_ED872D39D58443D590B7C80604BC0FF4" "OwnerKey" = "8:_UNDEFINED" "MsmSig" = "8:_UNDEFINED" @@ -947,6 +1001,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_03D7013B0D39A89CEA9D267005ADCE39" + { + "SourcePath" = "8:VCRUNTIME140.dll" + "TargetName" = "8:VCRUNTIME140.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_04ABABC55200450383686DD782DD1548" { "SourcePath" = "8:..\\samples\\games\\lander.c" @@ -1287,6 +1361,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2CA3A525072974368303677563606FFE" + { + "SourcePath" = "8:api-ms-win-crt-heap-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-heap-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2D828D0247F144CDB0112B2AD4004C2C" { "SourcePath" = "8:..\\samples\\scrolling\\tunnel.c" @@ -1487,6 +1581,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3FA71395262A4AB4A1C2839FD6B91190" + { + "SourcePath" = "8:api-ms-win-crt-stdio-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-stdio-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_3FFD08277B804985BDF072C0C1877287" { "SourcePath" = "8:..\\include\\assert.c" @@ -1967,6 +2081,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_777CE896BB0B3C09C1B5FB6CB3BFE84F" + { + "SourcePath" = "8:api-ms-win-crt-filesystem-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-filesystem-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_79985361F09A43299E258E1A8E5ED934" { "SourcePath" = "8:..\\include\\gfx\\mcbitmap.c" @@ -1987,6 +2121,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7A40466D5E5D2D3FD71213A0C0AA5075" + { + "SourcePath" = "8:api-ms-win-crt-locale-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-locale-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7A9E700FC438425580655F7C1BC07FD3" { "SourcePath" = "8:..\\samples\\rasterirq\\textcrawler.c" @@ -2647,6 +2801,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B2B920A649CF4027457BBAB004078A03" + { + "SourcePath" = "8:api-ms-win-crt-math-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-math-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B4265CBF352343D2867DBCCE67D9F493" { "SourcePath" = "8:..\\include\\c64\\joystick.c" @@ -3107,6 +3281,46 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_DC9FDF52011EB7C47318682BA0B3F26F" + { + "SourcePath" = "8:api-ms-win-crt-string-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-string-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_DE2BF7C92569053E7C3DCE88AB7E2566" + { + "SourcePath" = "8:api-ms-win-crt-runtime-l1-1-0.dll" + "TargetName" = "8:api-ms-win-crt-runtime-l1-1-0.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_DEADBEA270134B77800770802B21859C" { "SourcePath" = "8:..\\samples\\games\\connectfour.c" @@ -3307,6 +3521,26 @@ "IsDependency" = "11:FALSE" "IsolateTo" = "8:" } + "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_EA3C0BCB01F2639DFA2E37EC8436E5F6" + { + "SourcePath" = "8:VERSION.dll" + "TargetName" = "8:VERSION.dll" + "Tag" = "8:" + "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" + "Condition" = "8:" + "Transitive" = "11:FALSE" + "Vital" = "11:TRUE" + "ReadOnly" = "11:FALSE" + "Hidden" = "11:FALSE" + "System" = "11:FALSE" + "Permanent" = "11:FALSE" + "SharedLegacy" = "11:FALSE" + "PackageAs" = "3:1" + "Register" = "3:1" + "Exclude" = "11:FALSE" + "IsDependency" = "11:TRUE" + "IsolateTo" = "8:" + } "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_ED872D39D58443D590B7C80604BC0FF4" { "SourcePath" = "8:..\\samples\\kernalio\\fileread.c" @@ -3752,15 +3986,15 @@ { "Name" = "8:Microsoft Visual Studio" "ProductName" = "8:oscar64" - "ProductCode" = "8:{D70ACED5-5DDD-460B-B934-8B2F6C3F112B}" - "PackageCode" = "8:{E84DF4CA-580F-413D-A830-4499B996E9EC}" + "ProductCode" = "8:{26B39D61-B1F2-45E1-97B8-D5A701CAB3F1}" + "PackageCode" = "8:{4BB78C44-2723-438F-AD66-F6307E1A92A1}" "UpgradeCode" = "8:{9AB61EFF-ACAC-4079-9950-8D96615CD4EF}" "AspNetVersion" = "8:2.0.50727.0" "RestartWWWService" = "11:FALSE" "RemovePreviousVersions" = "11:TRUE" "DetectNewerInstalledVersion" = "11:TRUE" "InstallAllUsers" = "11:FALSE" - "ProductVersion" = "8:1.4.92" + "ProductVersion" = "8:1.4.93" "Manufacturer" = "8:oscar64" "ARPHELPTELEPHONE" = "8:" "ARPHELPLINK" = "8:" @@ -4274,7 +4508,7 @@ { "{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_FB2E467BC172457785F4279BB0BFE8B6" { - "SourcePath" = "8:..\\Debug\\oscar64.exe" + "SourcePath" = "8:..\\Release\\oscar64.exe" "TargetName" = "8:" "Tag" = "8:" "Folder" = "8:_607E75AF0E2A4CB9908C4C39DF8FE6E4" diff --git a/samples/memmap/easyflash.crt b/samples/memmap/easyflash.crt index 438950c..6c20dfb 100644 Binary files a/samples/memmap/easyflash.crt and b/samples/memmap/easyflash.crt differ