feat: abstract value for IR
This commit is contained in:
26
include/ir/value.hpp
Normal file
26
include/ir/value.hpp
Normal 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
|
||||
Reference in New Issue
Block a user