Jlm
UnitType.cpp
Go to the documentation of this file.
1 #include <jlm/rvsdg/UnitType.hpp>
2 
3 namespace jlm::rvsdg
4 {
5 
6 UnitType::~UnitType() noexcept = default;
7 
8 std::string
9 UnitType::debug_string() const
10 {
11  return "Unit";
12 }
13 
14 bool
15 UnitType::operator==(const Type & other) const noexcept
16 {
17  return dynamic_cast<const UnitType *>(&other) != nullptr;
18 }
19 
20 std::size_t
21 UnitType::ComputeHash() const noexcept
22 {
23  return typeid(UnitType).hash_code();
24 }
25 
27 UnitType::Kind() const noexcept
28 {
29  return TypeKind::Value;
30 }
31 
32 std::shared_ptr<const UnitType>
34 {
35  static const UnitType instance;
36  return std::shared_ptr<const UnitType>(std::shared_ptr<void>(), &instance);
37 }
38 
39 }
Unit type (type carrying no information)
Definition: UnitType.hpp:24
~UnitType() noexcept override
std::size_t ComputeHash() const noexcept override
Definition: UnitType.cpp:21
TypeKind Kind() const noexcept override
Return the kind of this type.
Definition: UnitType.cpp:27
bool operator==(const Type &other) const noexcept override
Definition: UnitType.cpp:15
static std::shared_ptr< const UnitType > Create()
Definition: UnitType.cpp:33
TypeKind
The kinds of types supported in rvsdg.
Definition: type.hpp:22
@ Value
Designate a value type.