6 #ifndef JLM_RVSDG_TESTOPERATIONS_HPP
7 #define JLM_RVSDG_TESTOPERATIONS_HPP
27 return nullaryOperation && *
result(0) == *nullaryOperation->result(0);
30 [[nodiscard]] std::string
33 return "NullaryOperation";
36 [[nodiscard]] std::unique_ptr<Operation>
39 return std::make_unique<TestNullaryOperation>(this->
result(0));
49 std::shared_ptr<const
Type> operandType,
50 std::shared_ptr<const
Type> resultType) noexcept
63 [[nodiscard]] std::string
66 [[nodiscard]] std::unique_ptr<Operation>
67 copy()
const override;
72 std::shared_ptr<const Type> operandType,
74 std::shared_ptr<const Type> resultType)
76 return &rvsdg::CreateOpNode<TestUnaryOperation>(
78 std::move(operandType),
79 std::move(resultType));
84 std::shared_ptr<const Type> operandType,
86 std::shared_ptr<const Type> resultType)
88 return rvsdg::CreateOpNode<TestUnaryOperation>(
90 std::move(operandType),
91 std::move(resultType))
102 const std::shared_ptr<const
Type> & operandType,
103 std::shared_ptr<const
Type> resultType,
105 :
BinaryOperation({ operandType, operandType }, std::move(resultType)),
110 operator==(
const Operation & other)
const noexcept
override;
119 flags() const noexcept override;
121 [[nodiscard]] std::
string
124 [[nodiscard]] std::unique_ptr<Operation>
125 copy() const override;
129 const std::shared_ptr<const
Type> & operandType,
130 std::shared_ptr<const
Type> resultType,
134 return &rvsdg::CreateOpNode<TestBinaryOperation>(
137 std::move(resultType),
143 const std::shared_ptr<const Type> operandType,
144 std::shared_ptr<const Type> resultType,
148 return rvsdg::CreateOpNode<TestBinaryOperation>(
151 std::move(resultType),
166 std::vector<std::shared_ptr<const
Type>> operandTypes,
167 std::vector<std::shared_ptr<const
Type>> resultTypes)
176 [[nodiscard]] std::string
179 [[nodiscard]] std::unique_ptr<Operation>
180 copy()
const override;
182 static std::unique_ptr<TestOperation>
184 std::vector<std::shared_ptr<const Type>> operandTypes,
185 std::vector<std::shared_ptr<const Type>> resultTypes)
187 return std::make_unique<TestOperation>(std::move(operandTypes), std::move(resultTypes));
193 const std::vector<Output *> &
operands,
194 std::vector<std::shared_ptr<const Type>> resultTypes)
196 std::vector<std::shared_ptr<const Type>> operandTypes;
197 for (
const auto & operand :
operands)
198 operandTypes.push_back(operand->Type());
206 std::vector<std::shared_ptr<const Type>> operandTypes,
207 const std::vector<rvsdg::Output *> &
operands,
208 std::vector<std::shared_ptr<const Type>> resultTypes)
210 return operands.empty() ? &rvsdg::CreateOpNode<TestOperation>(
212 std::move(operandTypes),
213 std::move(resultTypes))
214 : &rvsdg::CreateOpNode<TestOperation>(
216 std::move(operandTypes),
217 std::move(resultTypes));
Nullary operator (operator taking no formal arguments)
Represent acyclic RVSDG subgraphs.
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
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
bool operator==(const Operation &other) const noexcept override
static Output * create_normalized(const std::shared_ptr< const Type > operandType, std::shared_ptr< const Type > resultType, Output *op1, Output *op2)
static Node * create(const std::shared_ptr< const Type > &operandType, std::shared_ptr< const Type > resultType, Output *op1, Output *op2)
enum BinaryOperation::flags flags_
Output * reduce_operand_pair(unop_reduction_path_t path, Output *op1, Output *op2) const override
enum BinaryOperation::flags flags() const noexcept override
std::string debug_string() const override
bool operator==(const Operation &other) const noexcept override
std::unique_ptr< Operation > copy() const override
TestNullaryOperation(const std::shared_ptr< const Type > &resultType)
std::string debug_string() const override
static std::unique_ptr< TestOperation > create(std::vector< std::shared_ptr< const Type >> operandTypes, std::vector< std::shared_ptr< const Type >> resultTypes)
static SimpleNode * createNode(Region *region, const std::vector< Output * > &operands, std::vector< std::shared_ptr< const Type >> resultTypes)
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
~TestOperation() noexcept override
TestOperation(const TestOperation &)=default
bool operator==(const Operation &other) const noexcept override
static SimpleNode * createNode(Region *region, std::vector< std::shared_ptr< const Type >> operandTypes, const std::vector< rvsdg::Output * > &operands, std::vector< std::shared_ptr< const Type >> resultTypes)
~TestUnaryOperation() noexcept override
bool operator==(const Operation &other) const noexcept override
static Node * create(Region *, std::shared_ptr< const Type > operandType, Output *operand, std::shared_ptr< const Type > resultType)
std::unique_ptr< Operation > copy() const override
Output * reduce_operand(unop_reduction_path_t path, Output *operand) const override
std::string debug_string() const override
unop_reduction_path_t can_reduce_operand(const Output *operand) const noexcept override
static Output * create_normalized(std::shared_ptr< const Type > operandType, Output *operand, std::shared_ptr< const Type > resultType)
size_t unop_reduction_path_t
size_t binop_reduction_path_t
static std::vector< jlm::rvsdg::Output * > operands(const Node *node)