backend/arm64/reg_alloc: Implement DefineAsRegister
This commit is contained in:
parent
16701ae6d5
commit
5a864f41c6
2 changed files with 9 additions and 0 deletions
|
@ -141,11 +141,19 @@ bool RegAlloc::IsValueLive(IR::Inst* inst) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) {
|
void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) {
|
||||||
|
ASSERT(!ValueLocation(inst));
|
||||||
auto& info = ValueInfo(arg.value.GetInst());
|
auto& info = ValueInfo(arg.value.GetInst());
|
||||||
info.values.emplace_back(inst);
|
info.values.emplace_back(inst);
|
||||||
info.expected_uses += inst->UseCount();
|
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 {
|
void RegAlloc::AssertNoMoreUses() const {
|
||||||
const auto is_empty = [](const auto& i) { return i.IsCompletelyEmpty(); };
|
const auto is_empty = [](const auto& i) { return i.IsCompletelyEmpty(); };
|
||||||
ASSERT(std::all_of(gprs.begin(), gprs.end(), is_empty));
|
ASSERT(std::all_of(gprs.begin(), gprs.end(), is_empty));
|
||||||
|
|
|
@ -218,6 +218,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefineAsExisting(IR::Inst* inst, Argument& arg);
|
void DefineAsExisting(IR::Inst* inst, Argument& arg);
|
||||||
|
void DefineAsRegister(IR::Inst* inst, oaknut::Reg reg);
|
||||||
|
|
||||||
void ReadWriteFlags(Argument& read, IR::Inst* write);
|
void ReadWriteFlags(Argument& read, IR::Inst* write);
|
||||||
void SpillFlags();
|
void SpillFlags();
|
||||||
|
|
Loading…
Reference in a new issue