From 1fdca1d160257fc15f1a98400dce23193a74a229 Mon Sep 17 00:00:00 2001 From: Phil Date: Thu, 9 Nov 2023 20:18:28 -0800 Subject: [PATCH] - Refactor + Fixes --- Source/Mosa.BareMetal.TestWorld.x64/Boot.cs | 142 +++++++++ .../Mosa.BareMetal.TestWorld.x64.csproj | 15 + Source/Mosa.BareMetal.TestWorld.x86/Boot.cs | 2 +- .../Mosa.Compiler.Framework/BaseTransform.cs | 5 +- Source/Mosa.Compiler.Framework/BitValue.cs | 11 +- Source/Mosa.Compiler.Framework/Compiler.cs | 2 +- .../Managers/CodeMotionManager.cs | 4 +- .../Stages/BaseTransformStage.cs | 53 +++- .../Stages/BitTrackerStage.cs | 284 +----------------- .../Stages/ExceptionStage.cs | 6 +- .../Stages/OptimizationStage.cs | 20 +- Source/Mosa.Compiler.Framework/Transform.cs | 15 +- .../TransformStageOption.cs | 10 + .../Transforms/LowerTo32/Add64.cs | 2 +- .../Transforms/LowerTo32/And64.cs | 2 +- .../LowerTo32/ArithShiftRight64By32.cs | 7 +- .../LowerTo32/ArithShiftRight64By63.cs | 7 +- ...Transform.cs => BaseLowerTo32Transform.cs} | 6 +- .../Transforms/LowerTo32/Branch64.cs | 4 +- .../Transforms/LowerTo32/Branch64Extends.cs | 4 +- .../Transforms/LowerTo32/Compare32x64.cs | 2 +- .../LowerTo32/Compare64x32EqualOrNotEqual.cs | 7 +- .../Transforms/LowerTo32/Compare64x32Rest.cs | 7 +- .../LowerTo32/Compare64x32RestInSSA.cs | 7 +- .../LowerTo32/Compare64x32UnsignedGreater.cs | 7 +- .../LowerTo32/Compare64x64EqualOrNotEqual.cs | 7 +- .../Transforms/LowerTo32/Compare64x64Rest.cs | 7 +- .../LowerTo32/Compare64x64RestInSSA.cs | 7 +- .../Transforms/LowerTo32/Load64.cs | 2 +- .../Transforms/LowerTo32/LoadParam64.cs | 2 +- .../LowerTo32/LoadParamSignExtend16x64.cs | 2 +- .../LowerTo32/LoadParamSignExtend32x64.cs | 2 +- .../LowerTo32/LoadParamSignExtend8x64.cs | 2 +- .../LowerTo32/LoadParamZeroExtend16x64.cs | 2 +- .../LowerTo32/LoadParamZeroExtend32x64.cs | 2 +- .../LowerTo32/LoadParamZeroExtend8x64.cs | 2 +- .../LowerTo32/LoadSignExtend16x64.cs | 2 +- .../LowerTo32/LoadSignExtend32x64.cs | 2 +- .../LowerTo32/LoadSignExtend8x64.cs | 2 +- .../LowerTo32/LoadZeroExtend16x64.cs | 2 +- .../LowerTo32/LoadZeroExtend32x64.cs | 2 +- .../LowerTo32/LoadZeroExtend8x64.cs | 2 +- .../Transforms/LowerTo32/Move64.cs | 2 +- .../Transforms/LowerTo32/MulSigned64.cs | 2 +- .../Transforms/LowerTo32/MulUnsigned64.cs | 2 +- .../Transforms/LowerTo32/Not64.cs | 2 +- .../Transforms/LowerTo32/Or64.cs | 2 +- .../Transforms/LowerTo32/Phi64.cs | 4 +- .../LowerTo32/ShiftLeft64ByConstant32.cs | 7 +- .../LowerTo32/ShiftLeft64ByConstant32Plus.cs | 7 +- .../LowerTo32/ShiftRight64ByConstant32.cs | 7 +- .../LowerTo32/ShiftRight64ByConstant32Plus.cs | 7 +- .../Transforms/LowerTo32/SignExtend16x64.cs | 7 +- .../Transforms/LowerTo32/SignExtend32x64.cs | 2 +- .../Transforms/LowerTo32/SignExtend8x64.cs | 2 +- .../Transforms/LowerTo32/Store64.cs | 2 +- .../Transforms/LowerTo32/StoreParam64.cs | 2 +- .../Transforms/LowerTo32/Sub64.cs | 2 +- .../Transforms/LowerTo32/Truncate64x32.cs | 2 +- .../Transforms/LowerTo32/Xor64.cs | 2 +- .../Transforms/LowerTo32/ZeroExtend16x64.cs | 2 +- .../Transforms/LowerTo32/ZeroExtend32x64.cs | 2 +- .../Transforms/LowerTo32/ZeroExtend8x64.cs | 2 +- .../Optimizations/Manual/ManualTransforms.cs | 3 +- .../{Standard => Rewrite}/Add32ToInc32.cs | 2 +- .../{Standard => Rewrite}/Add32ToLea32.cs | 0 .../{Standard => Rewrite}/Add64ToLea64.cs | 0 .../{Standard => Rewrite}/Cmp32ToTest32.cs | 0 .../{Standard => Rewrite}/Cmp32ToZero.cs | 2 +- .../{Standard => Rewrite}/Lea32ToDec32.cs | 2 +- .../{Standard => Rewrite}/Lea32ToInc32.cs | 2 +- .../{Standard => Rewrite}/Mov32ToXor32.cs | 2 +- .../{Standard => Rewrite}/Mov64ToXor64.cs | 0 .../{Standard => Rewrite}/Sub32ToDec32.cs | 2 +- .../{Standard => Rewrite}/Sub32ToLea32.cs | 3 + .../{Standard => Rewrite}/Sub64ToLea64.cs | 3 + .../{Standard => Rewrite}/Test32ToZero.cs | 2 +- .../Optimizations/Manual/Special/Deadcode.cs | 5 - .../Manual/Special/Mov32Unless.cs | 2 +- .../Manual/Special/Mov64Unless.cs | 8 +- .../Manual/Special/Mul32Ditto.cs | 48 +++ .../Manual/Special/Mul64Ditto.cs | 48 +++ .../Optimizations/Manual/ManualTransforms.cs | 25 +- .../{Standard => Rewrite}/Add32ToInc32.cs | 2 +- .../{Standard => Rewrite}/Add32ToLea32.cs | 0 .../{Standard => Rewrite}/Cmp32ToTest32.cs | 0 .../{Standard => Rewrite}/Cmp32ToZero.cs | 2 +- .../{Standard => Rewrite}/Lea32ToDec32.cs | 0 .../{Standard => Rewrite}/Lea32ToInc32.cs | 2 +- .../{Standard => Rewrite}/Mov32ToXor32.cs | 0 .../{Standard => Rewrite}/Sub32ToDec32.cs | 2 +- .../{Standard => Rewrite}/Sub32ToLea32.cs | 0 .../{Standard => Rewrite}/Test32ToZero.cs | 2 +- .../Optimizations/Manual/Special/Deadcode.cs | 5 - .../Manual/Special/Mov32Unless.cs | 6 - .../Manual/Special/Mul32Ditto.cs | 4 +- .../Mosa.Kernel.BareMetal.x64/PlatformPlug.cs | 3 + Source/Mosa.sln | 21 ++ 98 files changed, 516 insertions(+), 441 deletions(-) create mode 100644 Source/Mosa.BareMetal.TestWorld.x64/Boot.cs create mode 100644 Source/Mosa.BareMetal.TestWorld.x64/Mosa.BareMetal.TestWorld.x64.csproj create mode 100644 Source/Mosa.Compiler.Framework/TransformStageOption.cs rename Source/Mosa.Compiler.Framework/Transforms/LowerTo32/{BaseLower32Transform.cs => BaseLowerTo32Transform.cs} (56%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Add32ToInc32.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Add32ToLea32.cs (100%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Add64ToLea64.cs (100%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Cmp32ToTest32.cs (100%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Cmp32ToZero.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Lea32ToDec32.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Lea32ToInc32.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Mov32ToXor32.cs (90%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Mov64ToXor64.cs (100%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Sub32ToDec32.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Sub32ToLea32.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Sub64ToLea64.cs (95%) rename Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/{Standard => Rewrite}/Test32ToZero.cs (95%) create mode 100644 Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs create mode 100644 Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul64Ditto.cs rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Add32ToInc32.cs (95%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Add32ToLea32.cs (100%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Cmp32ToTest32.cs (100%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Cmp32ToZero.cs (95%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Lea32ToDec32.cs (100%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Lea32ToInc32.cs (95%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Mov32ToXor32.cs (100%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Sub32ToDec32.cs (95%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Sub32ToLea32.cs (100%) rename Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/{Standard => Rewrite}/Test32ToZero.cs (95%) diff --git a/Source/Mosa.BareMetal.TestWorld.x64/Boot.cs b/Source/Mosa.BareMetal.TestWorld.x64/Boot.cs new file mode 100644 index 0000000000..9934b21158 --- /dev/null +++ b/Source/Mosa.BareMetal.TestWorld.x64/Boot.cs @@ -0,0 +1,142 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using System; +using System.Runtime.CompilerServices; +using System.Threading; +using Mosa.Kernel.BareMetal; +using Mosa.UnitTests.Optimization; + +namespace Mosa.BareMetal.TestWorld.x64; + +public static class Boot +{ + public static void Main() + { + Debug.WriteLine("Boot::Main()"); + + Console.BackgroundColor = ConsoleColor.Blue; + Console.ForegroundColor = ConsoleColor.White; + Console.Clear(); + Console.WriteLine("Mosa.BareMetal.TextWorld.x64"); + Console.WriteLine(); + + Division.DivisionBy7(254u); + + //InterruptManager.SetHandler(ProcessInterrupt); + + //StartThreading(); + + // Will never get here! + //Debug.WriteLine("ERROR: Thread Start Failure"); + + Debug.WriteLine("ERROR: Done!"); + Debug.Fatal(); + } + + private static int counter = 0; + + public static void ProcessInterrupt(uint interrupt, uint errorCode) + { + Interlocked.Increment(ref counter); + + lock (spinlock) + { + Console.SetCursorPosition(0, 23); + Console.Write("Counter: " + counter + " IRQ: " + interrupt + " Code: " + errorCode); + } + } + + private static void StartThreading() + { + Debug.WriteLine("Boot::StartThreadTest()"); + + Scheduler.CreateThread(Program.EntryPoint); + + Scheduler.CreateThread(Thread1); + Scheduler.CreateThread(Thread2); + Scheduler.CreateThread(Thread3); + Scheduler.CreateThread(Thread4); + Scheduler.CreateThread(Thread5); + + Scheduler.Start(); + + Debug.WriteLine("Boot::StartThreadTest() [Exit]"); + } + + private static readonly object spinlock = new(); + private static int totalticks = 0; + + private static void UpdateThreadTicks(int thread, uint ticks) + { + Interlocked.Increment(ref totalticks); + + if (totalticks % 10000 == 0) + { + lock (spinlock) + { + Console.SetCursorPosition(0, 1 + thread); + Console.Write("Thread #" + thread + ": " + ticks); + } + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Thread1() + { + var ticks = 0u; + + while (true) + { + UpdateThreadTicks(1, ++ticks); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Thread2() + { + var ticks = 0u; + + while (true) + { + UpdateThreadTicks(2, ++ticks); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Thread3() + { + var ticks = 0u; + + while (true) + { + UpdateThreadTicks(3, ++ticks); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Thread4() + { + var ticks = 0u; + + while (true) + { + UpdateThreadTicks(4, ++ticks); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + public static void Thread5() + { + var ticks = 0u; + + while (true) + { + UpdateThreadTicks(5, ++ticks); + } + } + + public static void ForceInclude() + { + Mosa.Kernel.BareMetal.x64.PlatformPlug.ForceInclude(); + } +} diff --git a/Source/Mosa.BareMetal.TestWorld.x64/Mosa.BareMetal.TestWorld.x64.csproj b/Source/Mosa.BareMetal.TestWorld.x64/Mosa.BareMetal.TestWorld.x64.csproj new file mode 100644 index 0000000000..7086c998b6 --- /dev/null +++ b/Source/Mosa.BareMetal.TestWorld.x64/Mosa.BareMetal.TestWorld.x64.csproj @@ -0,0 +1,15 @@ + + + + Exe + + + + + + + + + + + diff --git a/Source/Mosa.BareMetal.TestWorld.x86/Boot.cs b/Source/Mosa.BareMetal.TestWorld.x86/Boot.cs index 5dbc5aa32e..ad1e3906ba 100644 --- a/Source/Mosa.BareMetal.TestWorld.x86/Boot.cs +++ b/Source/Mosa.BareMetal.TestWorld.x86/Boot.cs @@ -17,7 +17,7 @@ public static void Main() Console.BackgroundColor = ConsoleColor.Blue; Console.ForegroundColor = ConsoleColor.White; Console.Clear(); - Console.WriteLine("Mosa.BareMetal.TextWold.x86"); + Console.WriteLine("Mosa.BareMetal.TextWorld.x86"); Console.WriteLine(); Division.DivisionBy7(254u); diff --git a/Source/Mosa.Compiler.Framework/BaseTransform.cs b/Source/Mosa.Compiler.Framework/BaseTransform.cs index 681e495d58..ade666f5ae 100644 --- a/Source/Mosa.Compiler.Framework/BaseTransform.cs +++ b/Source/Mosa.Compiler.Framework/BaseTransform.cs @@ -76,10 +76,7 @@ protected static bool AreSame(Operand operand1, Operand operand2) if (operand1 == operand2) return true; - if (operand1.IsVirtualRegister && operand1.IsVirtualRegister && operand1 == operand2) - return true; - - if (operand1.IsPhysicalRegister && operand1.IsPhysicalRegister && operand1 == operand2) + if (operand1.IsPhysicalRegister && operand2.IsPhysicalRegister && operand1.Register == operand2.Register) return true; if (operand1.IsResolvedConstant && operand2.IsResolvedConstant) diff --git a/Source/Mosa.Compiler.Framework/BitValue.cs b/Source/Mosa.Compiler.Framework/BitValue.cs index 435d6bff7b..20bdab95f8 100644 --- a/Source/Mosa.Compiler.Framework/BitValue.cs +++ b/Source/Mosa.Compiler.Framework/BitValue.cs @@ -316,12 +316,11 @@ public override string ToString() { var sb = new StringBuilder(); - sb.Append($" MaxValue: {MaxValue}"); - sb.Append($" MinValue: {MinValue}"); - - sb.Append($" BitsSet: {Convert.ToString((long)BitsSet, 2).PadLeft(64, '0')}"); - sb.Append($" BitsClear: {Convert.ToString((long)BitsClear, 2).PadLeft(64, '0')}"); - sb.Append($" BitsKnown: {Convert.ToString((long)BitsKnown, 2).PadLeft(64, '0')}"); + sb.Append($"MaxValue: {MaxValue}"); + sb.Append($"MinValue: {MinValue}"); + sb.Append($"BitsSet: {Convert.ToString((long)BitsSet, 2).PadLeft(64, '0')}"); + sb.Append($"BitsClear: {Convert.ToString((long)BitsClear, 2).PadLeft(64, '0')}"); + sb.Append($"BitsKnown: {Convert.ToString((long)BitsKnown, 2).PadLeft(64, '0')}"); return sb.ToString(); } diff --git a/Source/Mosa.Compiler.Framework/Compiler.cs b/Source/Mosa.Compiler.Framework/Compiler.cs index b7fc93f6bd..531132fe0e 100644 --- a/Source/Mosa.Compiler.Framework/Compiler.cs +++ b/Source/Mosa.Compiler.Framework/Compiler.cs @@ -154,12 +154,12 @@ public sealed class Compiler mosaSettings.SSA ? new EdgeSplitStage() : null, mosaSettings.SSA ? new EnterSSAStage() : null, mosaSettings.BasicOptimizations && mosaSettings.SSA ? new OptimizationStage(false) : null, + mosaSettings.ValueNumbering && mosaSettings.SSA ? new ValueNumberingStage() : null, mosaSettings.LoopInvariantCodeMotion && mosaSettings.SSA ? new LoopInvariantCodeMotionStage() : null, mosaSettings.SparseConditionalConstantPropagation && mosaSettings.SSA ? new SparseConditionalConstantPropagationStage() : null, mosaSettings.BasicOptimizations && mosaSettings.SSA && (mosaSettings.ValueNumbering || mosaSettings.LoopInvariantCodeMotion || mosaSettings.SparseConditionalConstantPropagation) ? new OptimizationStage(false) : null, mosaSettings.BitTracker ? new BitTrackerStage() : null, - mosaSettings.BasicOptimizations && mosaSettings.BitTracker ? new OptimizationStage(false) : null, mosaSettings.BasicOptimizations && mosaSettings.LongExpansion ? new OptimizationStage(mosaSettings.LongExpansion) : null, mosaSettings.TwoPassOptimization && mosaSettings.ValueNumbering && mosaSettings.SSA ? new ValueNumberingStage() : null, diff --git a/Source/Mosa.Compiler.Framework/Managers/CodeMotionManager.cs b/Source/Mosa.Compiler.Framework/Managers/CodeMotionManager.cs index 2e8adee276..bec9120d01 100644 --- a/Source/Mosa.Compiler.Framework/Managers/CodeMotionManager.cs +++ b/Source/Mosa.Compiler.Framework/Managers/CodeMotionManager.cs @@ -1,12 +1,10 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. -using System.Collections.Generic; - namespace Mosa.Compiler.Framework.Managers; public class CodeMotionManager : BaseTransformManager { - private readonly HashSet Motion = new HashSet(); + private readonly HashSet Motion = new(); public void MarkMotion(Node node) { diff --git a/Source/Mosa.Compiler.Framework/Stages/BaseTransformStage.cs b/Source/Mosa.Compiler.Framework/Stages/BaseTransformStage.cs index 384faa2069..97076e83bd 100644 --- a/Source/Mosa.Compiler.Framework/Stages/BaseTransformStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/BaseTransformStage.cs @@ -16,9 +16,9 @@ public abstract class BaseTransformStage : BaseMethodCompilerStage private readonly List[] transforms = new List[MaximumInstructionID]; private readonly List blockTransforms = new(); - protected TraceLog trace; + protected TraceLog Trace; - protected TraceLog specialTrace; + protected TraceLog SpecialTrace; protected bool EnableTransformOptimizations; protected bool EnableBlockOptimizations; @@ -55,32 +55,32 @@ protected override void Finish() UpdateCounter(TransformCountStage, TransformCount); UpdateCounter(OptimizationCountStage, OptimizationCount); - MethodCompiler.Compiler.PostTraceLog(specialTrace); + MethodCompiler.Compiler.PostTraceLog(SpecialTrace); TransformCount = 0; OptimizationCount = 0; - trace = null; + Trace = null; } protected override void Run() { SortByPriority(); - trace = CreateTraceLog(5); + Trace = CreateTraceLog(5); AreCPURegistersAllocated = MethodCompiler.AreCPURegistersAllocated; Steps = 0; MethodCompiler.CreateTranformInstructionTrace(this, Steps++); - specialTrace = new TraceLog(TraceType.GlobalDebug, null, null, "Special Optimizations"); + SpecialTrace = new TraceLog(TraceType.GlobalDebug, null, null, "Special Optimizations"); - Transform.SetLogs(trace, specialTrace); + Transform.SetLogs(Trace, SpecialTrace); - CustomizeTransform(Transform); + Setup(); - ExecutePasses(); + ExecutePhases(); } protected void AddTranforms(List list) @@ -130,28 +130,51 @@ private void SortByPriority() SortedByPriority = true; } - protected virtual void CustomizeTransform(Transform transform) - { } + protected virtual void Setup() + { + } - private void ExecutePasses() + protected virtual bool SetupPhase(int phase) { + return phase == 0; + } + + private void ExecutePhases() + { + var phase = 0; var pass = 1; + + while (true) + { + if (!SetupPhase(phase++)) + break; + + pass = ExecutePasses(pass, MaxPasses); + } + } + + private int ExecutePasses(int pass, int maxPasses) + { var changed = true; + var firstPass = true; while (changed) { - trace?.Log($"*** Pass # {pass}"); + Trace?.Log($"*** Pass # {pass}"); var changed1 = InstructionTransformationPass(); - var changed2 = (!changed1 || pass == 1) && ApplyBlockTransforms(); + var changed2 = (!changed1 || firstPass) && ApplyBlockTransforms(); changed = changed1 || changed2; pass++; + firstPass = false; - if (pass >= MaxPasses && MaxPasses != 0) + if (pass >= maxPasses && maxPasses != 0) break; } + + return pass; } private bool InstructionTransformationPass() diff --git a/Source/Mosa.Compiler.Framework/Stages/BitTrackerStage.cs b/Source/Mosa.Compiler.Framework/Stages/BitTrackerStage.cs index 7f71004d9a..ddf5a94f4b 100644 --- a/Source/Mosa.Compiler.Framework/Stages/BitTrackerStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/BitTrackerStage.cs @@ -243,14 +243,6 @@ private void EvaluateVirtualRegisters() } } - private void UpdateInstructions() - { - foreach (var register in MethodCompiler.VirtualRegisters) - { - UpdateInstruction(register); - } - } - private void EvaluateBitValue(Operand virtualRegister, int recursion = 0) { if (!IsBitTrackable(virtualRegister)) @@ -297,6 +289,14 @@ private static bool IsBitTrackable(Operand operand) return false; } + private void UpdateInstructions() + { + foreach (var register in MethodCompiler.VirtualRegisters) + { + UpdateInstruction(register); + } + } + private void UpdateInstruction(Operand virtualRegister) { if (!IsBitTrackable(virtualRegister)) @@ -370,7 +370,7 @@ private void UpdateBranchInstructions() var value1 = node.Operand1.BitValue; var value2 = node.Operand2.BitValue; - var result = EvaluateCompare(value1, value2, node.ConditionCode); + var result = BaseTransform.EvaluateCompare(value1, value2, node.ConditionCode); if (!result.HasValue) continue; @@ -396,266 +396,6 @@ private void UpdateBranchInstructions() } } - private static bool? EvaluateCompare(BitValue value1, BitValue value2, ConditionCode condition) - { - switch (condition) - { - case ConditionCode.Equal: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown) - { - return value1.BitsSet == value2.BitsSet; - } - else if (value1.MaxValue == value1.MinValue && value1.MaxValue == value2.MaxValue && value1.MinValue == value2.MinValue) - { - return true; - } - else if (((value1.BitsSet & value2.BitsSet) != value1.BitsSet || (value1.BitsClear & value2.BitsClear) != value1.BitsClear) && !value1.AreAnyBitsKnown && !value2.AreAnyBitsKnown) - { - return false; - } - else if ((value1.BitsSet & value2.BitsClear) != 0 || (value2.BitsSet & value1.BitsClear) != 0) - { - return false; - } - else if (value1.MaxValue < value2.MinValue) - { - return false; - } - else if (value1.MinValue > value2.MaxValue) - { - return false; - } - break; - - case ConditionCode.NotEqual: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown) - { - return value1.BitsSet != value2.BitsSet; - } - else if (value1.MaxValue == value1.MinValue && value1.MaxValue == value2.MaxValue && value1.MinValue == value2.MinValue) - { - return false; - } - else if (value1.AreAll64BitsKnown && value1.MaxValue == 0 && value2.BitsSet != 0) - { - return true; - } - else if (value2.AreAll64BitsKnown && value2.MaxValue == 0 && value1.BitsSet != 0) - { - return true; - } - else if ((value1.BitsSet & value2.BitsClear) != 0 || (value2.BitsSet & value1.BitsClear) != 0) - { - return true; - } - else if (value1.MaxValue < value2.MinValue) - { - return true; - } - else if (value1.MinValue > value2.MaxValue) - { - return true; - } - break; - - case ConditionCode.UnsignedGreater: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown) - { - return value1.BitsSet > value2.BitsSet; - } - else if (value2.AreAll64BitsKnown && value2.MaxValue == 0 && value1.BitsSet != 0) - { - return true; - } - else if (value1.MinValue > value2.MaxValue) - { - return true; - } - else if (value1.MaxValue <= value2.MinValue) - { - return false; - } - break; - - case ConditionCode.UnsignedLess: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown) - { - return value1.MaxValue < value2.MaxValue; - } - else if (value1.AreAll64BitsKnown && value1.MaxValue == 0 && value2.BitsSet != 0) - { - return true; - } - else if (value2.MinValue > value1.MaxValue) - { - return true; - } - else if (value2.MaxValue <= value1.MinValue) - { - return false; - } - - break; - - case ConditionCode.UnsignedGreaterOrEqual: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown) - { - return value1.BitsSet <= value2.BitsSet; - } - else if (value1.AreAll64BitsKnown && value1.MaxValue == 0 && value2.BitsSet != 0) - { - return true; - } - else if (value1.MinValue >= value2.MaxValue) - { - return true; - } - else if (value1.MaxValue < value2.MinValue) - { - return false; - } - - break; - - case ConditionCode.UnsignedLessOrEqual: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown) - { - return value1.BitsSet <= value2.BitsSet; - } - else if (value1.AreAll64BitsKnown && value1.MaxValue == 0 && value2.BitsSet != 0) - { - return true; - } - else if (value2.MinValue >= value1.MaxValue) - { - return true; - } - else if (value2.MaxValue < value1.MinValue) - { - return false; - } - - break; - - case ConditionCode.Greater: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is64Bit && value2.Is64Bit) - { - return (long)value1.BitsSet > (long)value2.BitsSet; - } - else if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is32Bit && value2.Is32Bit) - { - return (int)value1.BitsSet > (int)value2.BitsSet; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MinValue > value2.MaxValue) - { - return true; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MaxValue < value2.MinValue) - { - return false; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MinValue > value2.MaxValue) - { - return true; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MaxValue < value2.MinValue) - { - return false; - } - - break; - - case ConditionCode.Less: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is64Bit && value2.Is64Bit) - { - return (long)value1.BitsSet < (long)value2.BitsSet; - } - else if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is32Bit && value2.Is32Bit) - { - return (int)value1.BitsSet < (int)value2.BitsSet; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MaxValue < value2.MinValue) - { - return true; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MinValue > value2.MaxValue) - { - return false; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MaxValue < value2.MinValue) - { - return true; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MinValue > value2.MaxValue) - { - return false; - } - - break; - - case ConditionCode.GreaterOrEqual: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is64Bit && value2.Is64Bit) - { - return (long)value1.BitsSet >= (long)value2.BitsSet; - } - else if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is32Bit && value2.Is32Bit) - { - return (int)value1.BitsSet >= (int)value2.BitsSet; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MinValue >= value2.MaxValue) - { - return true; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MaxValue <= value2.MinValue) - { - return false; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MinValue >= value2.MaxValue) - { - return true; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MaxValue <= value2.MinValue) - { - return false; - } - - break; - - case ConditionCode.LessOrEqual: - if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is64Bit && value2.Is64Bit) - { - return (long)value1.BitsSet <= (long)value2.BitsSet; - } - else if (value1.AreAll64BitsKnown && value2.AreAll64BitsKnown && value1.Is32Bit && value2.Is32Bit) - { - return (int)value1.BitsSet <= (int)value2.BitsSet; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MaxValue <= value2.MinValue) - { - return true; - } - else if (value1.Is32Bit && value2.Is32Bit && value1.IsSignBitClear32 && value2.IsSignBitClear32 && value1.MinValue >= value2.MaxValue) - { - return false; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MaxValue <= value2.MinValue) - { - return true; - } - else if (value1.Is64Bit && value2.Is64Bit && value1.IsSignBitClear64 && value2.IsSignBitClear64 && value1.MinValue >= value2.MaxValue) - { - return false; - } - - break; - - default: - return null; - } - - return null; - } - #region IR Instructions private static void Add32(Node node) @@ -843,7 +583,7 @@ private static void Compare32x32(Node node) var value1 = node.Operand1.BitValue; var value2 = node.Operand2.BitValue; - var compare = EvaluateCompare(value1, value2, node.ConditionCode); + var compare = BaseTransform.EvaluateCompare(value1, value2, node.ConditionCode); if (compare.HasValue) { @@ -861,7 +601,7 @@ private static void Compare64x32(Node node) var value1 = node.Operand1.BitValue; var value2 = node.Operand2.BitValue; - var compare = EvaluateCompare(value1, value2, node.ConditionCode); + var compare = BaseTransform.EvaluateCompare(value1, value2, node.ConditionCode); if (compare.HasValue) { @@ -879,7 +619,7 @@ private static void Compare64x64(Node node) var value1 = node.Operand1.BitValue; var value2 = node.Operand2.BitValue; - var compare = EvaluateCompare(value1, value2, node.ConditionCode); + var compare = BaseTransform.EvaluateCompare(value1, value2, node.ConditionCode); if (compare.HasValue) { diff --git a/Source/Mosa.Compiler.Framework/Stages/ExceptionStage.cs b/Source/Mosa.Compiler.Framework/Stages/ExceptionStage.cs index a6ad32ce54..57be248cec 100644 --- a/Source/Mosa.Compiler.Framework/Stages/ExceptionStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/ExceptionStage.cs @@ -25,10 +25,10 @@ protected override void Initialize() base.Initialize(); } - protected override void CustomizeTransform(Transform transform) + protected override void Setup() { - ExceptionManager.Setup(transform.MethodCompiler); + ExceptionManager.Setup(Transform.MethodCompiler); - transform.AddManager(ExceptionManager); + Transform.AddManager(ExceptionManager); } } diff --git a/Source/Mosa.Compiler.Framework/Stages/OptimizationStage.cs b/Source/Mosa.Compiler.Framework/Stages/OptimizationStage.cs index 67ec257bac..991cbbcd8b 100644 --- a/Source/Mosa.Compiler.Framework/Stages/OptimizationStage.cs +++ b/Source/Mosa.Compiler.Framework/Stages/OptimizationStage.cs @@ -33,9 +33,23 @@ public OptimizationStage(bool lowerTo32) EnableBlockOptimizations = true; } - protected override void CustomizeTransform(Transform transform) + protected override void Setup() { - transform.SetStageOptions(LowerTo32 && MosaSettings.LongExpansion && Is32BitPlatform); - transform.AddManager(CodeMotion); + Transform.AddManager(CodeMotion); + } + + protected override bool SetupPhase(int phase) + { + switch (phase) + { + case 0: + return true; + + case 1 when LowerTo32: + Transform.SetStageOptions(TransformStageOption.LowerTo32); + return true; + } + + return false; } } diff --git a/Source/Mosa.Compiler.Framework/Transform.cs b/Source/Mosa.Compiler.Framework/Transform.cs index 86bcf7016b..612deb0460 100644 --- a/Source/Mosa.Compiler.Framework/Transform.cs +++ b/Source/Mosa.Compiler.Framework/Transform.cs @@ -28,7 +28,7 @@ public sealed class Transform public BasicBlocks BasicBlocks { get; set; } - public bool IsLowerTo32 { get; private set; } + public TransformStageOption Options { get; private set; } public bool AreCPURegistersAllocated { get; private set; } @@ -44,6 +44,8 @@ public sealed class Transform public bool IsInSSAForm { get; private set; } + public bool IsLowerTo32 => Options.HasFlag(TransformStageOption.LowerTo32); + #endregion Properties #region Properties - Indirect @@ -127,7 +129,6 @@ public void SetCompiler(Compiler compiler) Is32BitPlatform = Compiler.Architecture.Is32BitPlatform; TypeSystem = Compiler.TypeSystem; - IsLowerTo32 = Compiler.MosaSettings.LongExpansion; Devirtualization = Compiler.MosaSettings.Devirtualization; Window = Math.Max(Compiler.MosaSettings.OptimizationBasicWindow, 1); @@ -140,7 +141,8 @@ public void SetCompiler(Compiler compiler) MulUnsignedInstruction = Is32BitPlatform ? IRInstruction.MulUnsigned32 : IRInstruction.MulUnsigned64; BranchInstruction = Is32BitPlatform ? IRInstruction.Branch32 : IRInstruction.Branch64; - IsLowerTo32 = false; + Options = TransformStageOption.None; + TraceLog = null; Managers.Clear(); @@ -161,7 +163,8 @@ public void SetMethodCompiler(MethodCompiler methodCompiler) BasicBlocks = methodCompiler.BasicBlocks; AreCPURegistersAllocated = methodCompiler.AreCPURegistersAllocated; - IsLowerTo32 = false; + Options = TransformStageOption.None; + TraceLog = null; Managers.Clear(); @@ -178,9 +181,9 @@ public void SetStage(BaseMethodCompilerStage stage) #endregion Set Contexts - public void SetStageOptions(bool lowerTo32) + public void SetStageOptions(TransformStageOption options) { - IsLowerTo32 = Compiler.MosaSettings.LongExpansion && lowerTo32 && Is32BitPlatform; + Options = options; } #region Manager diff --git a/Source/Mosa.Compiler.Framework/TransformStageOption.cs b/Source/Mosa.Compiler.Framework/TransformStageOption.cs new file mode 100644 index 0000000000..323eb7233d --- /dev/null +++ b/Source/Mosa.Compiler.Framework/TransformStageOption.cs @@ -0,0 +1,10 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +namespace Mosa.Compiler.Framework; + +[Flags] +public enum TransformStageOption +{ + None, + LowerTo32, +}; diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Add64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Add64.cs index f5767af9aa..f30780780a 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Add64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Add64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Add64 : BaseLower32Transform +public sealed class Add64 : BaseLowerTo32Transform { public Add64() : base(IRInstruction.Add64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/And64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/And64.cs index 1e77ff1411..fa12265a56 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/And64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/And64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class And64 : BaseLower32Transform +public sealed class And64 : BaseLowerTo32Transform { public And64() : base(IRInstruction.And64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By32.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By32.cs index 82b09e51d7..1855cc6b85 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By32.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By32.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ArithShiftRight64By32 : BaseLower32Transform +public sealed class ArithShiftRight64By32 : BaseLowerTo32Transform { public ArithShiftRight64By32() : base(IRInstruction.ArithShiftRight64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,10 @@ public ArithShiftRight64By32() : base(IRInstruction.ArithShiftRight64, Transform public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32 && context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 == 32; + if (!base.Match(context, transform)) + return false; + + return context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 == 32; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By63.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By63.cs index b10e980cd1..c86fa150f7 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By63.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ArithShiftRight64By63.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ArithShiftRight64By63 : BaseLower32Transform +public sealed class ArithShiftRight64By63 : BaseLowerTo32Transform { public ArithShiftRight64By63() : base(IRInstruction.ArithShiftRight64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,10 @@ public ArithShiftRight64By63() : base(IRInstruction.ArithShiftRight64, Transform public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32 && context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 == 63; + if (!base.Match(context, transform)) + return false; + + return context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 == 63; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/BaseLower32Transform.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/BaseLowerTo32Transform.cs similarity index 56% rename from Source/Mosa.Compiler.Framework/Transforms/LowerTo32/BaseLower32Transform.cs rename to Source/Mosa.Compiler.Framework/Transforms/LowerTo32/BaseLowerTo32Transform.cs index 71e8bc9da1..40e0babc73 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/BaseLower32Transform.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/BaseLowerTo32Transform.cs @@ -2,9 +2,9 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32 { - public abstract class BaseLower32Transform : BaseTransform + public abstract class BaseLowerTo32Transform : BaseTransform { - public BaseLower32Transform(BaseInstruction instruction, TransformType type, bool log = false) + public BaseLowerTo32Transform(BaseInstruction instruction, TransformType type, bool log = false) : base(instruction, type, log) { } @@ -12,7 +12,7 @@ public BaseLower32Transform(BaseInstruction instruction, TransformType type, boo public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32; + return transform.Is32BitPlatform && transform.IsLowerTo32; } } } diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64.cs index 6f04176180..328d883084 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Branch64 : BaseLower32Transform +public sealed class Branch64 : BaseLowerTo32Transform { private readonly Branch64Extends branch64Extends = new Branch64Extends(); // BUG? @@ -18,7 +18,7 @@ public override bool Match(Context context, Transform transform) if (branch64Extends.Match(context, transform)) return false; - return transform.IsLowerTo32; + return base.Match(context, transform); } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64Extends.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64Extends.cs index f8a47cc9ac..02b122c804 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64Extends.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Branch64Extends.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Branch64Extends : BaseLower32Transform +public sealed class Branch64Extends : BaseLowerTo32Transform { public Branch64Extends() : base(IRInstruction.Branch64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,7 @@ public Branch64Extends() : base(IRInstruction.Branch64, TransformType.Manual | T public override bool Match(Context context, Transform transform) { - if (!transform.IsLowerTo32) + if (!base.Match(context, transform)) return false; if (!context.Operand1.IsVirtualRegister) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare32x64.cs index 911bc8f0ca..8d625c5b7b 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare32x64 : BaseLower32Transform +public sealed class Compare32x64 : BaseLowerTo32Transform { public Compare32x64() : base(IRInstruction.Compare32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32EqualOrNotEqual.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32EqualOrNotEqual.cs index 5120d6d3f9..3a1379fba7 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32EqualOrNotEqual.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32EqualOrNotEqual.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare64x32EqualOrNotEqual : BaseLower32Transform +public sealed class Compare64x32EqualOrNotEqual : BaseLowerTo32Transform { public Compare64x32EqualOrNotEqual() : base(IRInstruction.Compare64x32, TransformType.Manual | TransformType.Optimization) { @@ -10,10 +10,13 @@ public Compare64x32EqualOrNotEqual() : base(IRInstruction.Compare64x32, Transfor public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode != ConditionCode.Equal && context.ConditionCode != ConditionCode.NotEqual) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32Rest.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32Rest.cs index bb9c3f1f48..8a245b0f37 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32Rest.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32Rest.cs @@ -4,7 +4,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare64x32Rest : BaseLower32Transform +public sealed class Compare64x32Rest : BaseLowerTo32Transform { public Compare64x32Rest() : base(IRInstruction.Compare64x32, TransformType.Manual | TransformType.Optimization) { @@ -12,13 +12,16 @@ public Compare64x32Rest() : base(IRInstruction.Compare64x32, TransformType.Manua public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode is ConditionCode.Equal or ConditionCode.NotEqual) return false; if (transform.IsInSSAForm) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32RestInSSA.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32RestInSSA.cs index 68fc242e0e..63ce814c19 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32RestInSSA.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32RestInSSA.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare64x32RestInSSA : BaseLower32Transform +public sealed class Compare64x32RestInSSA : BaseLowerTo32Transform { public Compare64x32RestInSSA() : base(IRInstruction.Compare64x32, TransformType.Manual | TransformType.Optimization) { @@ -10,13 +10,16 @@ public Compare64x32RestInSSA() : base(IRInstruction.Compare64x32, TransformType. public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode is ConditionCode.Equal or ConditionCode.NotEqual) return false; if (!transform.IsInSSAForm) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32UnsignedGreater.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32UnsignedGreater.cs index 7539d4bc5c..d3aacc451d 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32UnsignedGreater.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x32UnsignedGreater.cs @@ -3,7 +3,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; // NOT WORKING!!! -public sealed class Compare64x32UnsignedGreater : BaseLower32Transform +public sealed class Compare64x32UnsignedGreater : BaseLowerTo32Transform { public Compare64x32UnsignedGreater() : base(IRInstruction.Compare64x32, TransformType.Manual | TransformType.Optimization) { @@ -11,10 +11,13 @@ public Compare64x32UnsignedGreater() : base(IRInstruction.Compare64x32, Transfor public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode != ConditionCode.UnsignedGreater) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64EqualOrNotEqual.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64EqualOrNotEqual.cs index 745f81388b..99cb3c2385 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64EqualOrNotEqual.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64EqualOrNotEqual.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare64x64EqualOrNotEqual : BaseLower32Transform +public sealed class Compare64x64EqualOrNotEqual : BaseLowerTo32Transform { public Compare64x64EqualOrNotEqual() : base(IRInstruction.Compare64x64, TransformType.Manual | TransformType.Optimization) { @@ -10,10 +10,13 @@ public Compare64x64EqualOrNotEqual() : base(IRInstruction.Compare64x64, Transfor public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode != ConditionCode.Equal && context.ConditionCode != ConditionCode.NotEqual) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64Rest.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64Rest.cs index 7a1748cc31..696befd67e 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64Rest.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64Rest.cs @@ -4,7 +4,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare64x64Rest : BaseLower32Transform +public sealed class Compare64x64Rest : BaseLowerTo32Transform { public Compare64x64Rest() : base(IRInstruction.Compare64x64, TransformType.Manual | TransformType.Optimization) { @@ -12,13 +12,16 @@ public Compare64x64Rest() : base(IRInstruction.Compare64x64, TransformType.Manua public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode is ConditionCode.Equal or ConditionCode.NotEqual) return false; if (transform.IsInSSAForm) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64RestInSSA.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64RestInSSA.cs index c902242604..a1a78120a8 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64RestInSSA.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Compare64x64RestInSSA.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Compare64x64RestInSSA : BaseLower32Transform +public sealed class Compare64x64RestInSSA : BaseLowerTo32Transform { public Compare64x64RestInSSA() : base(IRInstruction.Compare64x64, TransformType.Manual | TransformType.Optimization) { @@ -10,13 +10,16 @@ public Compare64x64RestInSSA() : base(IRInstruction.Compare64x64, TransformType. public override bool Match(Context context, Transform transform) { + if (!base.Match(context, transform)) + return false; + if (context.ConditionCode is ConditionCode.Equal or ConditionCode.NotEqual) return false; if (!transform.IsInSSAForm) return false; - return transform.IsLowerTo32; + return true; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Load64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Load64.cs index 19cf782788..c2f48498c0 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Load64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Load64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Load64 : BaseLower32Transform +public sealed class Load64 : BaseLowerTo32Transform { public Load64() : base(IRInstruction.Load64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParam64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParam64.cs index 0e05df8a1e..4b91043e5c 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParam64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParam64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParam64 : BaseLower32Transform +public sealed class LoadParam64 : BaseLowerTo32Transform { public LoadParam64() : base(IRInstruction.LoadParam64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend16x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend16x64.cs index 2c9b0b30f3..e61aed153b 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend16x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend16x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParamSignExtend16x64 : BaseLower32Transform +public sealed class LoadParamSignExtend16x64 : BaseLowerTo32Transform { public LoadParamSignExtend16x64() : base(IRInstruction.LoadParamSignExtend16x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend32x64.cs index 4ba9479336..527054687f 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParamSignExtend32x64 : BaseLower32Transform +public sealed class LoadParamSignExtend32x64 : BaseLowerTo32Transform { public LoadParamSignExtend32x64() : base(IRInstruction.LoadParamSignExtend32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend8x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend8x64.cs index 83d31475c2..5246488f9f 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend8x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamSignExtend8x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParamSignExtend8x64 : BaseLower32Transform +public sealed class LoadParamSignExtend8x64 : BaseLowerTo32Transform { public LoadParamSignExtend8x64() : base(IRInstruction.LoadParamSignExtend8x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend16x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend16x64.cs index 1fe3d38d4b..db8a765419 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend16x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend16x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParamZeroExtend16x64 : BaseLower32Transform +public sealed class LoadParamZeroExtend16x64 : BaseLowerTo32Transform { public LoadParamZeroExtend16x64() : base(IRInstruction.LoadParamZeroExtend16x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend32x64.cs index 59ff6ead0a..c8ee2f9d62 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParamZeroExtend32x64 : BaseLower32Transform +public sealed class LoadParamZeroExtend32x64 : BaseLowerTo32Transform { public LoadParamZeroExtend32x64() : base(IRInstruction.LoadParamZeroExtend32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend8x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend8x64.cs index e87c968c3c..ddc067aa11 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend8x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadParamZeroExtend8x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadParamZeroExtend8x64 : BaseLower32Transform +public sealed class LoadParamZeroExtend8x64 : BaseLowerTo32Transform { public LoadParamZeroExtend8x64() : base(IRInstruction.LoadParamZeroExtend8x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend16x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend16x64.cs index a3be36852b..b111d66ad3 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend16x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend16x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadSignExtend16x64 : BaseLower32Transform +public sealed class LoadSignExtend16x64 : BaseLowerTo32Transform { public LoadSignExtend16x64() : base(IRInstruction.LoadSignExtend16x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend32x64.cs index 4d821ab586..6d47f5fcbc 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadSignExtend32x64 : BaseLower32Transform +public sealed class LoadSignExtend32x64 : BaseLowerTo32Transform { public LoadSignExtend32x64() : base(IRInstruction.LoadSignExtend32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend8x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend8x64.cs index 9f9d373105..46163988b6 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend8x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadSignExtend8x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadSignExtend8x64 : BaseLower32Transform +public sealed class LoadSignExtend8x64 : BaseLowerTo32Transform { public LoadSignExtend8x64() : base(IRInstruction.LoadSignExtend8x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend16x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend16x64.cs index 10a807d017..b6f0fa84bb 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend16x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend16x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadZeroExtend16x64 : BaseLower32Transform +public sealed class LoadZeroExtend16x64 : BaseLowerTo32Transform { public LoadZeroExtend16x64() : base(IRInstruction.LoadZeroExtend16x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend32x64.cs index a6b1974cf9..0c6b47e5af 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadZeroExtend32x64 : BaseLower32Transform +public sealed class LoadZeroExtend32x64 : BaseLowerTo32Transform { public LoadZeroExtend32x64() : base(IRInstruction.LoadZeroExtend32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend8x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend8x64.cs index 913ab2257a..dc3ec91b7e 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend8x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/LoadZeroExtend8x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class LoadZeroExtend8x64 : BaseLower32Transform +public sealed class LoadZeroExtend8x64 : BaseLowerTo32Transform { public LoadZeroExtend8x64() : base(IRInstruction.LoadZeroExtend8x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Move64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Move64.cs index d15c0699dc..ddeaacb839 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Move64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Move64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Move64 : BaseLower32Transform +public sealed class Move64 : BaseLowerTo32Transform { public Move64() : base(IRInstruction.Move64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulSigned64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulSigned64.cs index 97d355a2cd..5b333bc7db 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulSigned64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulSigned64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class MulSigned64 : BaseLower32Transform +public sealed class MulSigned64 : BaseLowerTo32Transform { public MulSigned64() : base(IRInstruction.MulSigned64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulUnsigned64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulUnsigned64.cs index f6f1463e11..784e632b10 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulUnsigned64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/MulUnsigned64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class MulUnsigned64 : BaseLower32Transform +public sealed class MulUnsigned64 : BaseLowerTo32Transform { public MulUnsigned64() : base(IRInstruction.MulUnsigned64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Not64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Not64.cs index 30c3167337..0f1ce8854e 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Not64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Not64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Not64 : BaseLower32Transform +public sealed class Not64 : BaseLowerTo32Transform { public Not64() : base(IRInstruction.Not64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Or64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Or64.cs index 2bd0bce2e2..3e6f0f9e35 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Or64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Or64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Or64 : BaseLower32Transform +public sealed class Or64 : BaseLowerTo32Transform { public Or64() : base(IRInstruction.Or64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Phi64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Phi64.cs index b77137db6e..f7bcd52c67 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Phi64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Phi64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Phi64 : BaseLower32Transform +public sealed class Phi64 : BaseLowerTo32Transform { public Phi64() : base(IRInstruction.Phi64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,7 @@ public Phi64() : base(IRInstruction.Phi64, TransformType.Manual | TransformType. public override bool Match(Context context, Transform transform) { - if (!transform.IsLowerTo32) + if (!base.Match(context, transform)) return false; if (context.OperandCount == 1) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32.cs index 7f3b47bd35..0ec539df09 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ShiftLeft64ByConstant32 : BaseLower32Transform +public sealed class ShiftLeft64ByConstant32 : BaseLowerTo32Transform { public ShiftLeft64ByConstant32() : base(IRInstruction.ShiftLeft64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,10 @@ public ShiftLeft64ByConstant32() : base(IRInstruction.ShiftLeft64, TransformType public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32 && context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 <= 32; + if (!base.Match(context, transform)) + return false; + + return context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 <= 32; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32Plus.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32Plus.cs index 3805dde4ce..56c87f8d68 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32Plus.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftLeft64ByConstant32Plus.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ShiftLeft64ByConstant32Plus : BaseLower32Transform +public sealed class ShiftLeft64ByConstant32Plus : BaseLowerTo32Transform { public ShiftLeft64ByConstant32Plus() : base(IRInstruction.ShiftLeft64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,10 @@ public ShiftLeft64ByConstant32Plus() : base(IRInstruction.ShiftLeft64, Transform public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32 && context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 > 32; + if (!base.Match(context, transform)) + return false; + + return context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 > 32; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32.cs index fd4257fabc..93d0692c78 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ShiftRight64ByConstant32 : BaseLower32Transform +public sealed class ShiftRight64ByConstant32 : BaseLowerTo32Transform { public ShiftRight64ByConstant32() : base(IRInstruction.ShiftRight64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,10 @@ public ShiftRight64ByConstant32() : base(IRInstruction.ShiftRight64, TransformTy public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32 && context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 <= 32; + if (!base.Match(context, transform)) + return false; + + return context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 <= 32; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32Plus.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32Plus.cs index 70e6ce8a71..84d7bf4782 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32Plus.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ShiftRight64ByConstant32Plus.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ShiftRight64ByConstant32Plus : BaseLower32Transform +public sealed class ShiftRight64ByConstant32Plus : BaseLowerTo32Transform { public ShiftRight64ByConstant32Plus() : base(IRInstruction.ShiftRight64, TransformType.Manual | TransformType.Optimization) { @@ -10,7 +10,10 @@ public ShiftRight64ByConstant32Plus() : base(IRInstruction.ShiftRight64, Transfo public override bool Match(Context context, Transform transform) { - return transform.IsLowerTo32 && context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 > 32; + if (!base.Match(context, transform)) + return false; + + return context.Operand2.IsResolvedConstant && context.Operand2.ConstantUnsigned32 > 32; } public override void Transform(Context context, Transform transform) diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend16x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend16x64.cs index 8b0364d949..bad114f47f 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend16x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend16x64.cs @@ -2,17 +2,12 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class SignExtend16x64 : BaseLower32Transform +public sealed class SignExtend16x64 : BaseLowerTo32Transform { public SignExtend16x64() : base(IRInstruction.SignExtend16x64, TransformType.Manual | TransformType.Optimization) { } - public override bool Match(Context context, Transform transform) - { - return transform.IsLowerTo32; - } - public override void Transform(Context context, Transform transform) { var result = context.Result; diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend32x64.cs index ac76c28f1f..cf050b8c9d 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class SignExtend32x64 : BaseLower32Transform +public sealed class SignExtend32x64 : BaseLowerTo32Transform { public SignExtend32x64() : base(IRInstruction.SignExtend32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend8x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend8x64.cs index f9d6b4019c..795e10f065 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend8x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/SignExtend8x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class SignExtend8x64 : BaseLower32Transform +public sealed class SignExtend8x64 : BaseLowerTo32Transform { public SignExtend8x64() : base(IRInstruction.SignExtend8x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Store64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Store64.cs index 6dba58db08..27e028ce7b 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Store64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Store64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Store64 : BaseLower32Transform +public sealed class Store64 : BaseLowerTo32Transform { public Store64() : base(IRInstruction.Store64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/StoreParam64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/StoreParam64.cs index 16aa822b1d..aa7bfad9fe 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/StoreParam64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/StoreParam64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class StoreParam64 : BaseLower32Transform +public sealed class StoreParam64 : BaseLowerTo32Transform { public StoreParam64() : base(IRInstruction.StoreParam64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Sub64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Sub64.cs index 431cf99974..6ee8787255 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Sub64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Sub64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Sub64 : BaseLower32Transform +public sealed class Sub64 : BaseLowerTo32Transform { public Sub64() : base(IRInstruction.Sub64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Truncate64x32.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Truncate64x32.cs index 1bf3819e96..58e0ded822 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Truncate64x32.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Truncate64x32.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Truncate64x32 : BaseLower32Transform +public sealed class Truncate64x32 : BaseLowerTo32Transform { public Truncate64x32() : base(IRInstruction.Truncate64x32, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Xor64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Xor64.cs index e9183efcd9..6738d523f4 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Xor64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/Xor64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class Xor64 : BaseLower32Transform +public sealed class Xor64 : BaseLowerTo32Transform { public Xor64() : base(IRInstruction.Xor64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend16x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend16x64.cs index de580a4f4d..a74ba4881b 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend16x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend16x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ZeroExtend16x64 : BaseLower32Transform +public sealed class ZeroExtend16x64 : BaseLowerTo32Transform { public ZeroExtend16x64() : base(IRInstruction.ZeroExtend16x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend32x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend32x64.cs index 45a2923194..c2db7b443d 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend32x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend32x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ZeroExtend32x64 : BaseLower32Transform +public sealed class ZeroExtend32x64 : BaseLowerTo32Transform { public ZeroExtend32x64() : base(IRInstruction.ZeroExtend32x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend8x64.cs b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend8x64.cs index caf3d73111..c943a34d5f 100644 --- a/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend8x64.cs +++ b/Source/Mosa.Compiler.Framework/Transforms/LowerTo32/ZeroExtend8x64.cs @@ -2,7 +2,7 @@ namespace Mosa.Compiler.Framework.Transforms.LowerTo32; -public sealed class ZeroExtend8x64 : BaseLower32Transform +public sealed class ZeroExtend8x64 : BaseLowerTo32Transform { public ZeroExtend8x64() : base(IRInstruction.ZeroExtend8x64, TransformType.Manual | TransformType.Optimization) { diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/ManualTransforms.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/ManualTransforms.cs index 9d567aa430..31d4bfe514 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/ManualTransforms.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/ManualTransforms.cs @@ -1,6 +1,5 @@ // Copyright (c) MOSA Project. Licensed under the New BSD License. -using System.Collections.Generic; using Mosa.Compiler.Framework; namespace Mosa.Compiler.x64.Transforms.Optimizations.Manual; @@ -14,7 +13,7 @@ public static class ManualTransforms { new Special.Deadcode(), - new Standard.Mov32ToXor32(), + //new Standard.Mov32ToXor32(), new Standard.Mov64ToXor64(), new Standard.Add32ToInc32(), new Standard.Sub32ToDec32(), diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add32ToInc32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add32ToInc32.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add32ToInc32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add32ToInc32.cs index f3df4bf25d..765ada444f 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add32ToInc32.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add32ToInc32.cs @@ -24,7 +24,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand1.Register == CPURegister.RSP) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (!(AreStatusFlagsUsed(context.Node.Next, false, true, false, false, false) == TriState.No)) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add32ToLea32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add32ToLea32.cs similarity index 100% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add32ToLea32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add32ToLea32.cs diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add64ToLea64.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add64ToLea64.cs similarity index 100% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Add64ToLea64.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Add64ToLea64.cs diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Cmp32ToTest32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Cmp32ToTest32.cs similarity index 100% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Cmp32ToTest32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Cmp32ToTest32.cs diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Cmp32ToZero.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Cmp32ToZero.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Cmp32ToZero.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Cmp32ToZero.cs index 3c6ea69d70..344cd60491 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Cmp32ToZero.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Cmp32ToZero.cs @@ -30,7 +30,7 @@ public override bool Match(Context context, Transform transform) if (previous.Instruction.IsMemoryRead) return false; - if (previous.Result != context.Operand1) + if (!AreSame(context.Operand1, context.Result)) return false; if (!previous.Instruction.IsZeroFlagModified) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Lea32ToDec32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Lea32ToDec32.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Lea32ToDec32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Lea32ToDec32.cs index 6a5b604854..a24be2efca 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Lea32ToDec32.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Lea32ToDec32.cs @@ -21,7 +21,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand2.ConstantSigned64 != -1) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (context.Operand1.Register == CPURegister.RSP) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Lea32ToInc32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Lea32ToInc32.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Lea32ToInc32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Lea32ToInc32.cs index 4912814618..41574fd60c 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Lea32ToInc32.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Lea32ToInc32.cs @@ -21,7 +21,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand2.ConstantUnsigned64 != 1) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (context.Operand1.Register == CPURegister.RSP) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Mov32ToXor32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Mov32ToXor32.cs similarity index 90% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Mov32ToXor32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Mov32ToXor32.cs index e958e7d952..eb0697e923 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Mov32ToXor32.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Mov32ToXor32.cs @@ -2,7 +2,7 @@ using Mosa.Compiler.Framework; -namespace Mosa.Compiler.x64.Transforms.Optimizations.Manual.Standard; +namespace Mosa.Compiler.x64.Transforms.Manual.Standard; [Transform("x64.Optimizations.Manual.Standard")] public sealed class Mov32ToXor32 : BaseTransform diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Mov64ToXor64.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Mov64ToXor64.cs similarity index 100% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Mov64ToXor64.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Mov64ToXor64.cs diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub32ToDec32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub32ToDec32.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub32ToDec32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub32ToDec32.cs index aa9fd0a290..74c3e056df 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub32ToDec32.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub32ToDec32.cs @@ -21,7 +21,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand2.ConstantUnsigned64 != 1) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (context.Operand1.Register == CPURegister.RSP) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub32ToLea32.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub32ToLea32.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub32ToLea32.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub32ToLea32.cs index e151e66360..483d08590e 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub32ToLea32.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub32ToLea32.cs @@ -24,6 +24,9 @@ public override bool Match(Context context, Transform transform) if (!context.Operand2.IsResolvedConstant) return false; + if (!AreSame(context.Operand1, context.Result)) + return false; + if (context.Operand1.Register == CPURegister.RSP) return false; diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub64ToLea64.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub64ToLea64.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub64ToLea64.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub64ToLea64.cs index 7995602a0f..ebdd44c2ab 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Sub64ToLea64.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Sub64ToLea64.cs @@ -24,6 +24,9 @@ public override bool Match(Context context, Transform transform) if (!context.Operand2.IsResolvedConstant) return false; + if (!AreSame(context.Operand1, context.Result)) + return false; + if (context.Operand1.Register == CPURegister.RSP) return false; diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Test32ToZero.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Test32ToZero.cs similarity index 95% rename from Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Test32ToZero.cs rename to Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Test32ToZero.cs index d09ffeec2f..f4ce07baf8 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Standard/Test32ToZero.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Rewrite/Test32ToZero.cs @@ -30,7 +30,7 @@ public override bool Match(Context context, Transform transform) if (previous.Instruction.IsMemoryRead) return false; - if (previous.Result != context.Operand1) + if (!AreSame(context.Operand1, context.Result)) return false; if (!previous.Instruction.IsZeroFlagModified) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Deadcode.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Deadcode.cs index 4bbae9ec1a..4dddb2bc8c 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Deadcode.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Deadcode.cs @@ -29,8 +29,6 @@ public override bool Match(Context context, Transform transform) return false; if (context.Instruction.IsIOOperation - - //|| context.Instruction.IsMemoryRead || context.Instruction.IsMemoryWrite || context.Instruction.HasUnspecifiedSideEffect) return false; @@ -44,9 +42,6 @@ public override bool Match(Context context, Transform transform) if (!instruction.IsPlatformInstruction) return false; - //if (!AreStatusFlagUsed(context)) - // return false; - if (instruction.IsCarryFlagModified || instruction.IsOverflowFlagModified || instruction.IsZeroFlagModified diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov32Unless.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov32Unless.cs index 0766f09570..5242e810ed 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov32Unless.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov32Unless.cs @@ -4,7 +4,7 @@ namespace Mosa.Compiler.x64.Transforms.Optimizations.Manual.Special; -[Transform("x86.Optimizations.Manual.Special")] +[Transform("x64.Optimizations.Manual.Special")] public sealed class Mov32Unless : BaseTransform { public Mov32Unless() : base(X64.Mov32, TransformType.Manual | TransformType.Optimization) diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov64Unless.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov64Unless.cs index df8d36f82c..2acd1adf89 100644 --- a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov64Unless.cs +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mov64Unless.cs @@ -4,7 +4,7 @@ namespace Mosa.Compiler.x64.Transforms.Optimizations.Manual.Special; -[Transform("x86.Optimizations.Manual.Special")] +[Transform("x64.Optimizations.Manual.Special")] public sealed class Mov64Unless : BaseTransform { public Mov64Unless() : base(X64.Mov64, TransformType.Manual | TransformType.Optimization) @@ -22,17 +22,11 @@ public override bool Match(Context context, Transform transform) if (!context.Operand1.IsPhysicalRegister) return false; - //if (context.Result.Register != CPURegister.ESP) - // return false; - var previous = context.Node.PreviousNonEmpty; if (previous == null || previous.Instruction != X64.Mov64) return false; - //if (previous.Result.Register != CPURegister.ESP) - // return false; - if (!previous.Result.IsPhysicalRegister) return false; diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs new file mode 100644 index 0000000000..1efce7bcde --- /dev/null +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs @@ -0,0 +1,48 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using Mosa.Compiler.Framework; + +namespace Mosa.Compiler.x64.Transforms.Optimizations.Manual.Special; + +[Transform("x64.Optimizations.Manual.Special")] +public sealed class Mul32Ditto : BaseTransform +{ + public Mul32Ditto() : base(X64.Mul32, TransformType.Manual | TransformType.Optimization) + { + } + + public override bool Match(Context context, Transform transform) + { + if (transform.AreCPURegistersAllocated) + return false; + + if (!context.Result.IsVirtualRegister) + return false; + + if (!context.Result2.IsVirtualRegister) + return false; + + var previous = context.Node.PreviousNonEmpty; + + if (previous == null || previous.Instruction != X64.Mul32) + return false; + + if (!AreSame(context.Operand1, previous.Operand1)) + return false; + + if (!AreSame(context.Operand2, previous.Operand2)) + return false; + + return true; + } + + public override void Transform(Context context, Transform transform) + { + var previous = context.Node.PreviousNonEmpty; + var result = context.Result; + var result2 = context.Result2; + + context.SetInstruction(X64.Mov32, result, previous.Result); + context.AppendInstruction(X64.Mov32, result2, previous.Result2); + } +} diff --git a/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul64Ditto.cs b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul64Ditto.cs new file mode 100644 index 0000000000..7a1f9069dd --- /dev/null +++ b/Source/Mosa.Compiler.x64/Transforms/Optimizations/Manual/Special/Mul64Ditto.cs @@ -0,0 +1,48 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +using Mosa.Compiler.Framework; + +namespace Mosa.Compiler.x64.Transforms.Optimizations.Manual.Special; + +[Transform("x64.Optimizations.Manual.Special")] +public sealed class Mul64Ditto : BaseTransform +{ + public Mul64Ditto() : base(X64.Mul64, TransformType.Manual | TransformType.Optimization) + { + } + + public override bool Match(Context context, Transform transform) + { + if (transform.AreCPURegistersAllocated) + return false; + + if (!context.Result.IsVirtualRegister) + return false; + + if (!context.Result2.IsVirtualRegister) + return false; + + var previous = context.Node.PreviousNonEmpty; + + if (previous == null || previous.Instruction != X64.Mul64) + return false; + + if (!AreSame(context.Operand1, previous.Operand1)) + return false; + + if (!AreSame(context.Operand2, previous.Operand2)) + return false; + + return true; + } + + public override void Transform(Context context, Transform transform) + { + var previous = context.Node.PreviousNonEmpty; + var result = context.Result; + var result2 = context.Result2; + + context.SetInstruction(X64.Mov64, result, previous.Result); + context.AppendInstruction(X64.Mov64, result2, previous.Result2); + } +} diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/ManualTransforms.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/ManualTransforms.cs index 551b52ea95..2d8f0d89a3 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/ManualTransforms.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/ManualTransforms.cs @@ -11,29 +11,26 @@ public static class ManualTransforms { public static readonly List List = new List { - new Special.Deadcode(), - new Standard.Add32ToInc32(), - new Standard.Sub32ToDec32(), + new Standard.Add32ToLea32(), // + new Standard.Cmp32ToTest32(), + new Standard.Cmp32ToZero(), new Standard.Lea32ToInc32(), + new Standard.Sub32ToDec32(), new Standard.Lea32ToDec32(), - new Standard.Cmp32ToZero(), + new Standard.Sub32ToLea32(), new Standard.Test32ToZero(), - new Standard.Cmp32ToTest32(), - new Special.Mov32ConstantReuse(), - new Special.Bt32Movzx8To32Setcc(), - new Stack.Add32(), - - //new Special.Mov32Propagate(), - //Add32ToLea32 - //Sub32ToLea32 - new Special.Mov32Unless(), + new Special.Deadcode(), new Special.Mov32Coalescing(), + new Special.Mov32ConstantReuse(), + new Special.Mov32Unless(), + new Special.Mul32Ditto(), + new Special.Bt32Movzx8To32Setcc(), new StrengthReduction.Mul32ByZero(), new StrengthReduction.Mul32WithMov32ByZero(), - new Special.Mul32Ditto(), + new Stack.Add32(), }; } diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Add32ToInc32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Add32ToInc32.cs similarity index 95% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Add32ToInc32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Add32ToInc32.cs index 0df04dfe5a..d6ed27b8d3 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Add32ToInc32.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Add32ToInc32.cs @@ -24,7 +24,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand1.Register == CPURegister.ESP) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (!(AreStatusFlagsUsed(context.Node.Next, false, true, false, false, false) == TriState.No)) diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Add32ToLea32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Add32ToLea32.cs similarity index 100% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Add32ToLea32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Add32ToLea32.cs diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Cmp32ToTest32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Cmp32ToTest32.cs similarity index 100% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Cmp32ToTest32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Cmp32ToTest32.cs diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Cmp32ToZero.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Cmp32ToZero.cs similarity index 95% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Cmp32ToZero.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Cmp32ToZero.cs index 1e6b49a37b..5205a3bee0 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Cmp32ToZero.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Cmp32ToZero.cs @@ -30,7 +30,7 @@ public override bool Match(Context context, Transform transform) if (previous.Instruction.IsMemoryRead) return false; - if (previous.Result != context.Operand1) + if (!AreSame(context.Operand1, context.Result)) return false; if (!previous.Instruction.IsZeroFlagModified) diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Lea32ToDec32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Lea32ToDec32.cs similarity index 100% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Lea32ToDec32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Lea32ToDec32.cs diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Lea32ToInc32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Lea32ToInc32.cs similarity index 95% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Lea32ToInc32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Lea32ToInc32.cs index 176d8c2370..95f1f9b43b 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Lea32ToInc32.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Lea32ToInc32.cs @@ -21,7 +21,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand2.ConstantUnsigned64 != 1) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (context.Operand1.Register == CPURegister.ESP) diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Mov32ToXor32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Mov32ToXor32.cs similarity index 100% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Mov32ToXor32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Mov32ToXor32.cs diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Sub32ToDec32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Sub32ToDec32.cs similarity index 95% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Sub32ToDec32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Sub32ToDec32.cs index 9231245a9d..6c574e3b40 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Sub32ToDec32.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Sub32ToDec32.cs @@ -21,7 +21,7 @@ public override bool Match(Context context, Transform transform) if (context.Operand2.ConstantUnsigned64 != 1) return false; - if (context.Operand1 != context.Result) + if (!AreSame(context.Operand1, context.Result)) return false; if (context.Operand1.Register == CPURegister.ESP) diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Sub32ToLea32.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Sub32ToLea32.cs similarity index 100% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Sub32ToLea32.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Sub32ToLea32.cs diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Test32ToZero.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Test32ToZero.cs similarity index 95% rename from Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Test32ToZero.cs rename to Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Test32ToZero.cs index 3916b3ada8..71d3ba4532 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Standard/Test32ToZero.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Rewrite/Test32ToZero.cs @@ -30,7 +30,7 @@ public override bool Match(Context context, Transform transform) if (previous.Instruction.IsMemoryRead) return false; - if (previous.Result != context.Operand1) + if (!AreSame(context.Operand1, context.Result)) return false; if (!previous.Instruction.IsZeroFlagModified) diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Deadcode.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Deadcode.cs index 817b14a1d1..1ad6cdcc44 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Deadcode.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Deadcode.cs @@ -31,8 +31,6 @@ public override bool Match(Context context, Transform transform) return false; if (context.Instruction.IsIOOperation - - //|| context.Instruction.IsMemoryRead || context.Instruction.IsMemoryWrite || context.Instruction.HasUnspecifiedSideEffect) return false; @@ -46,9 +44,6 @@ public override bool Match(Context context, Transform transform) if (!instruction.IsPlatformInstruction) return false; - //if (!AreStatusFlagUsed(context)) - // return false; - if (instruction.IsCarryFlagModified || instruction.IsOverflowFlagModified || instruction.IsZeroFlagModified diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mov32Unless.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mov32Unless.cs index a451f165bf..3cb66ae331 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mov32Unless.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mov32Unless.cs @@ -22,17 +22,11 @@ public override bool Match(Context context, Transform transform) if (!context.Operand1.IsPhysicalRegister) return false; - //if (context.Result.Register != CPURegister.ESP) - // return false; - var previous = context.Node.PreviousNonEmpty; if (previous == null || previous.Instruction != X86.Mov32) return false; - //if (previous.Result.Register != CPURegister.ESP) - // return false; - if (!previous.Result.IsPhysicalRegister) return false; diff --git a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs index 2dfc9ae888..b3f19388a3 100644 --- a/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs +++ b/Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Special/Mul32Ditto.cs @@ -27,10 +27,10 @@ public override bool Match(Context context, Transform transform) if (previous == null || previous.Instruction != X86.Mul32) return false; - if (context.Operand1 != previous.Operand1) + if (!AreSame(context.Operand1, previous.Operand1)) return false; - if (context.Operand2 != previous.Operand2) + if (!AreSame(context.Operand2, previous.Operand2)) return false; return true; diff --git a/Source/Mosa.Kernel.BareMetal.x64/PlatformPlug.cs b/Source/Mosa.Kernel.BareMetal.x64/PlatformPlug.cs index eed6a5d8ce..4a3c9e18f0 100644 --- a/Source/Mosa.Kernel.BareMetal.x64/PlatformPlug.cs +++ b/Source/Mosa.Kernel.BareMetal.x64/PlatformPlug.cs @@ -12,6 +12,9 @@ public static class PlatformPlug private const uint InitialGCMemoryPoolAddress = 0x03000000; // @ 48MB private const uint InitialGCMemoryPoolSize = 16 * 1024 * 1024; // [Size=16MB] + public static void ForceInclude() + { } + [Plug("Mosa.Kernel.BareMetal.Platform::EntryPoint")] public static void EntryPoint() { diff --git a/Source/Mosa.sln b/Source/Mosa.sln index 2e913ea110..301af65ca1 100644 --- a/Source/Mosa.sln +++ b/Source/Mosa.sln @@ -235,6 +235,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mosa.BareMetal.TestWorld", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mosa.BareMetal.TestWorld.x86", "Mosa.BareMetal.TestWorld.x86\Mosa.BareMetal.TestWorld.x86.csproj", "{E6A30C96-A0D2-43A3-8681-12067C094253}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mosa.BareMetal.TestWorld.x64", "Mosa.BareMetal.TestWorld.x64\Mosa.BareMetal.TestWorld.x64.csproj", "{282FA278-D577-48BC-93BD-214519F3AB28}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1365,6 +1367,24 @@ Global {E6A30C96-A0D2-43A3-8681-12067C094253}.Release|Mixed Platforms.Build.0 = Release|Any CPU {E6A30C96-A0D2-43A3-8681-12067C094253}.Release|x86.ActiveCfg = Release|Any CPU {E6A30C96-A0D2-43A3-8681-12067C094253}.Release|x86.Build.0 = Release|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Debug|x86.ActiveCfg = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Debug|x86.Build.0 = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Description|Any CPU.ActiveCfg = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Description|Any CPU.Build.0 = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Description|Mixed Platforms.ActiveCfg = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Description|Mixed Platforms.Build.0 = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Description|x86.ActiveCfg = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Description|x86.Build.0 = Debug|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Release|Any CPU.Build.0 = Release|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Release|x86.ActiveCfg = Release|Any CPU + {282FA278-D577-48BC-93BD-214519F3AB28}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1437,6 +1457,7 @@ Global {33E50A9F-D090-4ADB-B62E-F64B8C0EC3E8} = {4B46061F-49A8-4C15-8F68-FC97506CABA2} {3B66393E-1640-4156-8462-B6F695F1F3AE} = {3A538FDC-0226-4971-A3C0-31570CDA340D} {E6A30C96-A0D2-43A3-8681-12067C094253} = {3A538FDC-0226-4971-A3C0-31570CDA340D} + {282FA278-D577-48BC-93BD-214519F3AB28} = {3A538FDC-0226-4971-A3C0-31570CDA340D} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C22A5C94-6B05-4B1B-845A-A2EA7615E093}