feat: abstract value for IR

This commit is contained in:
2025-12-24 18:59:44 +01:00
parent e5d912b28e
commit e8a496d070
3 changed files with 65 additions and 42 deletions

26
include/ir/value.hpp Normal file
View File

@@ -0,0 +1,26 @@
#pragma once
#include "prelude/string.hpp"
namespace IR
{
class Value
{
public:
Value(unsigned int id) : m_id(id) {}
Value() : m_id(0) {}
public:
StringView Format() const
{
auto sb = StringBuilder();
sb.AppendFormat("%%%d", m_id);
return sb.view();
}
private:
unsigned int m_id;
};
using ValueView = View<Value>;
using ValueBuilder = Builder<Value>;
} // namespace IR