Browse Source

fix

lizzie/inline-dynarmic-spooky
lizzie 2 months ago
parent
commit
1251317114
  1. 17
      src/dynarmic/src/dynarmic/backend/arm64/reg_alloc.cpp
  2. 3
      src/dynarmic/src/dynarmic/backend/arm64/reg_alloc.h

17
src/dynarmic/src/dynarmic/backend/arm64/reg_alloc.cpp

@ -144,7 +144,7 @@ RegAlloc::ArgumentInfo RegAlloc::GetArgumentInfo(IR::Inst* inst) {
} }
bool RegAlloc::WasValueDefined(IR::Inst* inst) const { bool RegAlloc::WasValueDefined(IR::Inst* inst) const {
return defined_insts_count > 0;
return defined_insts.count(inst) > 0;
} }
void RegAlloc::PrepareForCall(std::optional<Argument::copyable_reference> arg0, std::optional<Argument::copyable_reference> arg1, std::optional<Argument::copyable_reference> arg2, std::optional<Argument::copyable_reference> arg3) { void RegAlloc::PrepareForCall(std::optional<Argument::copyable_reference> arg0, std::optional<Argument::copyable_reference> arg1, std::optional<Argument::copyable_reference> arg2, std::optional<Argument::copyable_reference> arg3) {
@ -192,8 +192,7 @@ void RegAlloc::PrepareForCall(std::optional<Argument::copyable_reference> arg0,
} }
void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) { void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) {
++defined_insts_count;
defined_insts.insert(inst);
ASSERT(!ValueLocation(inst)); ASSERT(!ValueLocation(inst));
if (arg.value.IsImmediate()) { if (arg.value.IsImmediate()) {
@ -207,8 +206,7 @@ void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) {
} }
void RegAlloc::DefineAsRegister(IR::Inst* inst, oaknut::Reg reg) { void RegAlloc::DefineAsRegister(IR::Inst* inst, oaknut::Reg reg) {
++defined_insts_count;
defined_insts.insert(inst);
ASSERT(!ValueLocation(inst)); ASSERT(!ValueLocation(inst));
auto& info = reg.is_vector() ? fprs[reg.index()] : gprs[reg.index()]; auto& info = reg.is_vector() ? fprs[reg.index()] : gprs[reg.index()];
ASSERT(info.IsCompletelyEmpty()); ASSERT(info.IsCompletelyEmpty());
@ -374,8 +372,7 @@ int RegAlloc::RealizeReadImpl(const IR::Value& value) {
template<HostLoc::Kind kind> template<HostLoc::Kind kind>
int RegAlloc::RealizeWriteImpl(const IR::Inst* value) { int RegAlloc::RealizeWriteImpl(const IR::Inst* value) {
++defined_insts_count;
defined_insts.insert(inst);
ASSERT(!ValueLocation(value)); ASSERT(!ValueLocation(value));
if constexpr (kind == HostLoc::Kind::Gpr) { if constexpr (kind == HostLoc::Kind::Gpr) {
@ -399,8 +396,7 @@ int RegAlloc::RealizeWriteImpl(const IR::Inst* value) {
template<HostLoc::Kind kind> template<HostLoc::Kind kind>
int RegAlloc::RealizeReadWriteImpl(const IR::Value& read_value, const IR::Inst* write_value) { int RegAlloc::RealizeReadWriteImpl(const IR::Value& read_value, const IR::Inst* write_value) {
++defined_insts_count;
defined_insts.insert(inst);
// TODO: Move elimination // TODO: Move elimination
const int write_loc = RealizeWriteImpl<kind>(write_value); const int write_loc = RealizeWriteImpl<kind>(write_value);
@ -463,8 +459,7 @@ void RegAlloc::SpillFpr(int index) {
} }
void RegAlloc::ReadWriteFlags(Argument& read, IR::Inst* write) { void RegAlloc::ReadWriteFlags(Argument& read, IR::Inst* write) {
++defined_insts_count;
defined_insts.insert(inst);
const auto current_location = ValueLocation(read.value.GetInst()); const auto current_location = ValueLocation(read.value.GetInst());
ASSERT(current_location); ASSERT(current_location);

3
src/dynarmic/src/dynarmic/backend/arm64/reg_alloc.h

@ -332,8 +332,7 @@ private:
std::array<HostLocInfo, SpillCount> spills; std::array<HostLocInfo, SpillCount> spills;
mutable std::mt19937 rand_gen; mutable std::mt19937 rand_gen;
size_t defined_insts_count = 0;
ankerl::unordered_dense::set<const IR::Inst*> defined_insts;
}; };
template<typename T> template<typename T>

Loading…
Cancel
Save