Skip to content

Commit

Permalink
- WIP (working)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgiphil committed Oct 28, 2023
1 parent 841b7f6 commit 5adcdfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions Source/Mosa.Compiler.Framework/PhysicalRegisters.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) MOSA Project. Licensed under the New BSD License.

using System.Collections;
using System.Diagnostics;

namespace Mosa.Compiler.Framework;

Expand Down Expand Up @@ -47,6 +48,12 @@ public Operand Allocate(Operand operand, PhysicalRegister register)
return Allocate(operand.Primitive, register);
}

public Operand Allocate(Operand operand)
{
Debug.Assert(operand.IsCPURegister);
return Allocate(operand.Primitive, operand.Register);
}

public Operand Allocate32(PhysicalRegister register)
{
return Allocate(PrimitiveType.Int32, register);
Expand Down
6 changes: 3 additions & 3 deletions Source/Mosa.Compiler.Framework/Stages/InlineStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,11 @@ private Operand Map(Operand operand, Dictionary<Operand, Operand> map, Node call
{
mappedOperand = MethodCompiler.VirtualRegisters.Allocate(operand);
}
else if (operand.IsStaticField)
else if (operand.IsCPURegister)
{
mappedOperand = operand;
mappedOperand = MethodCompiler.PhysicalRegisters.Allocate(operand);
}
else if (operand.IsCPURegister)
else if (operand.IsStaticField)
{
mappedOperand = operand;
}
Expand Down

0 comments on commit 5adcdfd

Please sign in to comment.