mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 08:27:11 +02:00
misc: chore: Use collection expressions in ARMeilleure
This commit is contained in:
parent
c7db948fb3
commit
9cb3b40ffc
43 changed files with 251 additions and 256 deletions
|
@ -42,7 +42,7 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
{
|
||||
Offset = offset;
|
||||
Symbol = symbol;
|
||||
LdrOffsets = new List<(Operand, int)>();
|
||||
LdrOffsets = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,7 +266,7 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
}
|
||||
else
|
||||
{
|
||||
relocInfo = new RelocInfo(Array.Empty<RelocEntry>());
|
||||
relocInfo = new RelocInfo([]);
|
||||
}
|
||||
|
||||
return (code, relocInfo);
|
||||
|
|
|
@ -1079,7 +1079,7 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
|
||||
private static UnwindInfo WritePrologue(CodeGenContext context)
|
||||
{
|
||||
List<UnwindPushEntry> pushEntries = new();
|
||||
List<UnwindPushEntry> pushEntries = [];
|
||||
|
||||
Operand rsp = Register(SpRegister);
|
||||
|
||||
|
|
|
@ -140,8 +140,8 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
return false;
|
||||
}
|
||||
|
||||
private static readonly string[] _sysctlNames = new string[]
|
||||
{
|
||||
private static readonly string[] _sysctlNames =
|
||||
[
|
||||
"hw.optional.floatingpoint",
|
||||
"hw.optional.AdvSIMD",
|
||||
"hw.optional.arm.FEAT_FP16",
|
||||
|
@ -150,8 +150,8 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
"hw.optional.arm.FEAT_LSE",
|
||||
"hw.optional.armv8_crc32",
|
||||
"hw.optional.arm.FEAT_SHA1",
|
||||
"hw.optional.arm.FEAT_SHA256",
|
||||
};
|
||||
"hw.optional.arm.FEAT_SHA256"
|
||||
];
|
||||
|
||||
[Flags]
|
||||
public enum MacOsFeatureFlags
|
||||
|
|
|
@ -261,10 +261,10 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
|
||||
Operand dest = operation.Destination;
|
||||
|
||||
List<Operand> sources = new()
|
||||
{
|
||||
operation.GetSource(0),
|
||||
};
|
||||
List<Operand> sources =
|
||||
[
|
||||
operation.GetSource(0)
|
||||
];
|
||||
|
||||
int argsCount = operation.SourcesCount - 1;
|
||||
|
||||
|
@ -365,10 +365,10 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
Operation node,
|
||||
Operation operation)
|
||||
{
|
||||
List<Operand> sources = new()
|
||||
{
|
||||
operation.GetSource(0),
|
||||
};
|
||||
List<Operand> sources =
|
||||
[
|
||||
operation.GetSource(0)
|
||||
];
|
||||
|
||||
int argsCount = operation.SourcesCount - 1;
|
||||
|
||||
|
@ -468,8 +468,8 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
|
||||
// Update the sources and destinations with split 64-bit halfs of the whole 128-bit values.
|
||||
// We also need a additional registers that will be used to store temporary information.
|
||||
operation.SetDestinations(new[] { actualLow, actualHigh, Local(OperandType.I64), Local(OperandType.I64) });
|
||||
operation.SetSources(new[] { address, expectedLow, expectedHigh, desiredLow, desiredHigh });
|
||||
operation.SetDestinations([actualLow, actualHigh, Local(OperandType.I64), Local(OperandType.I64)]);
|
||||
operation.SetSources([address, expectedLow, expectedHigh, desiredLow, desiredHigh]);
|
||||
|
||||
// Add some dummy uses of the input operands, as the CAS operation will be a loop,
|
||||
// so they can't be used as destination operand.
|
||||
|
@ -486,7 +486,7 @@ namespace ARMeilleure.CodeGen.Arm64
|
|||
else
|
||||
{
|
||||
// We need a additional register where the store result will be written to.
|
||||
node.SetDestinations(new[] { node.Destination, Local(OperandType.I32) });
|
||||
node.SetDestinations([node.Destination, Local(OperandType.I32)]);
|
||||
|
||||
// Add some dummy uses of the input operands, as the CAS operation will be a loop,
|
||||
// so they can't be used as destination operand.
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
|
|||
|
||||
public ParallelCopy()
|
||||
{
|
||||
_copies = new List<Copy>();
|
||||
_copies = [];
|
||||
}
|
||||
|
||||
public void AddCopy(Register dest, Register source, OperandType type)
|
||||
|
@ -218,7 +218,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
|
|||
|
||||
public Operation[] Sequence()
|
||||
{
|
||||
List<Operation> sequence = new();
|
||||
List<Operation> sequence = [];
|
||||
|
||||
if (_spillQueue != null)
|
||||
{
|
||||
|
|
|
@ -799,8 +799,8 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
|
|||
|
||||
private void NumberLocals(ControlFlowGraph cfg, int registersCount)
|
||||
{
|
||||
_operationNodes = new List<(IntrusiveList<Operation>, Operation)>();
|
||||
_intervals = new List<LiveInterval>();
|
||||
_operationNodes = [];
|
||||
_intervals = [];
|
||||
|
||||
for (int index = 0; index < registersCount; index++)
|
||||
{
|
||||
|
@ -980,7 +980,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators
|
|||
|
||||
_blockLiveIn = blkLiveIn;
|
||||
|
||||
_blockEdges = new HashSet<int>();
|
||||
_blockEdges = [];
|
||||
|
||||
// Compute lifetime intervals.
|
||||
int operationPos = _operationsCount;
|
||||
|
|
|
@ -75,9 +75,9 @@ namespace ARMeilleure.CodeGen.X86
|
|||
{
|
||||
_stream = stream;
|
||||
_labels = new Dictionary<Operand, long>();
|
||||
_jumps = new List<Jump>();
|
||||
_jumps = [];
|
||||
|
||||
_relocs = relocatable ? new List<Reloc>() : null;
|
||||
_relocs = relocatable ? [] : null;
|
||||
}
|
||||
|
||||
public void MarkLabel(Operand label)
|
||||
|
@ -1419,7 +1419,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||
int relocOffset = 0;
|
||||
RelocEntry[] relocEntries = hasRelocs
|
||||
? new RelocEntry[relocs.Length]
|
||||
: Array.Empty<RelocEntry>();
|
||||
: [];
|
||||
|
||||
for (int i = 0; i < jumps.Length; i++)
|
||||
{
|
||||
|
|
|
@ -1748,7 +1748,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||
|
||||
private static UnwindInfo WritePrologue(CodeGenContext context)
|
||||
{
|
||||
List<UnwindPushEntry> pushEntries = new();
|
||||
List<UnwindPushEntry> pushEntries = [];
|
||||
|
||||
Operand rsp = Register(X86Register.Rsp);
|
||||
|
||||
|
|
|
@ -40,12 +40,12 @@ namespace ARMeilleure.CodeGen.X86
|
|||
return 0;
|
||||
}
|
||||
|
||||
ReadOnlySpan<byte> asmGetXcr0 = new byte[]
|
||||
{
|
||||
ReadOnlySpan<byte> asmGetXcr0 =
|
||||
[
|
||||
0x31, 0xc9, // xor ecx, ecx
|
||||
0xf, 0x01, 0xd0, // xgetbv
|
||||
0xc3, // ret
|
||||
};
|
||||
0xc3 // ret
|
||||
];
|
||||
|
||||
using MemoryBlock memGetXcr0 = new((ulong)asmGetXcr0.Length);
|
||||
|
||||
|
|
|
@ -124,13 +124,13 @@ namespace ARMeilleure.CodeGen.X86
|
|||
{
|
||||
int stackOffset = stackAlloc.Allocate(OperandType.I32);
|
||||
|
||||
node.SetSources(new Operand[] { Const(stackOffset), node.GetSource(0) });
|
||||
node.SetSources([Const(stackOffset), node.GetSource(0)]);
|
||||
}
|
||||
else if (node.Intrinsic == Intrinsic.X86Stmxcsr)
|
||||
{
|
||||
int stackOffset = stackAlloc.Allocate(OperandType.I32);
|
||||
|
||||
node.SetSources(new Operand[] { Const(stackOffset) });
|
||||
node.SetSources([Const(stackOffset)]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -253,8 +253,8 @@ namespace ARMeilleure.CodeGen.X86
|
|||
node = nodes.AddAfter(node, Operation(Instruction.VectorCreateScalar, dest, rax));
|
||||
nodes.AddAfter(node, Operation(Instruction.VectorInsert, dest, dest, rdx, Const(1)));
|
||||
|
||||
operation.SetDestinations(new Operand[] { rdx, rax });
|
||||
operation.SetSources(new Operand[] { operation.GetSource(0), rdx, rax, rcx, rbx });
|
||||
operation.SetDestinations([rdx, rax]);
|
||||
operation.SetSources([operation.GetSource(0), rdx, rax, rcx, rbx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -274,7 +274,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||
|
||||
nodes.AddBefore(node, Operation(Instruction.Copy, temp, newValue));
|
||||
|
||||
node.SetSources(new Operand[] { node.GetSource(0), rax, temp });
|
||||
node.SetSources([node.GetSource(0), rax, temp]);
|
||||
|
||||
nodes.AddAfter(node, Operation(Instruction.Copy, dest, rax));
|
||||
|
||||
|
@ -303,7 +303,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||
|
||||
nodes.AddAfter(node, Operation(Instruction.Copy, dest, rax));
|
||||
|
||||
node.SetSources(new Operand[] { rdx, rax, node.GetSource(1) });
|
||||
node.SetSources([rdx, rax, node.GetSource(1)]);
|
||||
node.Destination = rax;
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||
|
||||
nodes.AddAfter(node, Operation(Instruction.Copy, dest, rdx));
|
||||
|
||||
node.SetDestinations(new Operand[] { rdx, rax });
|
||||
node.SetDestinations([rdx, rax]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ namespace ARMeilleure.CodeGen.X86
|
|||
{
|
||||
Operand dest = node.Destination;
|
||||
|
||||
List<Operand> sources = new()
|
||||
{
|
||||
node.GetSource(0),
|
||||
};
|
||||
List<Operand> sources =
|
||||
[
|
||||
node.GetSource(0)
|
||||
];
|
||||
|
||||
int argsCount = node.SourcesCount - 1;
|
||||
|
||||
|
@ -117,10 +117,10 @@ namespace ARMeilleure.CodeGen.X86
|
|||
|
||||
public static void InsertTailcallCopies(IntrusiveList<Operation> nodes, Operation node)
|
||||
{
|
||||
List<Operand> sources = new()
|
||||
{
|
||||
node.GetSource(0),
|
||||
};
|
||||
List<Operand> sources =
|
||||
[
|
||||
node.GetSource(0)
|
||||
];
|
||||
|
||||
int argsCount = node.SourcesCount - 1;
|
||||
|
||||
|
|
|
@ -321,7 +321,7 @@ namespace ARMeilleure.CodeGen.X86
|
|||
nodes.AddBefore(node, retCopyOp);
|
||||
}
|
||||
|
||||
node.SetSources(Array.Empty<Operand>());
|
||||
node.SetSources([]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue