From 0afa8f2c14f046b46ac5ba14c96f3a5ce523ba16 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 19 Jun 2024 09:39:29 -0300 Subject: JIT: Coalesce copies on LSRA with simple register preferencing (#6950) * JIT: Coalesce copies on LSRA with simple register preferencing * PPTC version bump --- .../CodeGen/RegisterAllocators/LiveInterval.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/ARMeilleure/CodeGen/RegisterAllocators/LiveInterval.cs') diff --git a/src/ARMeilleure/CodeGen/RegisterAllocators/LiveInterval.cs b/src/ARMeilleure/CodeGen/RegisterAllocators/LiveInterval.cs index 333d3951..cfe1bc7c 100644 --- a/src/ARMeilleure/CodeGen/RegisterAllocators/LiveInterval.cs +++ b/src/ARMeilleure/CodeGen/RegisterAllocators/LiveInterval.cs @@ -19,6 +19,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators public LiveRange CurrRange; public LiveInterval Parent; + public LiveInterval CopySource; public UseList Uses; public LiveIntervalList Children; @@ -37,6 +38,7 @@ namespace ARMeilleure.CodeGen.RegisterAllocators private ref LiveRange CurrRange => ref _data->CurrRange; private ref LiveRange PrevRange => ref _data->PrevRange; private ref LiveInterval Parent => ref _data->Parent; + private ref LiveInterval CopySource => ref _data->CopySource; private ref UseList Uses => ref _data->Uses; private ref LiveIntervalList Children => ref _data->Children; @@ -78,6 +80,25 @@ namespace ARMeilleure.CodeGen.RegisterAllocators Register = register; } + public void SetCopySource(LiveInterval copySource) + { + CopySource = copySource; + } + + public bool TryGetCopySourceRegister(out int copySourceRegIndex) + { + if (CopySource._data != null) + { + copySourceRegIndex = CopySource.Register.Index; + + return true; + } + + copySourceRegIndex = 0; + + return false; + } + public void Reset() { PrevRange = default; -- cgit v1.2.3