Jlm
constant.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2013 2014 Helge Bahmann <hcb@chaoticmind.net>
3  * Copyright 2011 2012 2013 2014 Nico Reißmann <nico.reissmann@gmail.com>
4  * See COPYING for terms of redistribution.
5  */
6 
7 #ifndef JLM_RVSDG_BITSTRING_CONSTANT_HPP
8 #define JLM_RVSDG_BITSTRING_CONSTANT_HPP
9 
12 #include <jlm/rvsdg/node.hpp>
13 #include <jlm/rvsdg/nullary.hpp>
15 
16 #include <vector>
17 
18 namespace jlm::rvsdg
19 {
20 
22 {
23 public:
24  ~BitConstantOperation() noexcept override;
25 
27 
28  bool
29  operator==(const Operation & other) const noexcept override;
30 
31  std::string
32  debug_string() const override;
33 
34  [[nodiscard]] std::unique_ptr<Operation>
35  copy() const override;
36 
37  [[nodiscard]] const BitValueRepresentation &
38  value() const noexcept
39  {
40  return value_;
41  }
42 
43  static Output &
45  {
46  return *CreateOpNode<BitConstantOperation>(region, std::move(value)).output(0);
47  }
48 
49  static Output &
50  createUndefined(Region & region, const size_t numBits)
51  {
52  const std::string s(numBits, 'X');
53  return create(region, BitValueRepresentation(s.c_str()));
54  }
55 
56 private:
58 };
59 
60 }
61 
62 #endif
const BitValueRepresentation & value() const noexcept
Definition: constant.hpp:38
std::unique_ptr< Operation > copy() const override
Definition: constant.cpp:36
std::string debug_string() const override
Definition: constant.cpp:27
static Output & createUndefined(Region &region, const size_t numBits)
Definition: constant.hpp:50
static Output & create(Region &region, BitValueRepresentation value)
Definition: constant.hpp:44
~BitConstantOperation() noexcept override
BitValueRepresentation value_
Definition: constant.hpp:57
Nullary operator (operator taking no formal arguments)
Definition: nullary.hpp:22
Represent acyclic RVSDG subgraphs.
Definition: region.hpp:213