12template<
typename TBinOp>
16 static_assert(std::is_base_of_v<IntegerBinaryOperation, TBinOp>);
18 if constexpr (std::is_same_v<TBinOp, IntegerEqOperation>)
20 else if constexpr (std::is_same_v<TBinOp, IntegerNeOperation>)
22 else if constexpr (std::is_same_v<TBinOp, IntegerSgeOperation>)
24 else if constexpr (std::is_same_v<TBinOp, IntegerSgtOperation>)
26 else if constexpr (std::is_same_v<TBinOp, IntegerSleOperation>)
28 else if constexpr (std::is_same_v<TBinOp, IntegerSltOperation>)
30 else if constexpr (std::is_same_v<TBinOp, IntegerUgeOperation>)
32 else if constexpr (std::is_same_v<TBinOp, IntegerUgtOperation>)
34 else if constexpr (std::is_same_v<TBinOp, IntegerUleOperation>)
36 else if constexpr (std::is_same_v<TBinOp, IntegerUltOperation>)
38 else if constexpr (std::is_same_v<TBinOp, IntegerAddOperation>)
40 else if constexpr (std::is_same_v<TBinOp, IntegerSubOperation>)
42 else if constexpr (std::is_same_v<TBinOp, IntegerMulOperation>)
44 else if constexpr (std::is_same_v<TBinOp, IntegerSDivOperation>)
46 else if constexpr (std::is_same_v<TBinOp, IntegerUDivOperation>)
48 else if constexpr (std::is_same_v<TBinOp, IntegerSRemOperation>)
50 else if constexpr (std::is_same_v<TBinOp, IntegerURemOperation>)
52 else if constexpr (std::is_same_v<TBinOp, IntegerAShrOperation>)
54 else if constexpr (std::is_same_v<TBinOp, IntegerShlOperation>)
56 else if constexpr (std::is_same_v<TBinOp, IntegerLShrOperation>)
58 else if constexpr (std::is_same_v<TBinOp, IntegerOrOperation>)
60 else if constexpr (std::is_same_v<TBinOp, IntegerAndOperation>)
62 else if constexpr (std::is_same_v<TBinOp, IntegerXorOperation>)
65 static_assert(
sizeof(TBinOp) == 0,
"Unsupported binary operation!");
75template<
typename TBinOp>
76static std::optional<std::vector<rvsdg::Output *>>
79 static_assert(std::is_base_of_v<IntegerBinaryOperation, TBinOp>);
82 auto & operand1 = *operands[0];
83 auto & operand2 = *operands[1];
86 auto [c1Node, c1Operation] =
92 auto [c2Node, c2Operation] =
97 auto & c1Representation = c1Operation->Representation();
98 auto & c2Representation = c2Operation->Representation();
99 const auto & resultRepresentation =
100 foldBinaryOperation<TBinOp>(c1Representation, c2Representation);
105 return std::vector<rvsdg::Output *>({ result });
108static std::optional<std::vector<rvsdg::Output *>>
113 auto & operand1 = *operands[0];
114 auto & operand2 = *operands[1];
118 if (&tracedOperand1 == &tracedOperand2)
128std::unique_ptr<rvsdg::Operation>
131 return std::make_unique<IntegerConstantOperation>(*
this);
147 return constant && constant->
Representation() == Representation();
158 return addOperation && addOperation->
Type() == Type();
167std::unique_ptr<rvsdg::Operation>
170 return std::make_unique<IntegerAddOperation>(*
this);
192 return flags::associative | flags::commutative;
195std::optional<std::vector<rvsdg::Output *>>
198 const std::vector<rvsdg::Output *> & operands)
200 return foldBinaryOperationConstants<IntegerAddOperation>(operands);
209 return subOperation && subOperation->
Type() == Type();
218std::unique_ptr<rvsdg::Operation>
221 return std::make_unique<IntegerSubOperation>(*
this);
246std::optional<std::vector<rvsdg::Output *>>
249 const std::vector<rvsdg::Output *> & operands)
252 const auto & operand1 = *operands[0];
253 const auto & operand2 = *operands[1];
258 if (&tracedOperand1 != &tracedOperand2)
265std::optional<std::vector<rvsdg::Output *>>
268 const std::vector<rvsdg::Output *> & operands)
270 return foldBinaryOperationConstants<IntegerSubOperation>(operands);
279 return mulOperation && mulOperation->
Type() == Type();
288std::unique_ptr<rvsdg::Operation>
291 return std::make_unique<IntegerMulOperation>(*
this);
313 return flags::associative | flags::commutative;
316std::optional<std::vector<rvsdg::Output *>>
319 const std::vector<rvsdg::Output *> & operands)
321 return foldBinaryOperationConstants<IntegerMulOperation>(operands);
330 return sdivOperation && sdivOperation->
Type() == Type();
339std::unique_ptr<rvsdg::Operation>
342 return std::make_unique<IntegerSDivOperation>(*
this);
367std::optional<std::vector<rvsdg::Output *>>
370 const std::vector<rvsdg::Output *> & operands)
372 return foldBinaryOperationConstants<IntegerSDivOperation>(operands);
381 return udivOperation && udivOperation->
Type() == Type();
390std::unique_ptr<rvsdg::Operation>
393 return std::make_unique<IntegerUDivOperation>(*
this);
418std::optional<std::vector<rvsdg::Output *>>
421 const std::vector<rvsdg::Output *> & operands)
423 return foldBinaryOperationConstants<IntegerUDivOperation>(operands);
432 return smodOperation && smodOperation->
Type() == Type();
441std::unique_ptr<rvsdg::Operation>
444 return std::make_unique<IntegerSRemOperation>(*
this);
469std::optional<std::vector<rvsdg::Output *>>
472 const std::vector<rvsdg::Output *> & operands)
474 return foldBinaryOperationConstants<IntegerSRemOperation>(operands);
483 return umodOperation && umodOperation->
Type() == Type();
492std::unique_ptr<rvsdg::Operation>
495 return std::make_unique<IntegerURemOperation>(*
this);
520std::optional<std::vector<rvsdg::Output *>>
523 const std::vector<rvsdg::Output *> & operands)
525 return foldBinaryOperationConstants<IntegerURemOperation>(operands);
534 return ashrOperation && ashrOperation->
Type() == Type();
543std::unique_ptr<rvsdg::Operation>
546 return std::make_unique<IntegerAShrOperation>(*
this);
571std::optional<std::vector<rvsdg::Output *>>
574 const std::vector<rvsdg::Output *> & operands)
576 return foldBinaryOperationConstants<IntegerAShrOperation>(operands);
585 return shlOperation && shlOperation->
Type() == Type();
594std::unique_ptr<rvsdg::Operation>
597 return std::make_unique<IntegerShlOperation>(*
this);
622std::optional<std::vector<rvsdg::Output *>>
625 const std::vector<rvsdg::Output *> & operands)
627 return foldBinaryOperationConstants<IntegerShlOperation>(operands);
636 return shrOperation && shrOperation->
Type() == Type();
645std::unique_ptr<rvsdg::Operation>
648 return std::make_unique<IntegerLShrOperation>(*
this);
673std::optional<std::vector<rvsdg::Output *>>
676 const std::vector<rvsdg::Output *> & operands)
678 return foldBinaryOperationConstants<IntegerLShrOperation>(operands);
687 return andOperation && andOperation->
Type() == Type();
696std::unique_ptr<rvsdg::Operation>
699 return std::make_unique<IntegerAndOperation>(*
this);
721 return flags::associative | flags::commutative;
724std::optional<std::vector<rvsdg::Output *>>
727 const std::vector<rvsdg::Output *> & operands)
729 return foldBinaryOperationConstants<IntegerAndOperation>(operands);
738 return orOperation && orOperation->
Type() == Type();
747std::unique_ptr<rvsdg::Operation>
750 return std::make_unique<IntegerOrOperation>(*
this);
772 return flags::associative | flags::commutative;
775std::optional<std::vector<rvsdg::Output *>>
778 const std::vector<rvsdg::Output *> & operands)
780 return foldBinaryOperationConstants<IntegerOrOperation>(operands);
783std::optional<std::vector<rvsdg::Output *>>
786 const std::vector<rvsdg::Output *> & operands)
789 auto & operand1 = *operands[0];
790 auto & operand2 = *operands[1];
793 auto [c1Node, c1Operation] =
795 if (c1Operation && c1Operation->Representation().isZero())
797 return std::vector({ &operand2 });
801 auto [c2Node, c2Operation] =
803 if (c2Operation && c2Operation->Representation().isZero())
805 return std::vector({ &operand1 });
817 return xorOperation && xorOperation->
Type() == Type();
826std::unique_ptr<rvsdg::Operation>
829 return std::make_unique<IntegerXorOperation>(*
this);
851 return flags::associative | flags::commutative;
854std::optional<std::vector<rvsdg::Output *>>
857 const std::vector<rvsdg::Output *> & operands)
859 return foldBinaryOperationConstants<IntegerXorOperation>(operands);
868 return eqOperation && eqOperation->
result(0) == result(0);
877std::unique_ptr<rvsdg::Operation>
880 return std::make_unique<IntegerEqOperation>(*
this);
902 return flags::commutative;
905std::optional<std::vector<rvsdg::Output *>>
908 const std::vector<rvsdg::Output *> & operands)
910 return foldBinaryOperationConstants<IntegerEqOperation>(operands);
913std::optional<std::vector<rvsdg::Output *>>
916 const std::vector<rvsdg::Output *> & operands)
927 return neOperation && neOperation->
result(0) == result(0);
936std::unique_ptr<rvsdg::Operation>
939 return std::make_unique<IntegerNeOperation>(*
this);
961 return flags::commutative;
964std::optional<std::vector<rvsdg::Output *>>
967 const std::vector<rvsdg::Output *> & operands)
969 return foldBinaryOperationConstants<IntegerNeOperation>(operands);
972std::optional<std::vector<rvsdg::Output *>>
975 const std::vector<rvsdg::Output *> & operands)
986 return sgeOperation && sgeOperation->
result(0) == result(0);
995std::unique_ptr<rvsdg::Operation>
998 return std::make_unique<IntegerSgeOperation>(*
this);
1023std::optional<std::vector<rvsdg::Output *>>
1026 const std::vector<rvsdg::Output *> & operands)
1028 return foldBinaryOperationConstants<IntegerSgeOperation>(operands);
1031std::optional<std::vector<rvsdg::Output *>>
1034 const std::vector<rvsdg::Output *> & operands)
1045 return sgtOperation && sgtOperation->
result(0) == result(0);
1054std::unique_ptr<rvsdg::Operation>
1057 return std::make_unique<IntegerSgtOperation>(*
this);
1082std::optional<std::vector<rvsdg::Output *>>
1085 const std::vector<rvsdg::Output *> & operands)
1087 return foldBinaryOperationConstants<IntegerSgtOperation>(operands);
1090std::optional<std::vector<rvsdg::Output *>>
1093 const std::vector<rvsdg::Output *> & operands)
1104 return sleOperation && sleOperation->
result(0) == result(0);
1113std::unique_ptr<rvsdg::Operation>
1116 return std::make_unique<IntegerSleOperation>(*
this);
1141std::optional<std::vector<rvsdg::Output *>>
1144 const std::vector<rvsdg::Output *> & operands)
1146 return foldBinaryOperationConstants<IntegerSleOperation>(operands);
1149std::optional<std::vector<rvsdg::Output *>>
1152 const std::vector<rvsdg::Output *> & operands)
1163 return sltOperation && sltOperation->
result(0) == result(0);
1172std::unique_ptr<rvsdg::Operation>
1175 return std::make_unique<IntegerSltOperation>(*
this);
1200std::optional<std::vector<rvsdg::Output *>>
1203 const std::vector<rvsdg::Output *> & operands)
1205 return foldBinaryOperationConstants<IntegerSltOperation>(operands);
1208std::optional<std::vector<rvsdg::Output *>>
1211 const std::vector<rvsdg::Output *> & operands)
1222 return ugeOperation && ugeOperation->
result(0) == result(0);
1231std::unique_ptr<rvsdg::Operation>
1234 return std::make_unique<IntegerUgeOperation>(*
this);
1259std::optional<std::vector<rvsdg::Output *>>
1262 const std::vector<rvsdg::Output *> & operands)
1264 return foldBinaryOperationConstants<IntegerUgeOperation>(operands);
1267std::optional<std::vector<rvsdg::Output *>>
1270 const std::vector<rvsdg::Output *> & operands)
1281 return ugtOperation && ugtOperation->
result(0) == result(0);
1290std::unique_ptr<rvsdg::Operation>
1293 return std::make_unique<IntegerUgtOperation>(*
this);
1318std::optional<std::vector<rvsdg::Output *>>
1321 const std::vector<rvsdg::Output *> & operands)
1323 return foldBinaryOperationConstants<IntegerUgtOperation>(operands);
1326std::optional<std::vector<rvsdg::Output *>>
1329 const std::vector<rvsdg::Output *> & operands)
1340 return uleOperation && uleOperation->
result(0) == result(0);
1349std::unique_ptr<rvsdg::Operation>
1352 return std::make_unique<IntegerUleOperation>(*
this);
1377std::optional<std::vector<rvsdg::Output *>>
1380 const std::vector<rvsdg::Output *> & operands)
1382 return foldBinaryOperationConstants<IntegerUleOperation>(operands);
1385std::optional<std::vector<rvsdg::Output *>>
1388 const std::vector<rvsdg::Output *> & operands)
1399 return ultOperation && ultOperation->
result(0) == result(0);
1408std::unique_ptr<rvsdg::Operation>
1411 return std::make_unique<IntegerUltOperation>(*
this);
1436std::optional<std::vector<rvsdg::Output *>>
1439 const std::vector<rvsdg::Output *> & operands)
1441 return foldBinaryOperationConstants<IntegerUltOperation>(operands);
1444std::optional<std::vector<rvsdg::Output *>>
1447 const std::vector<rvsdg::Output *> & operands)
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerAShrOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
enum flags flags() const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerAShrOperation() noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
enum flags flags() const noexcept override
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerAddOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
enum flags flags() const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerAndOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
~IntegerAndOperation() noexcept override
~IntegerBinaryOperation() noexcept override
const rvsdg::BitType & Type() const noexcept
static rvsdg::Node & Create(rvsdg::Region ®ion, IntegerValueRepresentation representation)
~IntegerConstantOperation() override
bool operator==(const Operation &other) const noexcept override
const IntegerValueRepresentation & Representation() const noexcept
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
enum flags flags() const noexcept override
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerEqOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerEqOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerEqOperation() noexcept override
~IntegerLShrOperation() noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerLShrOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
enum flags flags() const noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerMulOperation() noexcept override
std::string debug_string() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerMulOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
enum flags flags() const noexcept override
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerNeOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
enum flags flags() const noexcept override
~IntegerNeOperation() noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerNeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerOrOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerOrOperation() noexcept override
enum flags flags() const noexcept override
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdempotent(const IntegerOrOperation &operation, const std::vector< rvsdg::Output * > &operands)
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSDivOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
~IntegerSDivOperation() noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
enum flags flags() const noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSRemOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerSRemOperation() noexcept override
std::unique_ptr< Operation > copy() const override
enum flags flags() const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSgeOperation &operation, const std::vector< rvsdg::Output * > &operands)
enum flags flags() const noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~IntegerSgeOperation() noexcept override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerSgeOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSgtOperation &operation, const std::vector< rvsdg::Output * > &operands)
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
enum flags flags() const noexcept override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerSgtOperation &operation, const std::vector< rvsdg::Output * > &operands)
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
~IntegerSgtOperation() noexcept override
std::unique_ptr< Operation > copy() const override
~IntegerShlOperation() noexcept override
enum flags flags() const noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerShlOperation &operation, const std::vector< rvsdg::Output * > &operands)
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::string debug_string() const override
enum flags flags() const noexcept override
~IntegerSleOperation() noexcept override
std::unique_ptr< Operation > copy() const override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerSleOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSleOperation &operation, const std::vector< rvsdg::Output * > &operands)
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerSltOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSltOperation &operation, const std::vector< rvsdg::Output * > &operands)
enum flags flags() const noexcept override
~IntegerSltOperation() noexcept override
~IntegerSubOperation() noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::string debug_string() const override
enum flags flags() const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerSubOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > normalizeAdditiveInverse(const IntegerSubOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUDivOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
~IntegerUDivOperation() noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
enum flags flags() const noexcept override
std::unique_ptr< Operation > copy() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
enum flags flags() const noexcept override
~IntegerURemOperation() noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerURemOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUgeOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerUgeOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerUgeOperation() noexcept override
enum flags flags() const noexcept override
enum flags flags() const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerUgtOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
~IntegerUgtOperation() noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUgtOperation &operation, const std::vector< rvsdg::Output * > &operands)
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
enum flags flags() const noexcept override
std::string debug_string() const override
~IntegerUleOperation() noexcept override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerUleOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUleOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
enum flags flags() const noexcept override
std::string debug_string() const override
~IntegerUltOperation() noexcept override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const IntegerUltOperation &operation, const std::vector< rvsdg::Output * > &operands)
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerUltOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::string debug_string() const override
rvsdg::Output * reduce_operand_pair(rvsdg::binop_reduction_path_t path, rvsdg::Output *op1, rvsdg::Output *op2) const override
~IntegerXorOperation() noexcept override
enum flags flags() const noexcept override
static std::optional< std::vector< rvsdg::Output * > > foldConstants(const IntegerXorOperation &operation, const std::vector< rvsdg::Output * > &operands)
std::unique_ptr< Operation > copy() const override
rvsdg::binop_reduction_path_t can_reduce_operand_pair(const rvsdg::Output *op1, const rvsdg::Output *op2) const noexcept override
size_t nbits() const noexcept
BitValueRepresentation shl(size_t shift) const
void udiv(const BitValueRepresentation &divisor, BitValueRepresentation "ient, BitValueRepresentation &remainder) const
BitValueRepresentation smod(const BitValueRepresentation &other) const
void mul(const BitValueRepresentation &factor1, const BitValueRepresentation &factor2, BitValueRepresentation &product) const
char sgt(const BitValueRepresentation &other) const
char sge(const BitValueRepresentation &other) const
BitValueRepresentation sdiv(const BitValueRepresentation &other) const
char ne(const BitValueRepresentation &other) const
char ule(const BitValueRepresentation &other) const
char ult(const BitValueRepresentation &other) const
char lor(char a, char b) const noexcept
char ugt(const BitValueRepresentation &other) const
char eq(const BitValueRepresentation &other) const
char lxor(char a, char b) const noexcept
BitValueRepresentation sub(const BitValueRepresentation &other) const
char slt(const BitValueRepresentation &other) const
BitValueRepresentation ashr(size_t shift) const
BitValueRepresentation shr(size_t shift) const
BitValueRepresentation umod(const BitValueRepresentation &other) const
char sle(const BitValueRepresentation &other) const
char land(char a, char b) const noexcept
char uge(const BitValueRepresentation &other) const
char add(char a, char b, char c) const noexcept
NodeOutput * output(size_t index) const noexcept
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
Global memory state passed between functions.
static std::optional< std::vector< rvsdg::Output * > > normalizeIdenticalOperands(const std::vector< rvsdg::Output * > &operands, const std::int64_t result)
rvsdg::BitValueRepresentation IntegerValueRepresentation
rvsdg::Output & traceOutput(rvsdg::Output &output, bool mayEnterSubregions, const rvsdg::Region *withinRegion)
static IntegerValueRepresentation foldBinaryOperation(const IntegerValueRepresentation &r1, const IntegerValueRepresentation &r2)
static std::optional< std::vector< rvsdg::Output * > > foldBinaryOperationConstants(const std::vector< rvsdg::Output * > &operands)
static std::vector< jlm::rvsdg::Output * > outputs(const Node *node)
size_t binop_reduction_path_t
NodeType * TryGetOwnerNode(const rvsdg::Input &input) noexcept
Checks if this is an input to a node of specified type.
static const binop_reduction_path_t binop_reduction_none
static std::string strfmt(Args... args)