Jlm
TestNodes.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2025 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
6 #ifndef JLM_RVSDG_TESTNODES_HPP
7 #define JLM_RVSDG_TESTNODES_HPP
8 
11 
12 namespace jlm::rvsdg
13 {
14 
16 {
17 public:
18  ~TestStructuralOperation() noexcept override;
19 
20  [[nodiscard]] std::string
21  debug_string() const override;
22 
23  [[nodiscard]] std::unique_ptr<Operation>
24  copy() const override;
25 };
26 
27 class TestStructuralNode final : public StructuralNode
28 {
29 public:
30  ~TestStructuralNode() noexcept override;
31 
32 private:
33  TestStructuralNode(Region * parent, size_t numSubregions)
34  : StructuralNode(parent, numSubregions)
35  {}
36 
37 public:
41  struct InputVar
42  {
43  StructuralInput * input{};
44  std::vector<RegionArgument *> argument{};
45  };
46 
50  struct OutputVar
51  {
52  StructuralOutput * output{};
53  std::vector<RegionResult *> result{};
54  };
55 
63  addInputOnly(Output & origin);
64 
71  InputVar
72  addInputWithArguments(Output & origin);
73 
80  void
81  removeInputAndArguments(size_t index);
82 
88  InputVar
89  addArguments(const std::shared_ptr<const Type> & type);
90 
98  addOutputOnly(std::shared_ptr<const Type> type);
99 
106  OutputVar
107  addOutputWithResults(const std::vector<Output *> & origins);
108 
114  void
115  removeOutputAndResults(size_t index);
116 
123  OutputVar
124  addResults(const std::vector<Output *> & origins);
125 
134  InputVar
135  mapInput(const Input & input) const;
136 
145  OutputVar
146  mapOutput(const Output & output) const;
147 
148  [[nodiscard]] const TestStructuralOperation &
149  GetOperation() const noexcept override;
150 
151  static TestStructuralNode *
152  create(Region * parent, const size_t numSubregions)
153  {
154  return new TestStructuralNode(parent, numSubregions);
155  }
156 
158  copy(Region * region, SubstitutionMap & smap) const override;
159 };
160 
161 }
162 
163 #endif
Represent acyclic RVSDG subgraphs.
Definition: region.hpp:213
~TestStructuralNode() noexcept override
std::string debug_string() const override
Definition: TestNodes.cpp:15
std::unique_ptr< Operation > copy() const override
Definition: TestNodes.cpp:21
~TestStructuralOperation() noexcept override
static std::string type(const Node *n)
Definition: view.cpp:255
A variable routed in a TestStructuralNode.
Definition: TestNodes.hpp:42
A variable routed out of a TestStructuralNode.
Definition: TestNodes.hpp:51