Jlm
Loading...
Searching...
No Matches
TestOperations.cpp
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
7
8namespace jlm::rvsdg
9{
10
12
13bool
15{
16 auto op = dynamic_cast<const TestUnaryOperation *>(&other);
17 return op && op->argument(0) == argument(0) && op->result(0) == result(0);
18}
19
20std::string
22{
23 return "TestUnaryOperation";
24}
25
26std::unique_ptr<Operation>
28{
29 return std::make_unique<TestUnaryOperation>(*this);
30}
31
33
34bool
36{
37 auto op = dynamic_cast<const TestBinaryOperation *>(&other);
38 return op && op->argument(0) == argument(0) && op->result(0) == result(0);
39}
40
43{
45}
46
47Output *
52
58
59std::string
61{
62 return "TestBinaryOperation";
63}
64
65std::unique_ptr<Operation>
67{
68 return std::make_unique<TestBinaryOperation>(*this);
69}
70
72
73bool
75{
76 const auto testOperation = dynamic_cast<const TestOperation *>(&other);
77 if (!testOperation)
78 return false;
79
80 if (narguments() != testOperation->narguments() || nresults() != testOperation->nresults())
81 return false;
82
83 for (size_t n = 0; n < narguments(); n++)
84 {
85 if (argument(n) != testOperation->argument(n))
86 return false;
87 }
88
89 for (size_t n = 0; n < nresults(); n++)
90 {
91 if (result(n) != testOperation->result(n))
92 return false;
93 }
94
95 return true;
96}
97
98std::string
100{
101 return "TestOperation";
102}
103
104std::unique_ptr<Operation>
106{
107 return std::make_unique<TestOperation>(*this);
108}
109
110}
const std::shared_ptr< const rvsdg::Type > & argument(size_t index) const noexcept
Definition operation.cpp:23
binop_reduction_path_t can_reduce_operand_pair(const Output *op1, const Output *op2) const noexcept override
~TestBinaryOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Output * reduce_operand_pair(binop_reduction_path_t path, Output *op1, Output *op2) const override
enum BinaryOperation::flags flags_
enum BinaryOperation::flags flags() const noexcept override
std::string debug_string() const override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
~TestOperation() noexcept override
~TestUnaryOperation() noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
size_t binop_reduction_path_t
Definition binary.hpp:19
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
Definition node.hpp:872
static const binop_reduction_path_t binop_reduction_none
Definition binary.hpp:203