aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/IntermediateRepresentation
diff options
context:
space:
mode:
authorFICTURE7 <FICTURE7@gmail.com>2021-09-29 03:38:37 +0400
committerGitHub <noreply@github.com>2021-09-29 01:38:37 +0200
commit312be74861dae16311f4376e32195f8a4fd372c6 (patch)
tree43b9937541dc1d3359ab18b3c45533f9de2b1b28 /ARMeilleure/IntermediateRepresentation
parent1ae690ba2f407042456207d40e425f8b1f900863 (diff)
Optimize `HybridAllocator` (#2637)
* Store constant `Operand`s in the `LocalInfo` Since the spill slot and register assigned is fixed, we can just store the `Operand` reference in the `LocalInfo` struct. This allows skipping hitting the intern-table for a look up. * Skip `Uses`/`Assignments` management Since the `HybridAllocator` is the last pass and we do not care about uses/assignments we can skip managing that when setting destinations or sources. * Make `GetLocalInfo` inlineable Also fix a possible issue where with numbered locals. See or-assignment operator in `SetVisited(local)` before patch. * Do not run `BlockPlacement` in LCQ With the host mapped memory manager, there is a lot less cold code to split from hot code. So disabling this in LCQ gives some extra throughput - where we need it. * Address Mou-Ikkai's feedback * Apply suggestions from code review Co-authored-by: VocalFan <45863583+Mou-Ikkai@users.noreply.github.com> * Move check to an assert Co-authored-by: VocalFan <45863583+Mou-Ikkai@users.noreply.github.com>
Diffstat (limited to 'ARMeilleure/IntermediateRepresentation')
-rw-r--r--ARMeilleure/IntermediateRepresentation/Operand.cs1
-rw-r--r--ARMeilleure/IntermediateRepresentation/Operation.cs16
2 files changed, 9 insertions, 8 deletions
diff --git a/ARMeilleure/IntermediateRepresentation/Operand.cs b/ARMeilleure/IntermediateRepresentation/Operand.cs
index ff3354f2..74b1c71e 100644
--- a/ARMeilleure/IntermediateRepresentation/Operand.cs
+++ b/ARMeilleure/IntermediateRepresentation/Operand.cs
@@ -146,6 +146,7 @@ namespace ARMeilleure.IntermediateRepresentation
return BitConverter.Int64BitsToDouble((long)Value);
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal ref ulong GetValueUnsafe()
{
return ref _data->Value;
diff --git a/ARMeilleure/IntermediateRepresentation/Operation.cs b/ARMeilleure/IntermediateRepresentation/Operation.cs
index 08b874cf..c71e143c 100644
--- a/ARMeilleure/IntermediateRepresentation/Operation.cs
+++ b/ARMeilleure/IntermediateRepresentation/Operation.cs
@@ -53,8 +53,8 @@ namespace ARMeilleure.IntermediateRepresentation
public int DestinationsCount => _data->DestinationsCount;
public int SourcesCount => _data->SourcesCount;
- private Span<Operand> Destinations => new(_data->Destinations, _data->DestinationsCount);
- private Span<Operand> Sources => new(_data->Sources, _data->SourcesCount);
+ internal Span<Operand> DestinationsUnsafe => new(_data->Destinations, _data->DestinationsCount);
+ internal Span<Operand> SourcesUnsafe => new(_data->Sources, _data->SourcesCount);
public PhiOperation AsPhi()
{
@@ -65,17 +65,17 @@ namespace ARMeilleure.IntermediateRepresentation
public Operand GetDestination(int index)
{
- return Destinations[index];
+ return DestinationsUnsafe[index];
}
public Operand GetSource(int index)
{
- return Sources[index];
+ return SourcesUnsafe[index];
}
public void SetDestination(int index, Operand dest)
{
- ref Operand curDest = ref Destinations[index];
+ ref Operand curDest = ref DestinationsUnsafe[index];
RemoveAssignment(curDest);
AddAssignment(dest);
@@ -85,7 +85,7 @@ namespace ARMeilleure.IntermediateRepresentation
public void SetSource(int index, Operand src)
{
- ref Operand curSrc = ref Sources[index];
+ ref Operand curSrc = ref SourcesUnsafe[index];
RemoveUse(curSrc);
AddUse(src);
@@ -274,8 +274,8 @@ namespace ARMeilleure.IntermediateRepresentation
EnsureCapacity(ref result._data->Destinations, ref result._data->DestinationsCount, destCount);
EnsureCapacity(ref result._data->Sources, ref result._data->SourcesCount, srcCount);
- result.Destinations.Clear();
- result.Sources.Clear();
+ result.DestinationsUnsafe.Clear();
+ result.SourcesUnsafe.Clear();
return result;
}