feat: move allocator and slots into codegen folder

This commit is contained in:
2026-01-01 16:09:33 +01:00
parent 7995dd2bdf
commit ad17a59d65
2 changed files with 11 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
#pragma once
#include "prelude/string.hpp"
#include "ir/slot.hpp"
#include "codegen/slot.hpp"
#define AVAILABLE_REGISTERS 4
#define AVAILABLE_STACK_SIZE 4096
@@ -10,6 +10,7 @@ class Allocator
{
public:
virtual ~Allocator() {};
public:
virtual const Slot &Allocate(SlotAddr addr) = 0;
virtual const Slot &Resolve(SlotAddr addr) = 0;
@@ -20,6 +21,7 @@ class SlotAllocator : public Allocator<IR::IRSlot>
public:
SlotAllocator() = default;
~SlotAllocator() = default;
public:
const IR::IRSlot &Allocate(const StringView &addr) override
{
@@ -50,10 +52,13 @@ public:
assert(0 && "could not resolve stack offset for specified address");
}
public:
View<IR::IRSlot> slots() const { return m_slots.view(); }
public:
unsigned int GetStackSize() const { return m_offset_counter; }
public:
int m_regs = 0;
unsigned int m_offset_counter = 0;