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.
- Loading branch information
Showing
14 changed files
with
594 additions
and
6 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
56 changes: 56 additions & 0 deletions
56
...Framework/Transforms/Optimizations/Auto/BitValue/Compare32x32SignedLessSignedLessAdd32.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,56 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
namespace Mosa.Compiler.Framework.Transforms.Optimizations.Auto.BitValue; | ||
|
||
/// <summary> | ||
/// Compare32x32SignedLessSignedLessAdd32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.BitValue")] | ||
public sealed class Compare32x32SignedLessSignedLessAdd32 : BaseTransform | ||
{ | ||
public Compare32x32SignedLessSignedLessAdd32() : base(IRInstruction.Compare32x32, TransformType.Auto | TransformType.Optimization, true) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (context.ConditionCode != ConditionCode.Less) | ||
return false; | ||
|
||
if (!context.Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand1.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Instruction != IRInstruction.Add32) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand1.Definitions[0].Operand2)) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand2)) | ||
return false; | ||
|
||
if (IsAddOverflow32(BitValueMax32(context.Operand1.Definitions[0].Operand1), BitValueMax32(context.Operand1.Definitions[0].Operand2))) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1.Definitions[0].Operand1; | ||
var t2 = context.Operand1.Definitions[0].Operand2; | ||
var t3 = context.Operand2; | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
|
||
context.SetInstruction(IRInstruction.Sub32, v1, t3, t2); | ||
context.AppendInstruction(IRInstruction.Compare32x32, ConditionCode.Less, result, t1, v1); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...ompiler.Framework/Transforms/Optimizations/Auto/BitValue/Compare32x32UnsignedLessAdd32.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,56 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
namespace Mosa.Compiler.Framework.Transforms.Optimizations.Auto.BitValue; | ||
|
||
/// <summary> | ||
/// Compare32x32UnsignedLessAdd32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.BitValue")] | ||
public sealed class Compare32x32UnsignedLessAdd32 : BaseTransform | ||
{ | ||
public Compare32x32UnsignedLessAdd32() : base(IRInstruction.Compare32x32, TransformType.Auto | TransformType.Optimization, true) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (context.ConditionCode != ConditionCode.UnsignedLess) | ||
return false; | ||
|
||
if (!context.Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand1.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Instruction != IRInstruction.Add32) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand1.Definitions[0].Operand2)) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand2)) | ||
return false; | ||
|
||
if (IsAddOverflow32(BitValueMax32(context.Operand1.Definitions[0].Operand1), BitValueMax32(context.Operand1.Definitions[0].Operand2))) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1.Definitions[0].Operand1; | ||
var t2 = context.Operand1.Definitions[0].Operand2; | ||
var t3 = context.Operand2; | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
|
||
context.SetInstruction(IRInstruction.Sub32, v1, t3, t2); | ||
context.AppendInstruction(IRInstruction.Compare32x32, ConditionCode.Less, result, t1, v1); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
....Compiler.Framework/Transforms/Optimizations/Auto/BitValue/Compare32x64SignedLessAdd32.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,56 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
namespace Mosa.Compiler.Framework.Transforms.Optimizations.Auto.BitValue; | ||
|
||
/// <summary> | ||
/// Compare32x64SignedLessAdd32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.BitValue")] | ||
public sealed class Compare32x64SignedLessAdd32 : BaseTransform | ||
{ | ||
public Compare32x64SignedLessAdd32() : base(IRInstruction.Compare32x64, TransformType.Auto | TransformType.Optimization, true) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (context.ConditionCode != ConditionCode.Less) | ||
return false; | ||
|
||
if (!context.Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand1.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Instruction != IRInstruction.Add32) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand1.Definitions[0].Operand2)) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand2)) | ||
return false; | ||
|
||
if (IsAddOverflow32(BitValueMax32(context.Operand1.Definitions[0].Operand1), BitValueMax32(context.Operand1.Definitions[0].Operand2))) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1.Definitions[0].Operand1; | ||
var t2 = context.Operand1.Definitions[0].Operand2; | ||
var t3 = context.Operand2; | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
|
||
context.SetInstruction(IRInstruction.Sub32, v1, t3, t2); | ||
context.AppendInstruction(IRInstruction.Compare32x64, ConditionCode.Less, result, t1, v1); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
...ompiler.Framework/Transforms/Optimizations/Auto/BitValue/Compare32x64UnsignedLessAdd32.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,56 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
// This code was generated by an automated template. | ||
|
||
namespace Mosa.Compiler.Framework.Transforms.Optimizations.Auto.BitValue; | ||
|
||
/// <summary> | ||
/// Compare32x64UnsignedLessAdd32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.BitValue")] | ||
public sealed class Compare32x64UnsignedLessAdd32 : BaseTransform | ||
{ | ||
public Compare32x64UnsignedLessAdd32() : base(IRInstruction.Compare32x64, TransformType.Auto | TransformType.Optimization, true) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (context.ConditionCode != ConditionCode.UnsignedLess) | ||
return false; | ||
|
||
if (!context.Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand1.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Instruction != IRInstruction.Add32) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand1.Definitions[0].Operand2)) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand2)) | ||
return false; | ||
|
||
if (IsAddOverflow32(BitValueMax32(context.Operand1.Definitions[0].Operand1), BitValueMax32(context.Operand1.Definitions[0].Operand2))) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1.Definitions[0].Operand1; | ||
var t2 = context.Operand1.Definitions[0].Operand2; | ||
var t3 = context.Operand2; | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
|
||
context.SetInstruction(IRInstruction.Sub32, v1, t3, t2); | ||
context.AppendInstruction(IRInstruction.Compare32x64, ConditionCode.Less, result, t1, v1); | ||
} | ||
} |
Oops, something went wrong.