aboutsummaryrefslogtreecommitdiff
path: root/ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2020-03-18 11:44:32 +0000
committerGitHub <noreply@github.com>2020-03-18 22:44:32 +1100
commit8226997bc7334ef2c29a1dadee72591f6d6037b1 (patch)
treef95b9aa233bbbef2f5288fb29c4c89cf8738ef74 /ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs
parent7475e180b4344fa2cf60243d8257304871fad24a (diff)
CodeGen Optimisations (LSRA and Translator) (#978)
* Start of JIT garbage collection improvements - thread static pool for Operand, MemoryOperand, Operation - Operands and Operations are always to be constructed via their static helper classes, so they can be pooled. - removing LinkedList from Node for sources/destinations (replaced with List<>s for now, but probably could do arrays since size is bounded) - removing params constructors from Node - LinkedList<> to List<> with Clear() for Operand assignments/uses - ThreadStaticPool is very simple and basically just exists for the purpose of our specific translation allocation problem. Right now it will stay at the worst case allocation count for that thread (so far) - the pool can never shrink. - Still some cases of Operand[] that haven't been removed yet. Will need to evaluate them (eg. is there a reasonable max number of params for Calls?) * ConcurrentStack instead of ConcurrentQueue for Rejit * Optimize some parts of LSRA - BitMap now operates on 64-bit int rather than 32-bit - BitMap is now pooled in a ThreadStatic pool (within lrsa) - BitMap now is now its own iterator. Marginally speeds up iterating through the bits. - A few cases where enumerators were generated have been converted to forms that generate less garbage. - New data structure for sorting _usePositions in LiveIntervals. Much faster split, NextUseAfter, initial insertion. Random insertion is slightly slower. - That last one is WIP since you need to insert the values backwards. It would be ideal if it just flipped it for you, uncomplicating things on the caller side. * Use a static pool of thread static pools. (yes.) Prevents each execution thread creating its own lowCq pool and making me cry. * Move constant value to top, change naming convention. * Fix iteration of memory operands. * Increase max thread count. * Address Feedback
Diffstat (limited to 'ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs')
-rw-r--r--ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs21
1 files changed, 12 insertions, 9 deletions
diff --git a/ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs b/ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs
index 65901e80..417f3bae 100644
--- a/ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs
+++ b/ARMeilleure/CodeGen/RegisterAllocators/CopyResolver.cs
@@ -2,6 +2,9 @@ using ARMeilleure.IntermediateRepresentation;
using System;
using System.Collections.Generic;
+using static ARMeilleure.IntermediateRepresentation.OperandHelper;
+using static ARMeilleure.IntermediateRepresentation.OperationHelper;
+
namespace ARMeilleure.CodeGen.RegisterAllocators
{
class CopyResolver
@@ -133,14 +136,14 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
private static void EmitCopy(List<Operation> sequence, Operand x, Operand y)
{
- sequence.Add(new Operation(Instruction.Copy, x, y));
+ sequence.Add(Operation(Instruction.Copy, x, y));
}
private static void EmitXorSwap(List<Operation> sequence, Operand x, Operand y)
{
- sequence.Add(new Operation(Instruction.BitwiseExclusiveOr, x, x, y));
- sequence.Add(new Operation(Instruction.BitwiseExclusiveOr, y, y, x));
- sequence.Add(new Operation(Instruction.BitwiseExclusiveOr, x, x, y));
+ sequence.Add(Operation(Instruction.BitwiseExclusiveOr, x, x, y));
+ sequence.Add(Operation(Instruction.BitwiseExclusiveOr, y, y, x));
+ sequence.Add(Operation(Instruction.BitwiseExclusiveOr, x, x, y));
}
}
@@ -194,20 +197,20 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
{
Operand register = GetRegister(right.Register, type);
- Operand offset = new Operand(left.SpillOffset);
+ Operand offset = Const(left.SpillOffset);
- _fillQueue.Enqueue(new Operation(Instruction.Fill, register, offset));
+ _fillQueue.Enqueue(Operation(Instruction.Fill, register, offset));
HasCopy = true;
}
private void AddSplitSpill(LiveInterval left, LiveInterval right, OperandType type)
{
- Operand offset = new Operand(right.SpillOffset);
+ Operand offset = Const(right.SpillOffset);
Operand register = GetRegister(left.Register, type);
- _spillQueue.Enqueue(new Operation(Instruction.Spill, null, offset, register));
+ _spillQueue.Enqueue(Operation(Instruction.Spill, null, offset, register));
HasCopy = true;
}
@@ -240,7 +243,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
private static Operand GetRegister(Register reg, OperandType type)
{
- return new Operand(reg.Index, reg.Type, type);
+ return Register(reg.Index, reg.Type, type);
}
}
} \ No newline at end of file