feat: implement proper IR with value handles with dynamic and transferable types
This commit is contained in:
@@ -10,9 +10,9 @@ public:
|
||||
~StackFasmX86_64Generator() override = default;
|
||||
|
||||
private:
|
||||
StringView GetTempAddr(IR::Value reg)
|
||||
StringView GetTempAddr(IR::ValueHandle *reg)
|
||||
{
|
||||
return std::move((StringBuilder() << reg.Format()).view());
|
||||
return std::move((StringBuilder() << reg->Format()).view());
|
||||
}
|
||||
|
||||
StringView GetSlotAddr(const IR::IRSlot &slot)
|
||||
@@ -101,18 +101,17 @@ private:
|
||||
appendf("mov %s, rax\n", GetSlotAddr(result_slot).c_str());
|
||||
}
|
||||
break;
|
||||
case IR::OpType::LOAD_CONST:
|
||||
{
|
||||
auto lc = reinterpret_cast<const IR::LoadConstOp *>(op);
|
||||
auto addr = GetTempAddr(lc->result());
|
||||
auto slot = m_allocator->Allocate(addr);
|
||||
appendf("mov %s, %ld\n", GetSlotAddr(slot).c_str(), lc->value());
|
||||
}
|
||||
break;
|
||||
// case IR::OpType::LOAD_CONST:
|
||||
// {
|
||||
// auto lc = reinterpret_cast<const IR::LoadConstOp *>(op);
|
||||
// auto addr = GetTempAddr(lc->result());
|
||||
// auto slot = m_allocator->Allocate(addr);
|
||||
// appendf("mov %s, %ld\n", GetSlotAddr(slot).c_str(), lc->value());
|
||||
// }
|
||||
// break;
|
||||
case IR::OpType::STORE:
|
||||
{
|
||||
auto s = reinterpret_cast<const IR::StoreOp *>(op);
|
||||
appendf("; DEBUG: resolving stack slot at %s\n", s->addr().c_str());
|
||||
auto slot = m_allocator->Allocate(s->addr());
|
||||
auto value_slot = m_allocator->Resolve(GetTempAddr(s->src()));
|
||||
appendf("mov rax, %s\n", GetSlotAddr(value_slot).c_str());
|
||||
|
||||
Reference in New Issue
Block a user