Jlm
type.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011 2012 2013 2014 2015 Nico Reißmann <nico.reissmann@gmail.com>
3  * Copyright 2014 Helge Bahmann <hcb@chaoticmind.net>
4  * See COPYING for terms of redistribution.
5  */
6 
7 #ifndef JLM_RVSDG_BITSTRING_TYPE_HPP
8 #define JLM_RVSDG_BITSTRING_TYPE_HPP
9 
10 #include <jlm/rvsdg/type.hpp>
11 #include <jlm/util/common.hpp>
12 
13 namespace jlm::rvsdg
14 {
15 
16 class BitType final : public Type
17 {
18 public:
19  ~BitType() noexcept override;
20 
21  explicit constexpr BitType(const size_t nbits)
22  : nbits_(nbits)
23  {}
24 
25  inline size_t
26  nbits() const noexcept
27  {
28  return nbits_;
29  }
30 
31  [[nodiscard]] std::string
32  debug_string() const override;
33 
34  bool
35  operator==(const jlm::rvsdg::Type & other) const noexcept override;
36 
37  [[nodiscard]] std::size_t
38  ComputeHash() const noexcept override;
39 
40  TypeKind
41  Kind() const noexcept override;
42 
56  static std::shared_ptr<const BitType>
57  Create(std::size_t nbits);
58 
59 private:
60  size_t nbits_;
61 };
62 
63 }
64 
65 #endif
bool operator==(const jlm::rvsdg::Type &other) const noexcept override
Definition: type.cpp:24
static std::shared_ptr< const BitType > Create(std::size_t nbits)
Creates bit type of specified width.
Definition: type.cpp:45
TypeKind Kind() const noexcept override
Return the kind of this type.
Definition: type.cpp:39
size_t nbits() const noexcept
Definition: type.hpp:26
std::size_t ComputeHash() const noexcept override
Definition: type.cpp:31
~BitType() noexcept override
std::string debug_string() const override
Definition: type.cpp:18
TypeKind
The kinds of types supported in rvsdg.
Definition: type.hpp:22