// 当前仅支持 void、i32 和 i32*。 #include "ir/IR.h" namespace ir { Type::Type(Kind k) : kind_(k) {} const std::shared_ptr& Type::GetVoidType() { static const std::shared_ptr type = std::make_shared(Kind::Void); return type; } const std::shared_ptr& Type::GetInt32Type() { static const std::shared_ptr type = std::make_shared(Kind::Int32); return type; } const std::shared_ptr& Type::GetPtrInt32Type() { static const std::shared_ptr type = std::make_shared(Kind::PtrInt32); return type; } Type::Kind Type::GetKind() const { return kind_; } bool Type::IsVoid() const { return kind_ == Kind::Void; } bool Type::IsInt32() const { return kind_ == Kind::Int32; } bool Type::IsPtrInt32() const { return kind_ == Kind::PtrInt32; } } // namespace ir