-
Notifications
You must be signed in to change notification settings - Fork 82
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
26 changed files
with
987 additions
and
533 deletions.
There are no files selected for viewing
695 changes: 227 additions & 468 deletions
695
Source/Data/IR-Optimizations-ConstantFolding-MemoryAccess.json
Large diffs are not rendered by default.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
Source/Data/IR-Optimizations-ConstantFolding-MemoryAccess2.json
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,6 @@ | ||
{ | ||
"Family": "IR", | ||
"Section": "Optimizations.Auto", | ||
"Optimizations": [ | ||
] | ||
} |
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
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
51 changes: 51 additions & 0 deletions
51
...er.Framework/Transforms/Optimizations/Auto/ConstantFolding/LoadManagedPointerFoldAdd32.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,51 @@ | ||
// 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.Framework.Transforms.Optimizations.Auto.ConstantFolding; | ||
|
||
/// <summary> | ||
/// LoadManagedPointerFoldAdd32 | ||
/// </summary> | ||
[Transform("IR.Optimizations.Auto.ConstantFolding")] | ||
public sealed class LoadManagedPointerFoldAdd32 : BaseTransform | ||
{ | ||
public LoadManagedPointerFoldAdd32() : base(IRInstruction.LoadManagedPointer, TransformType.Auto | TransformType.Optimization) | ||
{ | ||
} | ||
|
||
public override bool Match(Context context, TransformContext transform) | ||
{ | ||
if (!context.Operand1.IsVirtualRegister) | ||
return false; | ||
|
||
if (context.Operand1.Definitions.Count != 1) | ||
return false; | ||
|
||
if (context.Operand1.Definitions[0].Instruction != IRInstruction.Add32) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand2)) | ||
return false; | ||
|
||
if (!IsResolvedConstant(context.Operand1.Definitions[0].Operand2)) | ||
return false; | ||
|
||
return true; | ||
} | ||
|
||
public override void Transform(Context context, TransformContext transform) | ||
{ | ||
var result = context.Result; | ||
|
||
var t1 = context.Operand1.Definitions[0].Operand1; | ||
var t2 = context.Operand1.Definitions[0].Operand2; | ||
var t3 = context.Operand2; | ||
|
||
var e1 = Operand.CreateConstant(Add32(To32(t2), To32(t3))); | ||
|
||
context.SetInstruction(IRInstruction.LoadManagedPointer, result, t1, e1); | ||
} | ||
} |
Oops, something went wrong.