backend/rv64: Implement Identity
This commit is contained in:
parent
1de237bf24
commit
b485553ed8
3 changed files with 22 additions and 1 deletions
|
@ -23,12 +23,18 @@ namespace Dynarmic::Backend::RV64 {
|
||||||
|
|
||||||
template<IR::Opcode op>
|
template<IR::Opcode op>
|
||||||
void EmitIR(biscuit::Assembler&, EmitContext&, IR::Inst*) {
|
void EmitIR(biscuit::Assembler&, EmitContext&, IR::Inst*) {
|
||||||
ASSERT_FALSE("Unimplemented opcode {}", op);
|
ASSERT_FALSE("Unimplemented opcode {} ", op);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::Void>(biscuit::Assembler&, EmitContext&, IR::Inst*) {}
|
void EmitIR<IR::Opcode::Void>(biscuit::Assembler&, EmitContext&, IR::Inst*) {}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
void EmitIR<IR::Opcode::Identity>(biscuit::Assembler&, EmitContext& ctx, IR::Inst* inst) {
|
||||||
|
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
||||||
|
ctx.reg_alloc.DefineAsExisting(inst, args[0]);
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void EmitIR<IR::Opcode::A32GetRegister>(biscuit::Assembler& as, EmitContext& ctx, IR::Inst* inst);
|
void EmitIR<IR::Opcode::A32GetRegister>(biscuit::Assembler& as, EmitContext& ctx, IR::Inst* inst);
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -125,6 +125,19 @@ void RegAlloc::UpdateAllUses() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RegAlloc::DefineAsExisting(IR::Inst* inst, Argument& arg) {
|
||||||
|
ASSERT(!ValueLocation(inst));
|
||||||
|
|
||||||
|
if (arg.value.IsImmediate()) {
|
||||||
|
inst->ReplaceUsesWith(arg.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& info = ValueInfo(arg.value.GetInst());
|
||||||
|
info.values.emplace_back(inst);
|
||||||
|
info.expected_uses += inst->UseCount();
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
|
@ -118,6 +118,8 @@ public:
|
||||||
auto WriteX(IR::Inst* inst) { return RAReg<biscuit::GPR>{*this, true, IR::Value{inst}}; }
|
auto WriteX(IR::Inst* inst) { return RAReg<biscuit::GPR>{*this, true, IR::Value{inst}}; }
|
||||||
auto WriteD(IR::Inst* inst) { return RAReg<biscuit::FPR>{*this, true, IR::Value{inst}}; }
|
auto WriteD(IR::Inst* inst) { return RAReg<biscuit::FPR>{*this, true, IR::Value{inst}}; }
|
||||||
|
|
||||||
|
void DefineAsExisting(IR::Inst* inst, Argument& arg);
|
||||||
|
|
||||||
void SpillAll();
|
void SpillAll();
|
||||||
|
|
||||||
template<typename... Ts>
|
template<typename... Ts>
|
||||||
|
|
Loading…
Reference in a new issue