6 #ifndef JLM_LLVM_IR_OPERATORS_OPERATORS_HPP
7 #define JLM_LLVM_IR_OPERATORS_OPERATORS_HPP
19 #include <llvm/ADT/APFloat.h>
38 const std::shared_ptr<const
jlm::rvsdg::
Type> &
type)
52 operator==(
const Operation & other)
const noexcept
override;
57 [[nodiscard]] std::unique_ptr<Operation>
58 copy()
const override;
60 const std::shared_ptr<const rvsdg::Type> &
73 static std::unique_ptr<llvm::ThreeAddressCode>
75 const std::vector<std::pair<const Variable *, ControlFlowGraphNode *>> & arguments,
76 std::shared_ptr<const jlm::rvsdg::Type>
type)
78 std::vector<ControlFlowGraphNode *> basicBlocks;
79 std::vector<const Variable *>
operands;
80 for (
const auto &
argument : arguments)
82 basicBlocks.push_back(
argument.second);
86 auto phi = std::make_unique<SsaPhiOperation>(std::move(basicBlocks), std::move(
type));
108 operator==(
const Operation & other)
const noexcept
override;
110 [[nodiscard]] std::string
113 [[nodiscard]] std::unique_ptr<Operation>
114 copy()
const override;
116 static std::unique_ptr<llvm::ThreeAddressCode>
120 throw util::Error(
"LHS and RHS of assignment must have same type.");
122 auto operation = std::make_unique<AssignmentOperation>(rhs->
Type());
137 operator==(
const Operation & other)
const noexcept
override;
142 [[nodiscard]] std::unique_ptr<Operation>
143 copy()
const override;
151 [[nodiscard]]
const std::shared_ptr<const jlm::rvsdg::Type> &
157 static std::unique_ptr<llvm::ThreeAddressCode>
160 auto op = std::make_unique<SelectOperation>(t->
Type());
179 operator==(
const Operation & other)
const noexcept
override;
181 [[nodiscard]] std::string
184 [[nodiscard]] std::unique_ptr<Operation>
185 copy()
const override;
187 [[nodiscard]]
const rvsdg::Type &
193 [[nodiscard]]
const std::shared_ptr<const rvsdg::Type> &
205 static std::unique_ptr<llvm::ThreeAddressCode>
208 if (is<FixedVectorType>(p->
type()) && is<FixedVectorType>(t->
type()))
209 return createVectorSelectTac<FixedVectorType>(p, t, f);
211 if (is<ScalableVectorType>(p->
type()) && is<ScalableVectorType>(t->
type()))
212 return createVectorSelectTac<ScalableVectorType>(p, t, f);
214 throw util::Error(
"Expected vector types as operands.");
219 static std::unique_ptr<ThreeAddressCode>
222 auto fvt =
static_cast<const T *
>(&t->
type());
224 auto vt = T::Create(fvt->Type(), fvt->size());
237 std::shared_ptr<const rvsdg::BitType>
type)
242 std::shared_ptr<const FloatingPointType> fpt,
243 std::shared_ptr<const jlm::rvsdg::BitType>
type)
248 std::shared_ptr<const jlm::rvsdg::Type> srctype,
249 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
254 throw util::Error(
"expected floating point type.");
262 operator==(
const Operation & other)
const noexcept
override;
264 [[nodiscard]] std::string
267 [[nodiscard]] std::unique_ptr<Operation>
268 copy()
const override;
277 static std::unique_ptr<llvm::ThreeAddressCode>
280 auto st = std::dynamic_pointer_cast<const FloatingPointType>(operand->
Type());
282 throw util::Error(
"expected floating point type.");
284 auto dt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(
type);
289 std::make_unique<FloatingPointToUnsignedIntegerOperation>(std::move(st), std::move(dt));
301 std::shared_ptr<const
jlm::rvsdg::BitType>
type)
306 std::shared_ptr<const FloatingPointType> fpt,
307 std::shared_ptr<const jlm::rvsdg::BitType>
type)
312 std::shared_ptr<const jlm::rvsdg::Type> srctype,
313 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
318 throw util::Error(
"expected floating point type.");
326 operator==(
const Operation & other)
const noexcept
override;
328 [[nodiscard]] std::string
331 [[nodiscard]] std::unique_ptr<Operation>
332 copy()
const override;
341 static std::unique_ptr<llvm::ThreeAddressCode>
344 auto st = std::dynamic_pointer_cast<const FloatingPointType>(operand->
Type());
346 throw util::Error(
"expected floating point type.");
348 auto dt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(
type);
352 auto op = std::make_unique<FloatingPointToSignedIntegerOperation>(std::move(st), std::move(dt));
363 std::shared_ptr<const rvsdg::ControlType> srctype,
364 std::shared_ptr<const
jlm::rvsdg::BitType> dsttype)
369 operator==(
const Operation & other)
const noexcept
override;
371 [[nodiscard]] std::string
374 [[nodiscard]] std::unique_ptr<Operation>
375 copy()
const override;
377 static std::unique_ptr<llvm::ThreeAddressCode>
380 auto st = std::dynamic_pointer_cast<const rvsdg::ControlType>(operand->
Type());
384 auto dt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(
type);
388 auto op = std::make_unique<ControlToIntOperation>(std::move(st), std::move(dt));
403 operator==(
const Operation & other)
const noexcept
override;
405 [[nodiscard]] std::string
408 [[nodiscard]] std::unique_ptr<Operation>
409 copy()
const override;
414 return std::static_pointer_cast<const rvsdg::ControlType>(
argument(0))->nalternatives();
417 static std::unique_ptr<llvm::ThreeAddressCode>
439 operator==(
const Operation & other)
const noexcept
override;
441 [[nodiscard]] std::string
444 [[nodiscard]] std::unique_ptr<Operation>
445 copy()
const override;
447 [[nodiscard]]
const PointerType &
450 return *util::assertedCast<const PointerType>(
result(0).get());
453 static std::unique_ptr<llvm::ThreeAddressCode>
468 static const std::shared_ptr<const PointerType>
471 if (
auto pointerType = std::dynamic_pointer_cast<const PointerType>(
type))
484 std::shared_ptr<const
jlm::rvsdg::BitType> btype,
490 std::shared_ptr<const jlm::rvsdg::Type> srctype,
491 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
498 auto pt =
dynamic_cast<const PointerType *
>(dsttype.get());
504 operator==(
const Operation & other)
const noexcept
override;
506 [[nodiscard]] std::string
509 [[nodiscard]] std::unique_ptr<Operation>
510 copy()
const override;
522 return std::static_pointer_cast<const jlm::rvsdg::BitType>(
argument(0))->nbits();
525 static std::unique_ptr<llvm::ThreeAddressCode>
528 auto at = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(
argument->Type());
532 auto pt = std::dynamic_pointer_cast<const PointerType>(
type);
536 auto op = std::make_unique<IntegerToPointerOperation>(at, pt);
543 auto ot = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(operand->
Type());
547 auto pt = std::dynamic_pointer_cast<const PointerType>(
type);
551 return rvsdg::CreateOpNode<IntegerToPointerOperation>({ operand }, ot, pt).output(0);
562 std::shared_ptr<const
jlm::rvsdg::BitType> btype)
567 std::shared_ptr<const jlm::rvsdg::Type> srctype,
568 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
571 auto pt =
dynamic_cast<const PointerType *
>(srctype.get());
581 operator==(
const Operation & other)
const noexcept
override;
583 [[nodiscard]] std::string
586 [[nodiscard]] std::unique_ptr<Operation>
587 copy()
const override;
599 return std::static_pointer_cast<const rvsdg::BitType>(
result(0))->nbits();
602 static std::unique_ptr<llvm::ThreeAddressCode>
605 auto pt = std::dynamic_pointer_cast<const PointerType>(
argument->Type());
609 auto bt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(
type);
613 auto op = std::make_unique<PtrToIntOperation>(std::move(pt), std::move(bt));
633 operator==(
const Operation & other)
const noexcept
override;
635 [[nodiscard]] std::string
638 [[nodiscard]] std::unique_ptr<Operation>
639 copy()
const override;
644 return std::static_pointer_cast<const ArrayType>(
result(0))->nelements();
650 return std::static_pointer_cast<const ArrayType>(
result(0))->element_type();
653 static std::unique_ptr<llvm::ThreeAddressCode>
654 create(
const std::vector<const Variable *> & elements)
656 if (elements.size() == 0)
657 throw util::Error(
"expected at least one element.");
659 auto vt = elements[0]->Type();
663 auto op = std::make_unique<ConstantDataArray>(std::move(vt), elements.size());
668 Create(
const std::vector<jlm::rvsdg::Output *> & elements)
670 if (elements.empty())
671 throw util::Error(
"Expected at least one element.");
673 auto valueType = elements[0]->Type();
679 return rvsdg::CreateOpNode<ConstantDataArray>(elements, std::move(valueType), elements.size())
705 operator==(
const Operation & other)
const noexcept
override;
707 [[nodiscard]] std::string
710 [[nodiscard]] std::unique_ptr<Operation>
711 copy()
const override;
715 const noexcept
override;
729 static std::unique_ptr<llvm::ThreeAddressCode>
732 auto pt = std::dynamic_pointer_cast<const PointerType>(op1->
Type());
736 auto op = std::make_unique<PtrCmpOperation>(std::move(pt),
cmp);
753 throw util::Error(
"# destination bits must be greater than # source bits.");
757 const std::shared_ptr<const jlm::rvsdg::BitType> & srctype,
758 const std::shared_ptr<const jlm::rvsdg::BitType> & dsttype)
761 if (dsttype->nbits() < srctype->nbits())
762 throw util::Error(
"# destination bits must be greater than # source bits.");
766 std::shared_ptr<const jlm::rvsdg::Type> srctype,
767 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
778 if (dt->nbits() < st->nbits())
779 throw util::Error(
"# destination bits must be greater than # source bits.");
783 operator==(
const Operation & other)
const noexcept
override;
785 [[nodiscard]] std::string
788 [[nodiscard]] std::unique_ptr<Operation>
789 copy()
const override;
801 return std::static_pointer_cast<const rvsdg::BitType>(
argument(0))->nbits();
807 return std::static_pointer_cast<const rvsdg::BitType>(
result(0))->nbits();
810 static std::unique_ptr<llvm::ThreeAddressCode>
817 std::make_unique<ZExtOperation>(std::move(operandBitType), std::move(resultBitType));
827 return *rvsdg::CreateOpNode<ZExtOperation>(
829 std::move(operandBitType),
830 std::move(resultBitType))
835 static std::shared_ptr<const rvsdg::BitType>
838 if (
auto bitType = std::dynamic_pointer_cast<const rvsdg::BitType>(
type))
865 operator==(
const Operation & other)
const noexcept
override;
867 [[nodiscard]] std::string
870 [[nodiscard]] std::unique_ptr<Operation>
871 copy()
const override;
873 inline const ::llvm::APFloat &
882 return std::static_pointer_cast<const FloatingPointType>(
result(0))->size();
885 static std::unique_ptr<llvm::ThreeAddressCode>
888 auto ft = std::dynamic_pointer_cast<const FloatingPointType>(
type);
890 throw util::Error(
"expected floating point type.");
892 auto op = std::make_unique<ConstantFP>(std::move(ft),
constant);
942 operator==(
const Operation & other)
const noexcept
override;
944 [[nodiscard]] std::string
947 [[nodiscard]] std::unique_ptr<Operation>
948 copy()
const override;
952 const noexcept
override;
969 return std::static_pointer_cast<const FloatingPointType>(
argument(0))->size();
972 static std::unique_ptr<llvm::ThreeAddressCode>
975 auto ft = std::dynamic_pointer_cast<const FloatingPointType>(op1->
Type());
977 throw util::Error(
"expected floating point type.");
979 auto op = std::make_unique<FCmpOperation>(
cmp, std::move(ft));
1009 operator==(
const Operation & other)
const noexcept
override;
1011 [[nodiscard]] std::string
1014 [[nodiscard]] std::unique_ptr<Operation>
1015 copy()
const override;
1026 return rvsdg::CreateOpNode<UndefValueOperation>(region, std::move(
type)).output(0);
1029 static std::unique_ptr<llvm::ThreeAddressCode>
1032 auto operation = std::make_unique<UndefValueOperation>(std::move(
type));
1036 static std::unique_ptr<llvm::ThreeAddressCode>
1037 Create(std::shared_ptr<const jlm::rvsdg::Type>
type,
const std::string & name)
1039 auto operation = std::make_unique<UndefValueOperation>(std::move(
type));
1043 static std::unique_ptr<llvm::ThreeAddressCode>
1048 std::vector<std::unique_ptr<ThreeAddressCodeVariable>> results;
1049 results.push_back(std::move(
result));
1051 auto operation = std::make_unique<UndefValueOperation>(
type);
1080 operator==(
const Operation & other)
const noexcept
override;
1085 [[nodiscard]] std::unique_ptr<Operation>
1086 copy()
const override;
1094 static std::unique_ptr<llvm::ThreeAddressCode>
1099 auto operation = std::make_unique<PoisonValueOperation>(std::move(valueType));
1108 return rvsdg::CreateOpNode<PoisonValueOperation>(*region, std::move(valueType)).output(0);
1112 static std::shared_ptr<const jlm::rvsdg::Type>
1151 operator==(
const Operation & other)
const noexcept
override;
1153 [[nodiscard]] std::string
1156 [[nodiscard]] std::unique_ptr<Operation>
1157 copy()
const override;
1161 const noexcept
override;
1178 return std::static_pointer_cast<const FloatingPointType>(
result(0))->size();
1181 static std::unique_ptr<llvm::ThreeAddressCode>
1184 auto ft = std::dynamic_pointer_cast<const FloatingPointType>(op1->
Type());
1186 throw util::Error(
"expected floating point type.");
1188 auto op = std::make_unique<FBinaryOperation>(
fpop, ft);
1205 throw util::Error(
"destination type size must be bigger than source type size.");
1209 const std::shared_ptr<const FloatingPointType> & srctype,
1210 const std::shared_ptr<const FloatingPointType> & dsttype)
1214 throw util::Error(
"destination type size must be bigger than source type size.");
1218 std::shared_ptr<const jlm::rvsdg::Type> srctype,
1219 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
1224 throw util::Error(
"expected floating point type.");
1228 throw util::Error(
"expected floating point type.");
1231 throw util::Error(
"destination type size must be bigger than source type size.");
1235 operator==(
const Operation & other)
const noexcept
override;
1237 [[nodiscard]] std::string
1240 [[nodiscard]] std::unique_ptr<Operation>
1241 copy()
const override;
1253 return std::static_pointer_cast<const FloatingPointType>(
argument(0))->size();
1259 return std::static_pointer_cast<const FloatingPointType>(
result(0))->size();
1262 static std::unique_ptr<llvm::ThreeAddressCode>
1265 auto st = std::dynamic_pointer_cast<const FloatingPointType>(operand->
Type());
1267 throw util::Error(
"expected floating point type.");
1269 auto dt = std::dynamic_pointer_cast<const FloatingPointType>(
type);
1271 throw util::Error(
"expected floating point type.");
1273 auto op = std::make_unique<FPExtOperation>(std::move(st), std::move(dt));
1292 operator==(
const Operation & other)
const noexcept
override;
1294 [[nodiscard]] std::string
1297 [[nodiscard]] std::unique_ptr<Operation>
1298 copy()
const override;
1310 return std::static_pointer_cast<const FloatingPointType>(
argument(0))->size();
1313 static std::unique_ptr<llvm::ThreeAddressCode>
1316 auto type = std::dynamic_pointer_cast<const FloatingPointType>(operand->
Type());
1318 throw util::Error(
"expected floating point type.");
1320 auto op = std::make_unique<FNegOperation>(std::move(
type));
1335 throw util::Error(
"destination tpye size must be smaller than source size type.");
1339 const std::shared_ptr<const FloatingPointType> & srctype,
1340 const std::shared_ptr<const FloatingPointType> & dsttype)
1344 throw util::Error(
"destination type size must be bigger than source type size.");
1348 std::shared_ptr<const jlm::rvsdg::Type> srctype,
1349 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
1354 throw util::Error(
"expected floating point type.");
1358 throw util::Error(
"expected floating point type.");
1362 throw util::Error(
"destination type size must be smaller than source size type.");
1366 operator==(
const Operation & other)
const noexcept
override;
1368 [[nodiscard]] std::string
1371 [[nodiscard]] std::unique_ptr<Operation>
1372 copy()
const override;
1384 return std::static_pointer_cast<const FloatingPointType>(
argument(0))->size();
1390 return std::static_pointer_cast<const FloatingPointType>(
result(0))->size();
1393 static std::unique_ptr<llvm::ThreeAddressCode>
1396 auto st = std::dynamic_pointer_cast<const FloatingPointType>(operand->
Type());
1398 throw util::Error(
"expected floating point type.");
1400 auto dt = std::dynamic_pointer_cast<const FloatingPointType>(
type);
1402 throw util::Error(
"expected floating point type.");
1404 auto op = std::make_unique<FPTruncOperation>(std::move(st), std::move(dt));
1427 operator==(
const Operation & other)
const noexcept
override;
1429 [[nodiscard]] std::string
1432 [[nodiscard]] std::unique_ptr<Operation>
1433 copy()
const override;
1435 static std::unique_ptr<llvm::ThreeAddressCode>
1436 create(
const std::vector<const Variable *> & arguments)
1438 std::vector<std::shared_ptr<const jlm::rvsdg::Type>>
operands;
1439 for (
const auto &
argument : arguments)
1442 auto op = std::make_unique<VariadicArgumentListOperation>(std::move(
operands));
1449 std::vector<std::shared_ptr<const rvsdg::Type>> operandTypes;
1450 operandTypes.reserve(
operands.size());
1452 operandTypes.emplace_back(operand->Type());
1455 ? rvsdg::CreateOpNode<VariadicArgumentListOperation>(region, std::move(operandTypes))
1457 : rvsdg::CreateOpNode<VariadicArgumentListOperation>(
operands, std::move(operandTypes))
1468 std::shared_ptr<const
jlm::rvsdg::Type> srctype,
1469 std::shared_ptr<const
jlm::rvsdg::Type> dsttype)
1486 operator==(
const Operation & other)
const noexcept
override;
1488 [[nodiscard]] std::string
1491 [[nodiscard]] std::unique_ptr<Operation>
1492 copy()
const override;
1501 static std::unique_ptr<llvm::ThreeAddressCode>
1506 auto op = std::make_unique<BitCastOperation>(pair.first, pair.second);
1514 return rvsdg::CreateOpNode<BitCastOperation>({ operand }, pair.first, pair.second).output(0);
1518 static std::pair<std::shared_ptr<const jlm::rvsdg::Type>, std::shared_ptr<const jlm::rvsdg::Type>>
1520 const std::shared_ptr<const jlm::rvsdg::Type> & otype,
1521 const std::shared_ptr<const jlm::rvsdg::Type> & rtype)
1529 return std::make_pair(otype, rtype);
1543 operator==(
const Operation & other)
const noexcept
override;
1545 [[nodiscard]] std::string
1548 [[nodiscard]] std::unique_ptr<Operation>
1549 copy()
const override;
1554 return *std::static_pointer_cast<const StructType>(
result(0));
1557 static std::unique_ptr<llvm::ThreeAddressCode>
1559 const std::vector<const Variable *> & elements,
1560 const std::shared_ptr<const jlm::rvsdg::Type> &
type)
1564 auto op = std::make_unique<ConstantStruct>(std::move(structType));
1571 const std::vector<rvsdg::Output *> &
operands,
1572 std::shared_ptr<const rvsdg::Type> resultType)
1575 return *rvsdg::CreateOpNode<ConstantStruct>(
operands, std::move(structType)).output(0);
1579 static inline std::vector<std::shared_ptr<const rvsdg::Type>>
1582 std::vector<std::shared_ptr<const rvsdg::Type>> types;
1589 static std::shared_ptr<const StructType>
1592 if (
auto structType = std::dynamic_pointer_cast<const StructType>(
type))
1607 const std::shared_ptr<const
jlm::rvsdg::BitType> & otype,
1608 const std::shared_ptr<const
jlm::rvsdg::BitType> & rtype)
1611 if (otype->nbits() < rtype->nbits())
1612 throw util::Error(
"expected operand's #bits to be larger than results' #bits.");
1616 std::shared_ptr<const jlm::rvsdg::Type> optype,
1617 std::shared_ptr<const jlm::rvsdg::Type> restype)
1628 if (ot->nbits() < rt->nbits())
1629 throw util::Error(
"expected operand's #bits to be larger than results' #bits.");
1633 operator==(
const Operation & other)
const noexcept
override;
1635 [[nodiscard]] std::string
1638 [[nodiscard]] std::unique_ptr<Operation>
1639 copy()
const override;
1651 return std::static_pointer_cast<const rvsdg::BitType>(
argument(0))->nbits();
1657 return std::static_pointer_cast<const rvsdg::BitType>(
result(0))->nbits();
1660 static std::unique_ptr<llvm::ThreeAddressCode>
1663 auto ot = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(operand->
Type());
1667 auto rt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(
type);
1671 auto op = std::make_unique<TruncOperation>(std::move(ot), std::move(rt));
1678 auto ot = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(operand->
Type());
1682 return rvsdg::CreateOpNode<TruncOperation>(
1696 std::shared_ptr<const
jlm::rvsdg::BitType> srctype,
1702 std::shared_ptr<const jlm::rvsdg::Type> optype,
1703 std::shared_ptr<const jlm::rvsdg::Type> restype)
1712 throw util::Error(
"expected floating point type.");
1716 operator==(
const Operation & other)
const noexcept
override;
1718 [[nodiscard]] std::string
1721 [[nodiscard]] std::unique_ptr<Operation>
1722 copy()
const override;
1731 static std::unique_ptr<llvm::ThreeAddressCode>
1734 auto st = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(operand->
Type());
1738 auto rt = std::dynamic_pointer_cast<const FloatingPointType>(
type);
1740 throw util::Error(
"expected floating point type.");
1742 auto op = std::make_unique<UIToFPOperation>(std::move(st), std::move(rt));
1753 std::shared_ptr<const
jlm::rvsdg::BitType> srctype,
1759 std::shared_ptr<const jlm::rvsdg::Type> srctype,
1760 std::shared_ptr<const jlm::rvsdg::Type> dsttype)
1769 throw util::Error(
"expected floating point type.");
1773 operator==(
const Operation & other)
const noexcept
override;
1775 [[nodiscard]] std::string
1778 [[nodiscard]] std::unique_ptr<Operation>
1779 copy()
const override;
1788 static std::unique_ptr<llvm::ThreeAddressCode>
1791 auto st = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(operand->
Type());
1795 auto rt = std::dynamic_pointer_cast<const FloatingPointType>(
type);
1797 throw util::Error(
"expected floating point type.");
1799 auto op = std::make_unique<SIToFPOperation>(std::move(st), std::move(rt));
1817 operator==(
const Operation & other)
const noexcept
override;
1819 [[nodiscard]] std::string
1822 [[nodiscard]] std::unique_ptr<Operation>
1823 copy()
const override;
1828 return std::static_pointer_cast<const ArrayType>(
result(0))->nelements();
1834 return std::static_pointer_cast<const ArrayType>(
result(0))->element_type();
1837 static std::unique_ptr<llvm::ThreeAddressCode>
1838 create(
const std::vector<const Variable *> & elements)
1840 if (elements.size() == 0)
1841 throw util::Error(
"expected at least one element.\n");
1843 auto vt = elements[0]->Type();
1847 auto op = std::make_unique<ConstantArrayOperation>(vt, elements.size());
1855 throw util::Error(
"Expected at least one element.\n");
1857 auto valueType =
operands[0]->Type();
1863 return rvsdg::CreateOpNode<ConstantArrayOperation>(
operands, valueType,
operands.size())
1876 auto st =
dynamic_cast<const StructType *
>(
type.get());
1877 auto at =
dynamic_cast<const ArrayType *
>(
type.get());
1878 auto vt =
dynamic_cast<const VectorType *
>(
type.get());
1879 if (!st && !at && !vt)
1880 throw util::Error(
"expected array, struct, or vector type.\n");
1884 operator==(
const Operation & other)
const noexcept
override;
1886 [[nodiscard]] std::string
1889 [[nodiscard]] std::unique_ptr<Operation>
1890 copy()
const override;
1892 static std::unique_ptr<llvm::ThreeAddressCode>
1895 auto op = std::make_unique<ConstantAggregateZeroOperation>(std::move(
type));
1902 return rvsdg::CreateOpNode<ConstantAggregateZeroOperation>(region, std::move(
type)).output(0);
1912 const std::shared_ptr<const
VectorType> & vtype,
1913 const std::shared_ptr<const
jlm::rvsdg::BitType> & btype)
1918 operator==(
const Operation & other)
const noexcept
override;
1920 [[nodiscard]] std::string
1923 [[nodiscard]] std::unique_ptr<Operation>
1924 copy()
const override;
1926 static inline std::unique_ptr<llvm::ThreeAddressCode>
1929 auto vt = std::dynamic_pointer_cast<const VectorType>(vector->
Type());
1933 auto bt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(index->
Type());
1937 auto op = std::make_unique<ExtractElementOperation>(vt, bt);
1949 const std::vector<
int> & mask)
1955 const std::shared_ptr<const ScalableVectorType> & v,
1956 const std::vector<int> & mask)
1962 operator==(
const Operation & other)
const noexcept
override;
1964 [[nodiscard]] std::string
1967 [[nodiscard]] std::unique_ptr<Operation>
1968 copy()
const override;
1970 const ::llvm::ArrayRef<int>
1976 static std::unique_ptr<llvm::ThreeAddressCode>
1979 if (is<FixedVectorType>(v1->
type()) && is<FixedVectorType>(v2->
type()))
1980 return CreateShuffleVectorTac<FixedVectorType>(v1, v2, mask);
1982 if (is<ScalableVectorType>(v1->
type()) && is<ScalableVectorType>(v2->
type()))
1983 return CreateShuffleVectorTac<ScalableVectorType>(v1, v2, mask);
1985 throw util::Error(
"Expected vector types as operands.");
1989 template<
typename T>
1990 static std::unique_ptr<ThreeAddressCode>
1993 auto vt = std::static_pointer_cast<const T>(v1->
Type());
1994 auto op = std::make_unique<ShuffleVectorOperation>(vt, mask);
2011 operator==(
const Operation & other)
const noexcept
override;
2013 [[nodiscard]] std::string
2016 [[nodiscard]] std::unique_ptr<Operation>
2017 copy()
const override;
2019 static inline std::unique_ptr<llvm::ThreeAddressCode>
2021 const std::vector<const Variable *> &
operands,
2022 const std::shared_ptr<const jlm::rvsdg::Type> &
type)
2024 auto vt = std::dynamic_pointer_cast<const VectorType>(
type);
2028 auto op = std::make_unique<ConstantVectorOperation>(vt);
2039 const std::shared_ptr<const
VectorType> & vectype,
2040 const std::shared_ptr<const
jlm::rvsdg::Type> & vtype,
2041 const std::shared_ptr<const
jlm::rvsdg::BitType> & btype)
2044 if (vectype->type() != *vtype)
2046 auto received = vtype->debug_string();
2047 auto expected = vectype->type().debug_string();
2053 operator==(
const Operation & other)
const noexcept
override;
2055 [[nodiscard]] std::string
2058 [[nodiscard]] std::unique_ptr<Operation>
2059 copy()
const override;
2061 static inline std::unique_ptr<llvm::ThreeAddressCode>
2064 auto vct = std::dynamic_pointer_cast<const VectorType>(vector->
Type());
2068 auto vt = value->
Type();
2072 auto bt = std::dynamic_pointer_cast<const jlm::rvsdg::BitType>(index->
Type());
2076 auto op = std::make_unique<InsertElementOperation>(vct, vt, bt);
2087 const rvsdg::UnaryOperation & op,
2088 const std::shared_ptr<const
VectorType> & operand,
2093 if (operand->type() != *op.argument(0))
2095 auto received = operand->type().debug_string();
2096 auto expected = op.argument(0)->debug_string();
2100 if (
result->type() != *op.result(0))
2102 auto received =
result->type().debug_string();
2103 auto expected = op.result(0)->debug_string();
2104 throw util::Error(
jlm::util::strfmt(
"expected ", expected,
", got ", received));
2115 op_(std::move(other.op_))
2131 op_ = std::move(other.op_);
2143 operator==(
const Operation & other)
const noexcept
override;
2145 [[nodiscard]] std::string
2148 [[nodiscard]] std::unique_ptr<Operation>
2149 copy()
const override;
2151 static inline std::unique_ptr<llvm::ThreeAddressCode>
2155 const std::shared_ptr<const jlm::rvsdg::Type> &
type)
2157 auto vct1 = std::dynamic_pointer_cast<const VectorType>(operand->
Type());
2158 auto vct2 = std::dynamic_pointer_cast<const VectorType>(
type);
2162 auto op = std::make_unique<VectorUnaryOperation>(unop, vct1, vct2);
2167 std::unique_ptr<Operation>
op_;
2176 const rvsdg::BinaryOperation & binop,
2177 const std::shared_ptr<const
VectorType> & op1,
2178 const std::shared_ptr<const
VectorType> & op2,
2184 throw util::Error(
"expected the same vector types.");
2186 if (op1->type() != *binop.argument(0))
2188 auto received = op1->type().debug_string();
2189 auto expected = binop.argument(0)->debug_string();
2193 if (
result->type() != *binop.result(0))
2195 auto received =
result->type().debug_string();
2196 auto expected = binop.result(0)->debug_string();
2197 throw util::Error(
jlm::util::strfmt(
"expected ", expected,
", got ", received));
2208 op_(std::move(other.op_))
2224 op_ = std::move(other.op_);
2236 operator==(
const Operation & other)
const noexcept
override;
2238 [[nodiscard]] std::string
2241 [[nodiscard]] std::unique_ptr<Operation>
2242 copy()
const override;
2244 static inline std::unique_ptr<llvm::ThreeAddressCode>
2249 const std::shared_ptr<const jlm::rvsdg::Type> &
type)
2251 auto vct1 = std::dynamic_pointer_cast<const VectorType>(op1->
Type());
2252 auto vct2 = std::dynamic_pointer_cast<const VectorType>(op2->
Type());
2253 auto vct3 = std::dynamic_pointer_cast<const VectorType>(
type);
2254 if (!vct1 || !vct2 || !vct3)
2257 auto op = std::make_unique<VectorBinaryOperation>(binop, vct1, vct2, vct3);
2262 std::unique_ptr<Operation>
op_;
2277 operator==(
const Operation & other)
const noexcept
override;
2279 [[nodiscard]] std::string
2282 [[nodiscard]] std::unique_ptr<Operation>
2283 copy()
const override;
2288 return std::static_pointer_cast<const VectorType>(
result(0))->size();
2294 return std::static_pointer_cast<const VectorType>(
result(0))->type();
2297 static std::unique_ptr<ThreeAddressCode>
2298 Create(
const std::vector<const Variable *> & elements)
2300 if (elements.empty())
2301 throw util::Error(
"Expected at least one element.");
2303 auto vt = elements[0]->Type();
2307 auto op = std::unique_ptr<ConstantDataVectorOperation>(
2321 const std::shared_ptr<const
jlm::rvsdg::Type> & aggtype,
2322 const std::vector<
unsigned> & indices)
2326 if (indices.empty())
2327 throw util::Error(
"expected at least one index.");
2331 operator==(
const Operation & other)
const noexcept
override;
2333 [[nodiscard]] std::string
2336 [[nodiscard]] std::unique_ptr<Operation>
2337 copy()
const override;
2357 static inline std::unique_ptr<llvm::ThreeAddressCode>
2360 auto op = std::make_unique<ExtractValueOperation>(
aggregate->Type(), indices);
2365 static inline std::vector<std::shared_ptr<const rvsdg::Type>>
2367 const std::shared_ptr<const jlm::rvsdg::Type> & aggtype,
2368 const std::vector<unsigned> & indices)
2370 std::shared_ptr<const jlm::rvsdg::Type>
type = aggtype;
2371 for (
const auto & index : indices)
2373 if (
auto st = std::dynamic_pointer_cast<const StructType>(
type))
2375 if (index >= st->numElements())
2376 throw util::Error(
"extractvalue index out of bound.");
2378 type = st->getElementType(index);
2380 else if (
auto at = std::dynamic_pointer_cast<const ArrayType>(
type))
2382 if (index >= at->nelements())
2383 throw util::Error(
"extractvalue index out of bound.");
2385 type = at->GetElementType();
2388 throw util::Error(
"expected struct or array type.");
2414 operator==(
const Operation & other)
const noexcept
override;
2416 [[nodiscard]] std::string
2419 [[nodiscard]] std::unique_ptr<Operation>
2420 copy()
const override;
2422 const rvsdg::BitType &
2425 return *std::static_pointer_cast<const rvsdg::BitType>(
argument(0));
2439 auto & size = *node.
input(0);
2448 auto & ioState = *node.
input(1);
2457 auto & address = *node.
output(0);
2466 auto & ioState = *node.
output(1);
2475 auto & memoryState = *node.
output(2);
2476 JLM_ASSERT(is<MemoryStateType>(memoryState.Type()));
2480 static std::unique_ptr<ThreeAddressCode>
2484 auto op = std::make_unique<MallocOperation>(std::move(bitType));
2492 return rvsdg::CreateOpNode<MallocOperation>({ &size, &ioState }, std::move(bitType));
2496 static std::shared_ptr<const rvsdg::BitType>
2499 if (
auto bitType = std::dynamic_pointer_cast<const rvsdg::BitType>(
type))
2502 throw std::runtime_error(
"Expected bits type.");
2521 operator==(
const Operation & other)
const noexcept
override;
2523 [[nodiscard]] std::string
2526 [[nodiscard]] std::unique_ptr<Operation>
2527 copy()
const override;
2537 const auto input = node.input(0);
2545 JLM_ASSERT(is<MemoryStateType>(output.Type()));
2546 auto [freeNode, freeOperation] = rvsdg::TryGetSimpleNodeAndOptionalOp<FreeOperation>(output);
2548 const auto input = freeNode->input(output.index() + 1);
2549 JLM_ASSERT(is<MemoryStateType>(input->Type()));
2553 static std::unique_ptr<llvm::ThreeAddressCode>
2556 const std::vector<const Variable *> & memoryStates,
2559 std::vector<const Variable *>
operands;
2564 auto operation = std::make_unique<FreeOperation>(memoryStates.size());
2568 static std::vector<jlm::rvsdg::Output *>
2571 const std::vector<jlm::rvsdg::Output *> & memoryStates,
2574 std::vector<jlm::rvsdg::Output *>
operands;
2579 return outputs(&rvsdg::CreateOpNode<FreeOperation>(
operands, memoryStates.size()));
2583 static std::vector<std::shared_ptr<const rvsdg::Type>>
2586 std::vector<std::shared_ptr<const rvsdg::Type>> memoryStates(
2591 types.insert(types.end(), memoryStates.begin(), memoryStates.end());
2597 static std::vector<std::shared_ptr<const rvsdg::Type>>
2600 std::vector<std::shared_ptr<const rvsdg::Type>> types(
static std::shared_ptr< const ArrayType > Create(std::shared_ptr< const Type > type, size_t nelements)
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *rhs, const Variable *lhs)
~AssignmentOperation() noexcept override
std::string debug_string() const override
AssignmentOperation(const AssignmentOperation &)=default
AssignmentOperation(AssignmentOperation &&)=default
bool operator==(const Operation &other) const noexcept override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
static std::pair< std::shared_ptr< const jlm::rvsdg::Type >, std::shared_ptr< const jlm::rvsdg::Type > > check_types(const std::shared_ptr< const jlm::rvsdg::Type > &otype, const std::shared_ptr< const jlm::rvsdg::Type > &rtype)
BitCastOperation(const BitCastOperation &)=default
BitCastOperation(Operation &&)=delete
std::unique_ptr< Operation > copy() const override
static jlm::rvsdg::Output * create(jlm::rvsdg::Output *operand, std::shared_ptr< const jlm::rvsdg::Type > rtype)
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
BitCastOperation & operator=(Operation &&)=delete
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
BitCastOperation & operator=(const Operation &)=delete
~BitCastOperation() noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, std::shared_ptr< const jlm::rvsdg::Type > type)
std::string debug_string() const override
size_t nalternatives() const noexcept
~BranchOperation() noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(size_t nalternatives, const Variable *operand)
std::unique_ptr< Operation > copy() const override
bool operator==(const Operation &other) const noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(std::shared_ptr< const jlm::rvsdg::Type > type)
std::unique_ptr< Operation > copy() const override
~ConstantAggregateZeroOperation() noexcept override
static jlm::rvsdg::Output * Create(rvsdg::Region ®ion, std::shared_ptr< const jlm::rvsdg::Type > type)
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
const jlm::rvsdg::Type & type() const noexcept
~ConstantArrayOperation() noexcept override
std::unique_ptr< Operation > copy() const override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
static rvsdg::Output * Create(const std::vector< rvsdg::Output * > &operands)
static std::unique_ptr< llvm::ThreeAddressCode > create(const std::vector< const Variable * > &elements)
size_t size() const noexcept
static jlm::rvsdg::Output * Create(const std::vector< jlm::rvsdg::Output * > &elements)
static std::unique_ptr< llvm::ThreeAddressCode > create(const std::vector< const Variable * > &elements)
const jlm::rvsdg::Type & type() const noexcept
size_t size() const noexcept
~ConstantDataArray() noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
bool operator==(const Operation &other) const noexcept override
bool operator==(const Operation &other) const noexcept override
static std::unique_ptr< ThreeAddressCode > Create(const std::vector< const Variable * > &elements)
const jlm::rvsdg::Type & type() const noexcept
~ConstantDataVectorOperation() noexcept override
std::unique_ptr< Operation > copy() const override
size_t size() const noexcept
ConstantDataVectorOperation(const std::shared_ptr< const VectorType > &vt)
std::string debug_string() const override
~ConstantFP() noexcept override
const fpsize & size() const noexcept
ConstantFP(std::shared_ptr< const FloatingPointType > fpt, const ::llvm::APFloat &constant)
std::unique_ptr< Operation > copy() const override
::llvm::APFloat constant_
bool operator==(const Operation &other) const noexcept override
const ::llvm::APFloat & constant() const noexcept
std::string debug_string() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const ::llvm::APFloat &constant, const std::shared_ptr< const jlm::rvsdg::Type > &type)
ConstantPointerNullOperation class.
std::string debug_string() const override
static jlm::rvsdg::Output * Create(rvsdg::Region *region, std::shared_ptr< const rvsdg::Type > type)
static const std::shared_ptr< const PointerType > CheckAndExtractType(std::shared_ptr< const jlm::rvsdg::Type > type)
static std::unique_ptr< llvm::ThreeAddressCode > Create(std::shared_ptr< const rvsdg::Type > type)
const PointerType & GetPointerType() const noexcept
bool operator==(const Operation &other) const noexcept override
~ConstantPointerNullOperation() noexcept override
std::unique_ptr< Operation > copy() const override
static rvsdg::Output & Create(rvsdg::Region &, const std::vector< rvsdg::Output * > &operands, std::shared_ptr< const rvsdg::Type > resultType)
static std::vector< std::shared_ptr< const rvsdg::Type > > create_srctypes(const StructType &type)
bool operator==(const Operation &other) const noexcept override
static std::shared_ptr< const StructType > CheckAndExtractStructType(std::shared_ptr< const rvsdg::Type > type)
std::string debug_string() const override
~ConstantStruct() override
std::unique_ptr< Operation > copy() const override
ConstantStruct(std::shared_ptr< const StructType > type)
static std::unique_ptr< llvm::ThreeAddressCode > create(const std::vector< const Variable * > &elements, const std::shared_ptr< const jlm::rvsdg::Type > &type)
const StructType & type() const noexcept
bool operator==(const Operation &other) const noexcept override
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const std::vector< const Variable * > &operands, const std::shared_ptr< const jlm::rvsdg::Type > &type)
~ConstantVectorOperation() noexcept override
std::string debug_string() const override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
~ControlToIntOperation() noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
std::unique_ptr< Operation > copy() const override
const fpsize & size() const noexcept
const llvm::fpop & fpop() const noexcept
std::string debug_string() const override
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const llvm::fpop &fpop, const Variable *op1, const Variable *op2)
FBinaryOperation(const llvm::fpop &op, const std::shared_ptr< const FloatingPointType > &fpt)
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
~FBinaryOperation() noexcept override
bool operator==(const Operation &other) const noexcept override
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
const fpcmp & cmp() const noexcept
~FCmpOperation() noexcept override
FCmpOperation(const fpcmp &cmp, const std::shared_ptr< const FloatingPointType > &fpt)
std::string debug_string() const override
bool operator==(const Operation &other) const noexcept override
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const fpcmp &cmp, const Variable *op1, const Variable *op2)
const fpsize & size() const noexcept
const fpsize & size() const noexcept
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
bool operator==(const Operation &other) const noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand)
~FNegOperation() noexcept override
std::string debug_string() const override
FNegOperation(const std::shared_ptr< const FloatingPointType > &fpt)
FPExtOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
const fpsize & dstsize() const noexcept
~FPExtOperation() noexcept override
std::string debug_string() const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
bool operator==(const Operation &other) const noexcept override
std::unique_ptr< Operation > copy() const override
const fpsize & srcsize() const noexcept
FPExtOperation(const std::shared_ptr< const FloatingPointType > &srctype, const std::shared_ptr< const FloatingPointType > &dsttype)
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
bool operator==(const Operation &other) const noexcept override
FPTruncOperation(const std::shared_ptr< const FloatingPointType > &srctype, const std::shared_ptr< const FloatingPointType > &dsttype)
const fpsize & dstsize() const noexcept
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, std::shared_ptr< const jlm::rvsdg::Type > type)
const fpsize & srcsize() const noexcept
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
~FPTruncOperation() noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
FPTruncOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
static std::shared_ptr< const FixedVectorType > Create(std::shared_ptr< const rvsdg::Type > type, size_t size)
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
FloatingPointToSignedIntegerOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
bool operator==(const Operation &other) const noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
FloatingPointToSignedIntegerOperation(std::shared_ptr< const FloatingPointType > fpt, std::shared_ptr< const jlm::rvsdg::BitType > type)
~FloatingPointToSignedIntegerOperation() noexcept override
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
bool operator==(const Operation &other) const noexcept override
FloatingPointToUnsignedIntegerOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
std::string debug_string() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
FloatingPointToUnsignedIntegerOperation(std::shared_ptr< const FloatingPointType > fpt, std::shared_ptr< const jlm::rvsdg::BitType > type)
std::unique_ptr< Operation > copy() const override
~FloatingPointToUnsignedIntegerOperation() noexcept override
static std::shared_ptr< const FloatingPointType > Create(fpsize size)
static rvsdg::Input & addressInput(const rvsdg::Node &node) noexcept
bool operator==(const Operation &other) const noexcept override
static std::vector< std::shared_ptr< const rvsdg::Type > > CreateResultTypes(size_t numMemoryStates)
std::unique_ptr< Operation > copy() const override
static std::vector< std::shared_ptr< const rvsdg::Type > > CreateOperandTypes(size_t numMemoryStates)
static std::unique_ptr< llvm::ThreeAddressCode > Create(const Variable *pointer, const std::vector< const Variable * > &memoryStates, const Variable *iOState)
static rvsdg::Input & mapMemoryStateOutputToInput(rvsdg::Output &output) noexcept
~FreeOperation() noexcept override
static std::vector< jlm::rvsdg::Output * > Create(jlm::rvsdg::Output *pointer, const std::vector< jlm::rvsdg::Output * > &memoryStates, jlm::rvsdg::Output *iOState)
std::string debug_string() const override
static std::shared_ptr< const IOStateType > Create()
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
~InsertElementOperation() noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const llvm::Variable *vector, const llvm::Variable *value, const llvm::Variable *index)
std::unique_ptr< Operation > copy() const override
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
size_t nbits() const noexcept
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
~IntegerToPointerOperation() noexcept override
static jlm::rvsdg::Output * create(jlm::rvsdg::Output *operand, std::shared_ptr< const jlm::rvsdg::Type > type)
bool operator==(const Operation &other) const noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
IntegerToPointerOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *argument, std::shared_ptr< const jlm::rvsdg::Type > type)
bool operator==(const Operation &other) const noexcept override
std::unique_ptr< Operation > copy() const override
static rvsdg::Output & ioStateOutput(const rvsdg::Node &node)
static rvsdg::Input & ioStateInput(const rvsdg::Node &node)
static std::unique_ptr< ThreeAddressCode > createTac(const Variable *size, const Variable *ioState)
std::string debug_string() const override
~MallocOperation() noexcept override
static rvsdg::Input & sizeInput(const rvsdg::Node &node)
static rvsdg::SimpleNode & createNode(rvsdg::Output &size, rvsdg::Output &ioState)
static rvsdg::Output & addressOutput(const rvsdg::Node &node)
static rvsdg::Output & memoryStateOutput(const rvsdg::Node &node)
static std::shared_ptr< const rvsdg::BitType > checkAndExtractSizeType(const std::shared_ptr< const rvsdg::Type > &type)
const rvsdg::BitType & getSizeType() const noexcept
rvsdg::FunctionType getFunctionType() const
static std::shared_ptr< const MemoryStateType > Create()
static std::shared_ptr< const PointerType > Create()
PoisonValueOperation class.
bool operator==(const Operation &other) const noexcept override
static std::shared_ptr< const jlm::rvsdg::Type > CheckAndConvertType(const std::shared_ptr< const jlm::rvsdg::Type > &type)
PoisonValueOperation(PoisonValueOperation &&)=delete
~PoisonValueOperation() noexcept override
PoisonValueOperation & operator=(PoisonValueOperation &&)=delete
std::string debug_string() const override
const jlm::rvsdg::Type & GetType() const noexcept
PoisonValueOperation & operator=(const PoisonValueOperation &)=delete
static std::unique_ptr< llvm::ThreeAddressCode > Create(const std::shared_ptr< const jlm::rvsdg::Type > &type)
PoisonValueOperation(const PoisonValueOperation &)=default
std::unique_ptr< Operation > copy() const override
static jlm::rvsdg::Output * Create(rvsdg::Region *region, const std::shared_ptr< const jlm::rvsdg::Type > &type)
~PtrCmpOperation() noexcept override
llvm::cmp cmp() const noexcept
bool operator==(const Operation &other) const noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const llvm::cmp &cmp, const Variable *op1, const Variable *op2)
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
std::string debug_string() const override
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
std::unique_ptr< Operation > copy() const override
std::unique_ptr< Operation > copy() const override
PtrToIntOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
std::string debug_string() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *argument, const std::shared_ptr< const jlm::rvsdg::Type > &type)
bool operator==(const Operation &other) const noexcept override
~PtrToIntOperation() noexcept override
size_t nbits() const noexcept
~SIToFPOperation() noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
SIToFPOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
bool operator==(const Operation &other) const noexcept override
const std::shared_ptr< const jlm::rvsdg::Type > & Type() const noexcept
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const llvm::Variable *p, const llvm::Variable *t, const llvm::Variable *f)
~SelectOperation() noexcept override
const jlm::rvsdg::Type & type() const noexcept
const ::llvm::ArrayRef< int > Mask() const
std::string debug_string() const override
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *v1, const Variable *v2, const std::vector< int > &mask)
ShuffleVectorOperation(const std::shared_ptr< const ScalableVectorType > &v, const std::vector< int > &mask)
static std::unique_ptr< ThreeAddressCode > CreateShuffleVectorTac(const Variable *v1, const Variable *v2, const std::vector< int > &mask)
bool operator==(const Operation &other) const noexcept override
~ShuffleVectorOperation() noexcept override
ControlFlowGraphNode * GetIncomingNode(size_t n) const noexcept
SsaPhiOperation(const SsaPhiOperation &)=default
static std::unique_ptr< llvm::ThreeAddressCode > create(const std::vector< std::pair< const Variable *, ControlFlowGraphNode * >> &arguments, std::shared_ptr< const jlm::rvsdg::Type > type)
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
std::string debug_string() const override
SsaPhiOperation & operator=(SsaPhiOperation &&)=delete
bool operator==(const Operation &other) const noexcept override
SsaPhiOperation & operator=(const SsaPhiOperation &)=delete
std::unique_ptr< Operation > copy() const override
~SsaPhiOperation() noexcept override
std::vector< ControlFlowGraphNode * > IncomingNodes_
std::string debug_string() const override
size_t numElements() const noexcept
std::shared_ptr< const Type > getElementType(const size_t index) const noexcept
static std::unique_ptr< llvm::ThreeAddressCode > create(std::unique_ptr< rvsdg::SimpleOperation > operation, const std::vector< const Variable * > &operands)
std::string debug_string() const override
~TruncOperation() noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
bool operator==(const Operation &other) const noexcept override
size_t ndstbits() const noexcept
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
TruncOperation(std::shared_ptr< const jlm::rvsdg::Type > optype, std::shared_ptr< const jlm::rvsdg::Type > restype)
static jlm::rvsdg::Output * create(size_t ndstbits, jlm::rvsdg::Output *operand)
size_t nsrcbits() const noexcept
std::unique_ptr< Operation > copy() const override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
UIToFPOperation(std::shared_ptr< const jlm::rvsdg::Type > optype, std::shared_ptr< const jlm::rvsdg::Type > restype)
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
std::unique_ptr< Operation > copy() const override
~UIToFPOperation() noexcept override
UndefValueOperation class.
UndefValueOperation & operator=(UndefValueOperation &&)=delete
~UndefValueOperation() noexcept override
static jlm::rvsdg::Output * Create(rvsdg::Region ®ion, std::shared_ptr< const jlm::rvsdg::Type > type)
std::string debug_string() const override
static std::unique_ptr< llvm::ThreeAddressCode > Create(std::shared_ptr< const jlm::rvsdg::Type > type, const std::string &name)
UndefValueOperation(const UndefValueOperation &)=default
std::unique_ptr< Operation > copy() const override
static std::unique_ptr< llvm::ThreeAddressCode > Create(std::unique_ptr< ThreeAddressCodeVariable > result)
bool operator==(const Operation &other) const noexcept override
const rvsdg::Type & GetType() const noexcept
UndefValueOperation & operator=(const UndefValueOperation &)=delete
static std::unique_ptr< llvm::ThreeAddressCode > Create(std::shared_ptr< const jlm::rvsdg::Type > type)
static std::shared_ptr< const VariableArgumentType > Create()
const jlm::rvsdg::Type & type() const noexcept
const std::shared_ptr< const jlm::rvsdg::Type > Type() const noexcept
static rvsdg::Output * Create(rvsdg::Region ®ion, const std::vector< rvsdg::Output * > &operands)
VariadicArgumentListOperation(const VariadicArgumentListOperation &)=default
static std::unique_ptr< llvm::ThreeAddressCode > create(const std::vector< const Variable * > &arguments)
std::string debug_string() const override
~VariadicArgumentListOperation() noexcept override
std::unique_ptr< Operation > copy() const override
VariadicArgumentListOperation & operator=(VariadicArgumentListOperation &&)=delete
VariadicArgumentListOperation & operator=(const VariadicArgumentListOperation &)=delete
bool operator==(const Operation &other) const noexcept override
bool operator==(const Operation &other) const noexcept override
std::string debug_string() const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const rvsdg::BinaryOperation &binop, const llvm::Variable *op1, const llvm::Variable *op2, const std::shared_ptr< const jlm::rvsdg::Type > &type)
std::unique_ptr< Operation > copy() const override
VectorBinaryOperation(const VectorBinaryOperation &other)
const rvsdg::BinaryOperation & operation() const noexcept
std::unique_ptr< Operation > op_
~VectorBinaryOperation() noexcept override
VectorBinaryOperation & operator=(const VectorBinaryOperation &other)
VectorBinaryOperation & operator=(VectorBinaryOperation &&other) noexcept
VectorBinaryOperation(VectorBinaryOperation &&other) noexcept
size_t size() const noexcept
std::unique_ptr< Operation > copy() const override
const rvsdg::Type & type() const noexcept
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
static std::unique_ptr< ThreeAddressCode > createVectorSelectTac(const Variable *p, const Variable *t, const Variable *f)
std::string debug_string() const override
VectorSelectOperation(const std::shared_ptr< const VectorType > &pt, const std::shared_ptr< const VectorType > &vt)
bool operator==(const Operation &other) const noexcept override
~VectorSelectOperation() noexcept override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *p, const Variable *t, const Variable *f)
std::unique_ptr< Operation > op_
bool operator==(const Operation &other) const noexcept override
~VectorUnaryOperation() noexcept override
VectorUnaryOperation(const VectorUnaryOperation &other)
static std::unique_ptr< llvm::ThreeAddressCode > create(const rvsdg::UnaryOperation &unop, const llvm::Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
VectorUnaryOperation & operator=(VectorUnaryOperation &&other) noexcept
VectorUnaryOperation & operator=(const VectorUnaryOperation &other)
std::string debug_string() const override
VectorUnaryOperation(VectorUnaryOperation &&other) noexcept
const rvsdg::UnaryOperation & operation() const noexcept
std::unique_ptr< Operation > copy() const override
std::string debug_string() const override
size_t nsrcbits() const noexcept
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
static std::unique_ptr< llvm::ThreeAddressCode > create(const Variable *operand, const std::shared_ptr< const jlm::rvsdg::Type > &type)
bool operator==(const Operation &other) const noexcept override
ZExtOperation(std::shared_ptr< const jlm::rvsdg::Type > srctype, std::shared_ptr< const jlm::rvsdg::Type > dsttype)
~ZExtOperation() noexcept override
ZExtOperation(const std::shared_ptr< const jlm::rvsdg::BitType > &srctype, const std::shared_ptr< const jlm::rvsdg::BitType > &dsttype)
static std::shared_ptr< const rvsdg::BitType > CheckAndExtractBitType(const std::shared_ptr< const rvsdg::Type > &type)
static rvsdg::Output & Create(rvsdg::Output &operand, const std::shared_ptr< const rvsdg::Type > &resultType)
std::unique_ptr< Operation > copy() const override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
size_t ndstbits() const noexcept
BinaryOperation(const std::vector< std::shared_ptr< const jlm::rvsdg::Type >> operands, std::shared_ptr< const jlm::rvsdg::Type > result)
static std::shared_ptr< const BitType > Create(std::size_t nbits)
Creates bit type of specified width.
static std::shared_ptr< const ControlType > Create(std::size_t nalternatives)
Instantiates control type.
virtual const Operation & GetOperation() const noexcept=0
NodeInput * input(size_t index) const noexcept
NodeOutput * output(size_t index) const noexcept
const std::shared_ptr< const rvsdg::Type > & Type() const noexcept
Represent acyclic RVSDG subgraphs.
const std::shared_ptr< const rvsdg::Type > & argument(size_t index) const noexcept
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
size_t nresults() const noexcept
SimpleOperation(std::vector< std::shared_ptr< const jlm::rvsdg::Type >> operands, std::vector< std::shared_ptr< const jlm::rvsdg::Type >> results)
size_t narguments() const noexcept
UnaryOperation(std::shared_ptr< const jlm::rvsdg::Type > operand, std::shared_ptr< const jlm::rvsdg::Type > result)
Global memory state passed between functions.
static ControlFlowGraphNode * aggregate(ControlFlowGraphNode *, ControlFlowGraphNode *, AggregationMap &)
size_t unop_reduction_path_t
static std::string type(const Node *n)
size_t binop_reduction_path_t
@ Value
Designate a value type.
static std::vector< jlm::rvsdg::Output * > operands(const Node *node)
static std::vector< jlm::rvsdg::Output * > outputs(const Node *node)
static std::string strfmt(Args... args)