forked from mosa/MOSA-Project
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Explorer remembers previous settings
- Loading branch information
Showing
20 changed files
with
257 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,5 @@ public enum TransformStageOption | |
{ | ||
None, | ||
LowerTo32, | ||
ReduceCodeSize, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Mosa.Compiler.Framework\Mosa.Compiler.Framework.csproj" /> | ||
<Compile Remove="Transforms\Optimizations\Manual\Simplification\**" /> | ||
<EmbeddedResource Remove="Transforms\Optimizations\Manual\Simplification\**" /> | ||
<None Remove="Transforms\Optimizations\Manual\Simplification\**" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Transforms\Optimizations\Manual\Simplification\" /> | ||
<ProjectReference Include="..\Mosa.Compiler.Framework\Mosa.Compiler.Framework.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Size/Add32ToInc32x2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
using Mosa.Compiler.Framework; | ||
|
||
namespace Mosa.Compiler.x86.Transforms.Optimizations.Manual.Size; | ||
|
||
[Transform("x86.Optimizations.Manual.Size")] | ||
public sealed class Add32By2ToInc32 : BaseTransform | ||
{ | ||
public Add32By2ToInc32() : base(X86.Add32, TransformType.Manual | TransformType.Optimization) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (!transform.IsLowerCodeSize) | ||
return false; | ||
|
||
if (!context.Operand2.IsResolvedConstant) | ||
return false; | ||
|
||
if (context.Operand2.ConstantUnsigned64 != 2) | ||
return false; | ||
|
||
if (context.Operand1.Register == CPURegister.ESP) | ||
return false; | ||
|
||
if (!AreSame(context.Operand1, context.Result)) | ||
return false; | ||
|
||
if (AreStatusFlagUsed(context)) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
context.SetInstruction(X86.Inc32, result, result); | ||
context.AppendInstruction(X86.Inc32, result, result); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
Source/Mosa.Compiler.x86/Transforms/Optimizations/Manual/Size/Lea32By2.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
using Mosa.Compiler.Framework; | ||
|
||
namespace Mosa.Compiler.x86.Transforms.Optimizations.Manual.Size; | ||
|
||
[Transform("x86.Optimizations.Manual.Size")] | ||
public sealed class Lea32By2 : BaseTransform | ||
{ | ||
public Lea32By2() : base(X86.Lea32, TransformType.Manual | TransformType.Optimization) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (!transform.IsLowerCodeSize) | ||
return false; | ||
|
||
if (!context.Operand2.IsResolvedConstant) | ||
return false; | ||
|
||
if (context.Operand2.ConstantUnsigned64 != 2) | ||
return false; | ||
|
||
if (context.Operand1.Register == CPURegister.ESP) | ||
return false; | ||
|
||
if (!AreSame(context.Operand1, context.Result)) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
context.SetInstruction(X86.Inc32, result, result); | ||
context.AppendInstruction(X86.Inc32, result, result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.