first codegen prototype
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
|
||||
// TODO: store all of values, allocated registers, stack offsets in single allocator
|
||||
// to be able to find out which kind a specific temp register represent
|
||||
|
||||
#pragma once
|
||||
#include <cstddef>
|
||||
#include <cstdarg>
|
||||
#include "ir/op.hpp"
|
||||
#include "prelude/string.hpp"
|
||||
#include "ir/ir.hpp"
|
||||
|
||||
class CodeGenerator
|
||||
{
|
||||
public:
|
||||
virtual ~CodeGenerator() {};
|
||||
CodeGenerator() = default;
|
||||
virtual ~CodeGenerator() {}
|
||||
|
||||
virtual void Generate(const char* filename, View<IR::Op*> ops) = 0;
|
||||
public:
|
||||
virtual bool Generate(const IR::OpView* ops) = 0;
|
||||
StringView GetOutput() { return output().view(); }
|
||||
|
||||
protected:
|
||||
StringBuilder& output() { return m_output; }
|
||||
|
||||
private:
|
||||
StringBuilder m_output;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user