feat: first prototype of optimizers + alloca optimizer
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "prelude/string.hpp"
|
||||
|
||||
namespace IR
|
||||
@@ -104,8 +105,8 @@ namespace IR
|
||||
class Pointer : public ValueHandle
|
||||
{
|
||||
public:
|
||||
Pointer(unsigned int id)
|
||||
: ValueHandle(id)
|
||||
Pointer(unsigned int id, const Type* value_typ)
|
||||
: ValueHandle(id), m_value_typ(new Type(value_typ))
|
||||
{
|
||||
m_type = new Type{Type::Kind::Ptr};
|
||||
}
|
||||
@@ -120,16 +121,19 @@ namespace IR
|
||||
return sb.view();
|
||||
}
|
||||
|
||||
public:
|
||||
const Type *GetValueType() const { return m_value_typ; }
|
||||
|
||||
private:
|
||||
Type *m_type;
|
||||
Type *m_value_typ;
|
||||
};
|
||||
|
||||
// TODO: Remove void value and use void type only
|
||||
class Void : public ValueHandle
|
||||
{
|
||||
public:
|
||||
Void(unsigned int id)
|
||||
: ValueHandle(id)
|
||||
Void()
|
||||
: ValueHandle()
|
||||
{
|
||||
m_type = new Type{Type::Kind::Void};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user