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
21 changed files
with
690 additions
and
306 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
107 changes: 107 additions & 0 deletions
107
....Compiler.Framework/Transforms/Optimizations/Auto/BitValue/Compare32x32SignedLessAdd32.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,107 @@ | ||
// 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> | ||
/// Compare32x32SignedLessAdd32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.BitValue")] | ||
public sealed class Compare32x32SignedLessAdd32 : BaseTransform | ||
{ | ||
public Compare32x32SignedLessAdd32() : 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); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Compare32x32SignedLessAdd32_v1 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.BitValue")] | ||
public sealed class Compare32x32SignedLessAdd32_v1 : BaseTransform | ||
{ | ||
public Compare32x32SignedLessAdd32_v1() : base(IRInstruction.Compare32x32, TransformType.Auto | TransformType.Optimization, true) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, Transform transform) | ||
{ | ||
if (context.ConditionCode != ConditionCode.Greater) | ||
return false; | ||
|
||
if (!context.Operand2.IsVirtualRegister) | ||
return false; | ||
|
||
if (!context.Operand2.IsDefinedOnce) | ||
return false; | ||
|
||
if (context.Operand2.Definitions[0].Instruction != IRInstruction.Add32) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand2.Definitions[0].Operand2)) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand1)) | ||
return false; | ||
|
||
if (IsAddOverflow32(BitValueMax32(context.Operand2.Definitions[0].Operand1), BitValueMax32(context.Operand2.Definitions[0].Operand2))) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, Transform transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1; | ||
var t2 = context.Operand2.Definitions[0].Operand1; | ||
var t3 = context.Operand2.Definitions[0].Operand2; | ||
|
||
var v1 = transform.VirtualRegisters.Allocate32(); | ||
|
||
context.SetInstruction(IRInstruction.Sub32, v1, t1, t3); | ||
context.AppendInstruction(IRInstruction.Compare32x32, ConditionCode.Less, result, t2, v1); | ||
} | ||
} |
56 changes: 0 additions & 56 deletions
56
...Framework/Transforms/Optimizations/Auto/BitValue/Compare32x32SignedLessSignedLessAdd32.cs
This file was deleted.
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
Oops, something went wrong.