From 3f9d04286388a5287284d56f171d02bb017fbc97 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:08:53 +0200 Subject: [PATCH] Optimize xy before loop index register assignment --- include/audio/sidfx.c | 5 +++++ include/audio/sidfx.h | 2 ++ oscar64/NativeCodeGenerator.cpp | 9 ++++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/audio/sidfx.c b/include/audio/sidfx.c index e2e5a5e..a1be2c8 100644 --- a/include/audio/sidfx.c +++ b/include/audio/sidfx.c @@ -29,6 +29,11 @@ void sidfx_init(void) } } +bool sidfx_idle(byte chn) +{ + return channels[chn].state == SIDFX_IDLE; +} + void sidfx_play(byte chn, const SIDFX * fx, byte cnt) { SIDFXState ns = channels[chn].state; diff --git a/include/audio/sidfx.h b/include/audio/sidfx.h index 729afe6..97dbcb9 100644 --- a/include/audio/sidfx.h +++ b/include/audio/sidfx.h @@ -14,6 +14,8 @@ struct SIDFX void sidfx_init(void); +inline bool sidfx_idle(byte chn); + inline void sidfx_play(byte chn, const SIDFX * fx, byte cnt); void sidfx_stop(byte chn); diff --git a/oscar64/NativeCodeGenerator.cpp b/oscar64/NativeCodeGenerator.cpp index 524e9ce..1b821e6 100644 --- a/oscar64/NativeCodeGenerator.cpp +++ b/oscar64/NativeCodeGenerator.cpp @@ -48519,7 +48519,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc) mInterProc = proc; mInterProc->mLinkerObject->mNativeProc = this; - CheckFunc = !strcmp(mInterProc->mIdent->mString, "flossiec_read_lzo"); + CheckFunc = !strcmp(mInterProc->mIdent->mString, "main"); int nblocks = proc->mBlocks.Size(); tblocks = new NativeCodeBasicBlock * [nblocks]; @@ -49773,6 +49773,13 @@ void NativeCodeProcedure::Optimize(void) changed = true; #endif + if (step == 2 && !changed) + { + ResetVisited(); + if (mEntryBlock->CombineSameXY()) + changed = true; + } + #if 1 if (step >= 5) {