backend/arm64/reg_alloc: Implement DefineAsRegister

This commit is contained in:
Merry 2022-07-23 17:58:36 +01:00 committed by merry
parent 16701ae6d5
commit 5a864f41c6
2 changed files with 9 additions and 0 deletions

View file

@ -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));

View file

@ -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();