From 1be469aa9b63243c6ae6a7b3337f811bfdd4410e Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 10 Jan 2022 14:06:21 +0100 Subject: [PATCH] Optimize placement of basic blocks --- oscar64/ByteCodeGenerator.cpp | 7 ++++++- oscar64/InterCode.cpp | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/oscar64/ByteCodeGenerator.cpp b/oscar64/ByteCodeGenerator.cpp index c277c68..2c6992a 100644 --- a/oscar64/ByteCodeGenerator.cpp +++ b/oscar64/ByteCodeGenerator.cpp @@ -5806,11 +5806,16 @@ void ByteCodeBasicBlock::BuildPlacement(GrowingArray& place mTrueJump->BuildPlacement(placement); mFalseJump->BuildPlacement(placement); } - else + else if (mFalseJump->mCode.Size() < mTrueJump->mCode.Size()) { mFalseJump->BuildPlacement(placement); mTrueJump->BuildPlacement(placement); } + else + { + mTrueJump->BuildPlacement(placement); + mFalseJump->BuildPlacement(placement); + } } else if (mTrueJump) { diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index 057092f..0058a72 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -5733,6 +5733,13 @@ static bool CanBypassStore(const InterInstruction * sins, const InterInstruction else return false; } + else if (sm == IM_FRAME) + ; + else if (sm == IM_FPARAM) + { + if (bi == si) + return false; + } else if (sm == IM_INDIRECT && bm == IM_INDIRECT && st == bt) { return so + sz <= bz || bo + bz <= so;