Skip to content

Commit

Permalink
- Fixes (#1027)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiphil committed Mar 12, 2023
1 parent e921a6d commit 0fd4f41
Show file tree
Hide file tree
Showing 14 changed files with 22 additions and 61 deletions.
1 change: 1 addition & 0 deletions Source/Mosa.Compiler.Framework/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ private static List<BaseMethodCompilerStage> GetDefaultMethodPipeline(CompilerSe
new PlugStage(),
new RuntimeStage(),
new IRTransformsStage(),

(compilerSettings.InlineMethods || compilerSettings.InlineExplicit) ? new InlineStage() : null,
new PromoteTemporaryVariables(),
new StaticLoadOptimizationStage(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using System.Diagnostics;
using Mosa.Compiler.Framework.Managers;

namespace Mosa.Compiler.Framework.Transforms.Optimizations.Manual.CodeMotion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Mosa.Compiler.Framework.Transforms.Optimizations.Manual.CodeMotion;
/// </summary>
public sealed class LoadZeroExtend8x32 : BaseCodeMotionTransform
{
public LoadZeroExtend8x32() : base(IRInstruction.LoadZeroExtend8x32, TransformType.Manual | TransformType.Optimization, true)
public LoadZeroExtend8x32() : base(IRInstruction.LoadZeroExtend8x32, TransformType.Manual | TransformType.Optimization)
{
}
}
10 changes: 8 additions & 2 deletions Source/Mosa.Demo.TestWorld.x86/Boot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public static void Main()

TestHash();

Screen.Write("CheckedTests.MulI8I8: ");
Screen.Write("StringTest.SubStringTest4: ");

var value1 = Test2();
var value1 = Test5();

if (value1)
Screen.WriteLine("Ok");
Expand Down Expand Up @@ -310,4 +310,10 @@ public static long Test4()
{
return SpecificTests.SwitchI8_v2(9223372036854775807);
}

[MethodImpl(MethodImplOptions.NoInlining)]
public static bool Test5()
{
return StringTest.SubStringTest4();
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

// This code was generated by an automated template.

using System.Collections.Generic;
using Mosa.Compiler.Framework;

namespace Mosa.Platform.x64.Transforms.Optimizations.Manual;

/// <summary>
/// Transformations
/// Manual Optimizations Transformations
/// </summary>
public static class ManualTransforms
{
public static readonly List<BaseTransform> List = new List<BaseTransform>
{
new Special.Deadcode(),

new Standard.Mov32ToXor32(),
new Standard.Mov64ToXor64(),
new Standard.Add32ToInc32(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using Mosa.Compiler.Framework;
using Mosa.Compiler.Framework.Transforms;

namespace Mosa.Platform.x64.Transforms.Optimizations.Manual.Special;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using Mosa.Compiler.Framework;
using Mosa.Compiler.Framework.Transforms;

namespace Mosa.Platform.x64.Transforms.Optimizations.Manual.Special;

Expand All @@ -13,6 +12,9 @@ public Mov32ConstantReuse() : base(X64.Mov32, TransformType.Manual | TransformTy

public override bool Match(Context context, TransformContext transform)
{
if (!transform.AreCPURegistersAllocated)
return false;

if (!context.Operand1.IsResolvedConstant)
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ public Mov64ConstantReuse() : base(X64.Mov64, TransformType.Manual | TransformTy

public override bool Match(Context context, TransformContext transform)
{
if (!transform.AreCPURegistersAllocated)
return false;

if (!context.Operand1.IsResolvedConstant)
return false;

Expand All @@ -27,7 +30,7 @@ public override bool Match(Context context, TransformContext transform)

var previous = context.Node.PreviousNonEmpty;

if (previous == null || previous.Instruction != X64.Mov64)
if (previous == null || previous.Instruction != X64.Mov32)
return false;

if (previous.Result.Register != CPURegister.RSP)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ public PlatformTransformationStage()
AddTranforms(AddressModeTransforms.List);

AddTranform(new Mov32Unless());
AddTranform(new Mov32Propagation());
AddTranform(new Mov32Consolidate());
AddTranform(new Mov32Coalescing());
AddTranform(new Deadcode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public static class ManualTransforms
new Standard.Cmp32ToTest32(),

new Special.Mov32ConstantReuse(),
new Special.Mov32Consolidate(),
new Special.Bt32Movzx8To32Setcc(),

new Stack.Add32(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using Mosa.Compiler.Framework;
using Mosa.Compiler.Framework.Transforms;

namespace Mosa.Platform.x86.Transforms.Optimizations.Manual.Special;

public sealed class Mov32Propagation : BaseTransform
public sealed class Mov32Coalescing : BaseTransform
{
public Mov32Propagation() : base(X86.Mov32, TransformType.Manual | TransformType.Optimization)
public Mov32Coalescing() : base(X86.Mov32, TransformType.Manual | TransformType.Optimization)
{
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using Mosa.Compiler.Framework;
using Mosa.Compiler.Framework.Transforms;

namespace Mosa.Platform.x86.Transforms.Optimizations.Manual.Special;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using Mosa.Compiler.Framework;
using Mosa.Compiler.Framework.Transforms;

namespace Mosa.Platform.x86.Transforms.Optimizations.Manual.Special;

Expand Down

0 comments on commit 0fd4f41

Please sign in to comment.