From 61d79facd1740264dadb6c62a0af21179bf6672b Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 9 Mar 2020 19:29:34 -0300 Subject: Optimize x64 loads and stores using complex addressing modes (#972) * Optimize x64 loads and stores using complex addressing modes * This was meant to be used for testing --- .../RegisterAllocators/LinearScanAllocator.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs') diff --git a/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs b/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs index 1127ccd5..1dc6ad73 100644 --- a/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs +++ b/ARMeilleure/CodeGen/RegisterAllocators/LinearScanAllocator.cs @@ -711,6 +711,20 @@ namespace ARMeilleure.CodeGen.RegisterAllocators { operation.SetSource(index, register); } + else if (source.Kind == OperandKind.Memory) + { + MemoryOperand memOp = (MemoryOperand)source; + + if (memOp.BaseAddress == current.Local) + { + memOp.BaseAddress = register; + } + + if (memOp.Index == current.Local) + { + memOp.Index = register; + } + } } for (int index = 0; index < operation.DestinationsCount; index++) @@ -1011,6 +1025,20 @@ namespace ARMeilleure.CodeGen.RegisterAllocators { yield return source; } + else if (source.Kind == OperandKind.Memory) + { + MemoryOperand memOp = (MemoryOperand)source; + + if (memOp.BaseAddress != null) + { + yield return memOp.BaseAddress; + } + + if (memOp.Index != null) + { + yield return memOp.Index; + } + } } } -- cgit v1.2.3