mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-25 08:27:11 +02:00
[ARMeilleure] Address dotnet-format issues (#5357)
* dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0052 warnings * Address or silence dotnet format IDE1006 warnings * Address or silence dotnet format CA2208 warnings * Address dotnet format CA1822 warnings * Address or silence dotnet format CA1069 warnings * Silence CA1806 and CA1834 issues * Address dotnet format CA1401 warnings * Fix new dotnet-format issues after rebase * Address review comments * Address dotnet format CA2208 warnings properly * Fix formatting for switch expressions * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Add previously silenced warnings back I have no clue how these disappeared * Revert formatting changes for OpCodeTable.cs * Enable formatting for a few cases again * Format if-blocks correctly * Enable formatting for a few more cases again * Fix inline comment alignment * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Disable 'prefer switch expression' rule * Add comments to disabled warnings * Remove a few unused parameters * Adjust namespaces * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Start working on disabled warnings * Fix and silence a few dotnet-format warnings again * Address IDE0251 warnings * Address a few disabled IDE0060 warnings * Silence IDE0060 in .editorconfig * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Remove unnecessary formatting exclusion * Add unsafe dotnet format changes * Change visibility of JitSupportDarwin to internal
This commit is contained in:
parent
2de78a2d55
commit
ff53dcf560
300 changed files with 3515 additions and 3120 deletions
|
@ -10,7 +10,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
private int _succCount;
|
||||
private BasicBlock _succ0;
|
||||
private BasicBlock _succ1;
|
||||
private readonly BasicBlock _succ1;
|
||||
private HashSet<BasicBlock> _domFrontiers;
|
||||
|
||||
public int Index { get; set; }
|
||||
|
@ -27,10 +27,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
{
|
||||
get
|
||||
{
|
||||
if (_domFrontiers == null)
|
||||
{
|
||||
_domFrontiers = new HashSet<BasicBlock>();
|
||||
}
|
||||
_domFrontiers ??= new HashSet<BasicBlock>();
|
||||
|
||||
return _domFrontiers;
|
||||
}
|
||||
|
@ -108,7 +105,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
oldBlock.Predecessors.Remove(this);
|
||||
block.Predecessors.Add(this);
|
||||
|
||||
|
||||
oldBlock = block;
|
||||
}
|
||||
|
||||
|
@ -156,4 +153,4 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
enum BasicBlockFrequency
|
||||
{
|
||||
Default,
|
||||
Cold
|
||||
Cold,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
{
|
||||
enum Comparison
|
||||
{
|
||||
Equal = 0,
|
||||
NotEqual = 1,
|
||||
Greater = 2,
|
||||
LessOrEqual = 3,
|
||||
GreaterUI = 4,
|
||||
LessOrEqualUI = 5,
|
||||
GreaterOrEqual = 6,
|
||||
Less = 7,
|
||||
GreaterOrEqualUI = 8,
|
||||
LessUI = 9
|
||||
Equal = 0,
|
||||
NotEqual = 1,
|
||||
Greater = 2,
|
||||
LessOrEqual = 3,
|
||||
GreaterUI = 4,
|
||||
LessOrEqualUI = 5,
|
||||
GreaterOrEqual = 6,
|
||||
Less = 7,
|
||||
GreaterOrEqualUI = 8,
|
||||
LessUI = 9,
|
||||
}
|
||||
|
||||
static class ComparisonExtensions
|
||||
|
|
|
@ -67,6 +67,6 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
Phi,
|
||||
Spill,
|
||||
SpillArg,
|
||||
StoreToContext
|
||||
StoreToContext,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ARMeilleure.IntermediateRepresentation
|
||||
{
|
||||
[Flags]
|
||||
[SuppressMessage("Design", "CA1069: Enums values should not be duplicated")]
|
||||
enum Intrinsic : ushort
|
||||
{
|
||||
// X86 (SSE and AVX)
|
||||
|
@ -634,6 +636,6 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
Arm64VByte = 0 << Arm64VSizeShift,
|
||||
Arm64VHWord = 1 << Arm64VSizeShift,
|
||||
Arm64VWord = 2 << Arm64VSizeShift,
|
||||
Arm64VDWord = 3 << Arm64VSizeShift
|
||||
Arm64VDWord = 3 << Arm64VSizeShift,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ using System.Runtime.CompilerServices;
|
|||
|
||||
namespace ARMeilleure.IntermediateRepresentation
|
||||
{
|
||||
unsafe struct MemoryOperand
|
||||
readonly unsafe struct MemoryOperand
|
||||
{
|
||||
private struct Data
|
||||
{
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // Field is never assigned to
|
||||
public byte Kind;
|
||||
public byte Type;
|
||||
#pragma warning restore CS0649
|
||||
|
@ -18,7 +18,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
public int Displacement;
|
||||
}
|
||||
|
||||
private Data* _data;
|
||||
private readonly Data* _data;
|
||||
|
||||
public MemoryOperand(Operand operand)
|
||||
{
|
||||
|
@ -30,13 +30,13 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
public Operand BaseAddress
|
||||
{
|
||||
get => _data->BaseAddress;
|
||||
set => _data->BaseAddress = value;
|
||||
set => _data->BaseAddress = value;
|
||||
}
|
||||
|
||||
public Operand Index
|
||||
{
|
||||
get => _data->Index;
|
||||
set => _data->Index = value;
|
||||
set => _data->Index = value;
|
||||
}
|
||||
|
||||
public Multiplier Scale
|
||||
|
@ -51,4 +51,4 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
set => _data->Displacement = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,6 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
x2 = 1,
|
||||
x4 = 2,
|
||||
x8 = 3,
|
||||
x16 = 4
|
||||
x16 = 4,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,25 +27,25 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
private Data* _data;
|
||||
|
||||
public OperandKind Kind
|
||||
public readonly OperandKind Kind
|
||||
{
|
||||
get => (OperandKind)_data->Kind;
|
||||
private set => _data->Kind = (byte)value;
|
||||
}
|
||||
|
||||
public OperandType Type
|
||||
public readonly OperandType Type
|
||||
{
|
||||
get => (OperandType)_data->Type;
|
||||
private set => _data->Type = (byte)value;
|
||||
}
|
||||
|
||||
public ulong Value
|
||||
public readonly ulong Value
|
||||
{
|
||||
get => _data->Value;
|
||||
private set => _data->Value = value;
|
||||
}
|
||||
|
||||
public Symbol Symbol
|
||||
public readonly Symbol Symbol
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public ReadOnlySpan<Operation> Assignments
|
||||
public readonly ReadOnlySpan<Operation> Assignments
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -79,7 +79,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public ReadOnlySpan<Operation> Uses
|
||||
public readonly ReadOnlySpan<Operation> Uses
|
||||
{
|
||||
get
|
||||
{
|
||||
|
@ -89,13 +89,13 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public int UsesCount => (int)_data->UsesCount;
|
||||
public int AssignmentsCount => _data->AssignmentsCount;
|
||||
public readonly int UsesCount => (int)_data->UsesCount;
|
||||
public readonly int AssignmentsCount => _data->AssignmentsCount;
|
||||
|
||||
public bool Relocatable => Symbol.Type != SymbolType.None;
|
||||
public readonly bool Relocatable => Symbol.Type != SymbolType.None;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Register GetRegister()
|
||||
public readonly Register GetRegister()
|
||||
{
|
||||
Debug.Assert(Kind == OperandKind.Register);
|
||||
|
||||
|
@ -103,52 +103,52 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public MemoryOperand GetMemory()
|
||||
public readonly MemoryOperand GetMemory()
|
||||
{
|
||||
Debug.Assert(Kind == OperandKind.Memory);
|
||||
|
||||
return new MemoryOperand(this);
|
||||
}
|
||||
|
||||
public int GetLocalNumber()
|
||||
public readonly int GetLocalNumber()
|
||||
{
|
||||
Debug.Assert(Kind == OperandKind.LocalVariable);
|
||||
|
||||
return (int)Value;
|
||||
}
|
||||
|
||||
public byte AsByte()
|
||||
public readonly byte AsByte()
|
||||
{
|
||||
return (byte)Value;
|
||||
}
|
||||
|
||||
public short AsInt16()
|
||||
public readonly short AsInt16()
|
||||
{
|
||||
return (short)Value;
|
||||
}
|
||||
|
||||
public int AsInt32()
|
||||
public readonly int AsInt32()
|
||||
{
|
||||
return (int)Value;
|
||||
}
|
||||
|
||||
public long AsInt64()
|
||||
public readonly long AsInt64()
|
||||
{
|
||||
return (long)Value;
|
||||
}
|
||||
|
||||
public float AsFloat()
|
||||
public readonly float AsFloat()
|
||||
{
|
||||
return BitConverter.Int32BitsToSingle((int)Value);
|
||||
}
|
||||
|
||||
public double AsDouble()
|
||||
public readonly double AsDouble()
|
||||
{
|
||||
return BitConverter.Int64BitsToDouble((long)Value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal ref ulong GetValueUnsafe()
|
||||
internal readonly ref ulong GetValueUnsafe()
|
||||
{
|
||||
return ref _data->Value;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
Value = (ulong)number;
|
||||
}
|
||||
|
||||
public void AddAssignment(Operation operation)
|
||||
public readonly void AddAssignment(Operation operation)
|
||||
{
|
||||
if (Kind == OperandKind.LocalVariable)
|
||||
{
|
||||
|
@ -187,7 +187,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void RemoveAssignment(Operation operation)
|
||||
public readonly void RemoveAssignment(Operation operation)
|
||||
{
|
||||
if (Kind == OperandKind.LocalVariable)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void AddUse(Operation operation)
|
||||
public readonly void AddUse(Operation operation)
|
||||
{
|
||||
if (Kind == OperandKind.LocalVariable)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void RemoveUse(Operation operation)
|
||||
public readonly void RemoveUse(Operation operation)
|
||||
{
|
||||
if (Kind == OperandKind.LocalVariable)
|
||||
{
|
||||
|
@ -259,7 +259,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public Span<Operation> GetUses(ref Span<Operation> buffer)
|
||||
public readonly Span<Operation> GetUses(ref Span<Operation> buffer)
|
||||
{
|
||||
ReadOnlySpan<Operation> uses = Uses;
|
||||
|
||||
|
@ -270,7 +270,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
uses.CopyTo(buffer);
|
||||
|
||||
return buffer.Slice(0, uses.Length);
|
||||
return buffer[..uses.Length];
|
||||
}
|
||||
|
||||
private static void New<T>(ref T* data, ref ushort count, ref ushort capacity, ushort initialCapacity) where T : unmanaged
|
||||
|
@ -360,7 +360,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
{
|
||||
if (i + 1 < count)
|
||||
{
|
||||
span.Slice(i + 1).CopyTo(span.Slice(i));
|
||||
span[(i + 1)..].CopyTo(span[i..]);
|
||||
}
|
||||
|
||||
count--;
|
||||
|
@ -380,7 +380,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
{
|
||||
if (i + 1 < count)
|
||||
{
|
||||
span.Slice(i + 1).CopyTo(span.Slice(i));
|
||||
span[(i + 1)..].CopyTo(span[i..]);
|
||||
}
|
||||
|
||||
count--;
|
||||
|
@ -390,17 +390,17 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return ((ulong)_data).GetHashCode();
|
||||
}
|
||||
|
||||
public bool Equals(Operand operand)
|
||||
public readonly bool Equals(Operand operand)
|
||||
{
|
||||
return operand._data == _data;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is Operand operand && Equals(operand);
|
||||
}
|
||||
|
@ -453,8 +453,10 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
// Look in the next InternTableProbeLength slots for a match.
|
||||
for (uint i = 0; i < InternTableProbeLength; i++)
|
||||
{
|
||||
Operand interned = new();
|
||||
interned._data = &InternTable[(hash + i) % InternTableSize];
|
||||
Operand interned = new()
|
||||
{
|
||||
_data = &InternTable[(hash + i) % InternTableSize],
|
||||
};
|
||||
|
||||
// If slot matches the allocation request then return that slot.
|
||||
if (interned.Kind == kind && interned.Type == type && interned.Value == value && interned.Symbol == symbol)
|
||||
|
@ -479,11 +481,13 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
*data = default;
|
||||
|
||||
Operand result = new();
|
||||
result._data = data;
|
||||
result.Value = value;
|
||||
result.Kind = kind;
|
||||
result.Type = type;
|
||||
Operand result = new()
|
||||
{
|
||||
_data = data,
|
||||
Value = value,
|
||||
Kind = kind,
|
||||
Type = type,
|
||||
};
|
||||
|
||||
if (kind != OperandKind.Memory)
|
||||
{
|
||||
|
@ -591,4 +595,4 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
LocalVariable,
|
||||
Memory,
|
||||
Register,
|
||||
Undefined
|
||||
Undefined,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
I64,
|
||||
FP32,
|
||||
FP64,
|
||||
V128
|
||||
V128,
|
||||
}
|
||||
|
||||
static class OperandTypeExtensions
|
||||
|
@ -22,44 +22,41 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
public static RegisterType ToRegisterType(this OperandType type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case OperandType.FP32: return RegisterType.Vector;
|
||||
case OperandType.FP64: return RegisterType.Vector;
|
||||
case OperandType.I32: return RegisterType.Integer;
|
||||
case OperandType.I64: return RegisterType.Integer;
|
||||
case OperandType.V128: return RegisterType.Vector;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Invalid operand type \"{type}\".");
|
||||
OperandType.FP32 => RegisterType.Vector,
|
||||
OperandType.FP64 => RegisterType.Vector,
|
||||
OperandType.I32 => RegisterType.Integer,
|
||||
OperandType.I64 => RegisterType.Integer,
|
||||
OperandType.V128 => RegisterType.Vector,
|
||||
_ => throw new InvalidOperationException($"Invalid operand type \"{type}\"."),
|
||||
};
|
||||
}
|
||||
|
||||
public static int GetSizeInBytes(this OperandType type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case OperandType.FP32: return 4;
|
||||
case OperandType.FP64: return 8;
|
||||
case OperandType.I32: return 4;
|
||||
case OperandType.I64: return 8;
|
||||
case OperandType.V128: return 16;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Invalid operand type \"{type}\".");
|
||||
OperandType.FP32 => 4,
|
||||
OperandType.FP64 => 8,
|
||||
OperandType.I32 => 4,
|
||||
OperandType.I64 => 8,
|
||||
OperandType.V128 => 16,
|
||||
_ => throw new InvalidOperationException($"Invalid operand type \"{type}\"."),
|
||||
};
|
||||
}
|
||||
|
||||
public static int GetSizeInBytesLog2(this OperandType type)
|
||||
{
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case OperandType.FP32: return 2;
|
||||
case OperandType.FP64: return 3;
|
||||
case OperandType.I32: return 2;
|
||||
case OperandType.I64: return 3;
|
||||
case OperandType.V128: return 4;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Invalid operand type \"{type}\".");
|
||||
OperandType.FP32 => 2,
|
||||
OperandType.FP64 => 3,
|
||||
OperandType.I32 => 2,
|
||||
OperandType.I64 => 3,
|
||||
OperandType.V128 => 4,
|
||||
_ => throw new InvalidOperationException($"Invalid operand type \"{type}\"."),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,60 +20,60 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
|
||||
private Data* _data;
|
||||
|
||||
public Instruction Instruction
|
||||
public readonly Instruction Instruction
|
||||
{
|
||||
get => (Instruction)_data->Instruction;
|
||||
private set => _data->Instruction = (ushort)value;
|
||||
}
|
||||
|
||||
public Intrinsic Intrinsic
|
||||
public readonly Intrinsic Intrinsic
|
||||
{
|
||||
get => (Intrinsic)_data->Intrinsic;
|
||||
private set => _data->Intrinsic = (ushort)value;
|
||||
}
|
||||
|
||||
public Operation ListPrevious
|
||||
public readonly Operation ListPrevious
|
||||
{
|
||||
get => _data->ListPrevious;
|
||||
set => _data->ListPrevious = value;
|
||||
}
|
||||
|
||||
public Operation ListNext
|
||||
public readonly Operation ListNext
|
||||
{
|
||||
get => _data->ListNext;
|
||||
set => _data->ListNext = value;
|
||||
}
|
||||
|
||||
public Operand Destination
|
||||
public readonly Operand Destination
|
||||
{
|
||||
get => _data->DestinationsCount != 0 ? GetDestination(0) : default;
|
||||
set => SetDestination(value);
|
||||
}
|
||||
|
||||
public int DestinationsCount => _data->DestinationsCount;
|
||||
public int SourcesCount => _data->SourcesCount;
|
||||
public readonly int DestinationsCount => _data->DestinationsCount;
|
||||
public readonly int SourcesCount => _data->SourcesCount;
|
||||
|
||||
internal Span<Operand> DestinationsUnsafe => new(_data->Destinations, _data->DestinationsCount);
|
||||
internal Span<Operand> SourcesUnsafe => new(_data->Sources, _data->SourcesCount);
|
||||
internal readonly Span<Operand> DestinationsUnsafe => new(_data->Destinations, _data->DestinationsCount);
|
||||
internal readonly Span<Operand> SourcesUnsafe => new(_data->Sources, _data->SourcesCount);
|
||||
|
||||
public PhiOperation AsPhi()
|
||||
public readonly PhiOperation AsPhi()
|
||||
{
|
||||
Debug.Assert(Instruction == Instruction.Phi);
|
||||
|
||||
return new PhiOperation(this);
|
||||
}
|
||||
|
||||
public Operand GetDestination(int index)
|
||||
public readonly Operand GetDestination(int index)
|
||||
{
|
||||
return DestinationsUnsafe[index];
|
||||
}
|
||||
|
||||
public Operand GetSource(int index)
|
||||
public readonly Operand GetSource(int index)
|
||||
{
|
||||
return SourcesUnsafe[index];
|
||||
}
|
||||
|
||||
public void SetDestination(int index, Operand dest)
|
||||
public readonly void SetDestination(int index, Operand dest)
|
||||
{
|
||||
ref Operand curDest = ref DestinationsUnsafe[index];
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
curDest = dest;
|
||||
}
|
||||
|
||||
public void SetSource(int index, Operand src)
|
||||
public readonly void SetSource(int index, Operand src)
|
||||
{
|
||||
ref Operand curSrc = ref SourcesUnsafe[index];
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
curSrc = src;
|
||||
}
|
||||
|
||||
private void RemoveOldDestinations()
|
||||
private readonly void RemoveOldDestinations()
|
||||
{
|
||||
for (int i = 0; i < _data->DestinationsCount; i++)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void SetDestination(Operand dest)
|
||||
public readonly void SetDestination(Operand dest)
|
||||
{
|
||||
RemoveOldDestinations();
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void SetDestinations(Operand[] dests)
|
||||
public readonly void SetDestinations(Operand[] dests)
|
||||
{
|
||||
RemoveOldDestinations();
|
||||
|
||||
|
@ -135,7 +135,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
private void RemoveOldSources()
|
||||
private readonly void RemoveOldSources()
|
||||
{
|
||||
for (int index = 0; index < _data->SourcesCount; index++)
|
||||
{
|
||||
|
@ -143,7 +143,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void SetSource(Operand src)
|
||||
public readonly void SetSource(Operand src)
|
||||
{
|
||||
RemoveOldSources();
|
||||
|
||||
|
@ -161,7 +161,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public void SetSources(Operand[] srcs)
|
||||
public readonly void SetSources(Operand[] srcs)
|
||||
{
|
||||
RemoveOldSources();
|
||||
|
||||
|
@ -184,7 +184,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
SetSource(source);
|
||||
}
|
||||
|
||||
private void AddAssignment(Operand op)
|
||||
private readonly void AddAssignment(Operand op)
|
||||
{
|
||||
if (op != default)
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
private void RemoveAssignment(Operand op)
|
||||
private readonly void RemoveAssignment(Operand op)
|
||||
{
|
||||
if (op != default)
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
private void AddUse(Operand op)
|
||||
private readonly void AddUse(Operand op)
|
||||
{
|
||||
if (op != default)
|
||||
{
|
||||
|
@ -208,7 +208,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
private void RemoveUse(Operand op)
|
||||
private readonly void RemoveUse(Operand op)
|
||||
{
|
||||
if (op != default)
|
||||
{
|
||||
|
@ -216,17 +216,17 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
|
||||
public bool Equals(Operation operation)
|
||||
public readonly bool Equals(Operation operation)
|
||||
{
|
||||
return operation._data == _data;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is Operation operation && Equals(operation);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine((IntPtr)_data);
|
||||
}
|
||||
|
@ -267,9 +267,11 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
Data* data = Allocators.Operations.Allocate<Data>();
|
||||
*data = default;
|
||||
|
||||
Operation result = new();
|
||||
result._data = data;
|
||||
result.Instruction = inst;
|
||||
Operation result = new()
|
||||
{
|
||||
_data = data,
|
||||
Instruction = inst,
|
||||
};
|
||||
|
||||
EnsureCapacity(ref result._data->Destinations, ref result._data->DestinationsCount, destCount);
|
||||
EnsureCapacity(ref result._data->Sources, ref result._data->SourcesCount, srcCount);
|
||||
|
@ -373,4 +375,4 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
public Register(int index, RegisterType type)
|
||||
{
|
||||
Index = index;
|
||||
Type = type;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
|
@ -37,7 +37,7 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
public bool Equals(Register other)
|
||||
{
|
||||
return other.Index == Index &&
|
||||
other.Type == Type;
|
||||
other.Type == Type;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,6 @@ namespace ARMeilleure.IntermediateRepresentation
|
|||
Integer,
|
||||
Vector,
|
||||
Flag,
|
||||
FpFlag
|
||||
FpFlag,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue