From 5a864f41c6ed8975c3ebb9ace0ee4a019c40da6d Mon Sep 17 00:00:00 2001 From: Merry Date: Sat, 23 Jul 2022 17:58:36 +0100 Subject: [PATCH] backend/arm64/reg_alloc: Implement DefineAsRegister --- src/dynarmic/backend/arm64/reg_alloc.cpp | 8 ++++++++ src/dynarmic/backend/arm64/reg_alloc.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/dynarmic/backend/arm64/reg_alloc.cpp b/src/dynarmic/backend/arm64/reg_alloc.cpp index a8e25501..2d01abea 100644 --- a/src/dynarmic/backend/arm64/reg_alloc.cpp +++ b/src/dynarmic/backend/arm64/reg_alloc.cpp @@ -141,11 +141,19 @@ bool RegAlloc::IsValueLive(IR::Inst* inst) const { } void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) { + ASSERT(!ValueLocation(inst)); auto& info = ValueInfo(arg.value.GetInst()); info.values.emplace_back(inst); info.expected_uses += inst->UseCount(); } +void RegAlloc::DefineAsRegister(IR::Inst* inst, oaknut::Reg reg) { + ASSERT(!ValueLocation(inst)); + auto& info = reg.is_vector() ? fprs[reg.index()] : gprs[reg.index()]; + ASSERT(info.IsCompletelyEmpty()); + info.SetupLocation(inst); +} + void RegAlloc::AssertNoMoreUses() const { const auto is_empty = [](const auto& i) { return i.IsCompletelyEmpty(); }; ASSERT(std::all_of(gprs.begin(), gprs.end(), is_empty)); diff --git a/src/dynarmic/backend/arm64/reg_alloc.h b/src/dynarmic/backend/arm64/reg_alloc.h index 22bcd111..bd79f6d7 100644 --- a/src/dynarmic/backend/arm64/reg_alloc.h +++ b/src/dynarmic/backend/arm64/reg_alloc.h @@ -218,6 +218,7 @@ public: } void DefineAsExisting(IR::Inst* inst, Argument& arg); + void DefineAsRegister(IR::Inst* inst, oaknut::Reg reg); void ReadWriteFlags(Argument& read, IR::Inst* write); void SpillFlags();