Jlm
operators.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014 2015 Nico Reißmann <nico.reissmann@gmail.com>
3  * See COPYING for terms of redistribution.
4  */
5 
8 #include <jlm/rvsdg/Trace.hpp>
9 
10 #include <llvm/ADT/SmallVector.h>
11 
12 namespace jlm::llvm
13 {
14 
15 SsaPhiOperation::~SsaPhiOperation() noexcept = default;
16 
17 bool
18 SsaPhiOperation::operator==(const Operation & other) const noexcept
19 {
20  const auto op = dynamic_cast<const SsaPhiOperation *>(&other);
21  return op && op->IncomingNodes_ == IncomingNodes_ && op->result(0) == result(0);
22 }
23 
24 std::string
26 {
27  std::string str("[");
28  for (size_t n = 0; n < narguments(); n++)
29  {
30  str += util::strfmt(GetIncomingNode(n));
31  if (n != narguments() - 1)
32  str += ", ";
33  }
34  str += "]";
35 
36  return "PHI" + str;
37 }
38 
39 std::unique_ptr<rvsdg::Operation>
41 {
42  return std::make_unique<SsaPhiOperation>(*this);
43 }
44 
46 
47 bool
48 AssignmentOperation::operator==(const Operation & other) const noexcept
49 {
50  const auto op = dynamic_cast<const AssignmentOperation *>(&other);
51  return op && op->argument(0) == argument(0);
52 }
53 
54 std::string
56 {
57  return "ASSIGN";
58 }
59 
60 std::unique_ptr<rvsdg::Operation>
62 {
63  return std::make_unique<AssignmentOperation>(*this);
64 }
65 
66 SelectOperation::~SelectOperation() noexcept = default;
67 
68 bool
69 SelectOperation::operator==(const Operation & other) const noexcept
70 {
71  const auto op = dynamic_cast<const SelectOperation *>(&other);
72  return op && op->result(0) == result(0);
73 }
74 
75 std::string
77 {
78  return "Select";
79 }
80 
81 std::unique_ptr<rvsdg::Operation>
83 {
84  return std::make_unique<SelectOperation>(*this);
85 }
86 
88 
89 bool
90 VectorSelectOperation::operator==(const Operation & other) const noexcept
91 {
92  const auto op = dynamic_cast<const VectorSelectOperation *>(&other);
93  return op && op->type() == type();
94 }
95 
96 std::string
98 {
99  return "VectorSelect";
100 }
101 
102 std::unique_ptr<rvsdg::Operation>
104 {
105  return std::make_unique<VectorSelectOperation>(*this);
106 }
107 
109  default;
110 
111 bool
112 FloatingPointToUnsignedIntegerOperation::operator==(const Operation & other) const noexcept
113 {
114  const auto op = dynamic_cast<const FloatingPointToUnsignedIntegerOperation *>(&other);
115  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
116 }
117 
118 std::string
120 {
121  return "FpToUInt";
122 }
123 
124 std::unique_ptr<rvsdg::Operation>
126 {
127  return std::make_unique<FloatingPointToUnsignedIntegerOperation>(*this);
128 }
129 
132 {
134 }
135 
139  rvsdg::Output *) const
140 {
141  JLM_UNREACHABLE("Not implemented");
142 }
143 
145 
146 bool
147 FloatingPointToSignedIntegerOperation::operator==(const Operation & other) const noexcept
148 {
149  const auto op = dynamic_cast<const FloatingPointToSignedIntegerOperation *>(&other);
150  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
151 }
152 
153 std::string
155 {
156  return "FpToSInt";
157 }
158 
159 std::unique_ptr<rvsdg::Operation>
161 {
162  return std::make_unique<FloatingPointToSignedIntegerOperation>(*this);
163 }
164 
167 {
169 }
170 
173  const
174 {
175  JLM_UNREACHABLE("Not implemented!");
176 }
177 
179 
180 bool
181 ControlToIntOperation::operator==(const Operation & other) const noexcept
182 {
183  auto op = dynamic_cast<const ControlToIntOperation *>(&other);
184  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
185 }
186 
187 std::string
189 {
190  return "ControlToInt";
191 }
192 
193 std::unique_ptr<rvsdg::Operation>
195 {
196  return std::make_unique<ControlToIntOperation>(*this);
197 }
198 
199 BranchOperation::~BranchOperation() noexcept = default;
200 
201 bool
202 BranchOperation::operator==(const Operation & other) const noexcept
203 {
204  const auto op = dynamic_cast<const BranchOperation *>(&other);
205  return op && op->argument(0) == argument(0);
206 }
207 
208 std::string
210 {
211  return "Branch";
212 }
213 
214 std::unique_ptr<rvsdg::Operation>
216 {
217  return std::make_unique<BranchOperation>(*this);
218 }
219 
221 
222 bool
223 ConstantPointerNullOperation::operator==(const Operation & other) const noexcept
224 {
225  auto op = dynamic_cast<const ConstantPointerNullOperation *>(&other);
226  return op && op->GetPointerType() == GetPointerType();
227 }
228 
229 std::string
231 {
232  return "ConstantPointerNull";
233 }
234 
235 std::unique_ptr<rvsdg::Operation>
237 {
238  return std::make_unique<ConstantPointerNullOperation>(*this);
239 }
240 
242 
243 bool
244 IntegerToPointerOperation::operator==(const Operation & other) const noexcept
245 {
246  const auto op = dynamic_cast<const IntegerToPointerOperation *>(&other);
247  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
248 }
249 
250 std::string
252 {
253  return "IntToPtr";
254 }
255 
256 std::unique_ptr<rvsdg::Operation>
258 {
259  return std::make_unique<IntegerToPointerOperation>(*this);
260 }
261 
264 {
266 }
267 
270 {
271  JLM_UNREACHABLE("Not implemented!");
272 }
273 
274 PtrToIntOperation::~PtrToIntOperation() noexcept = default;
275 
276 bool
277 PtrToIntOperation::operator==(const Operation & other) const noexcept
278 {
279  const auto op = dynamic_cast<const PtrToIntOperation *>(&other);
280  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
281 }
282 
283 std::string
285 {
286  return "PtrToInt";
287 }
288 
289 std::unique_ptr<rvsdg::Operation>
291 {
292  return std::make_unique<PtrToIntOperation>(*this);
293 }
294 
297 {
299 }
300 
303 {
304  JLM_UNREACHABLE("Not implemented!");
305 }
306 
307 ConstantDataArray::~ConstantDataArray() noexcept = default;
308 
309 bool
310 ConstantDataArray::operator==(const Operation & other) const noexcept
311 {
312  auto op = dynamic_cast<const ConstantDataArray *>(&other);
313  return op && op->result(0) == result(0);
314 }
315 
316 std::string
318 {
319  return "ConstantDataArray";
320 }
321 
322 std::unique_ptr<rvsdg::Operation>
324 {
325  return std::make_unique<ConstantDataArray>(*this);
326 }
327 
328 PtrCmpOperation::~PtrCmpOperation() noexcept = default;
329 
330 bool
331 PtrCmpOperation::operator==(const Operation & other) const noexcept
332 {
333  auto op = dynamic_cast<const PtrCmpOperation *>(&other);
334  return op && op->argument(0) == argument(0) && op->cmp_ == cmp_;
335 }
336 
337 std::string
339 {
340  static std::unordered_map<llvm::cmp, std::string> map({ { cmp::eq, "eq" },
341  { cmp::ne, "ne" },
342  { cmp::gt, "gt" },
343  { cmp::ge, "ge" },
344  { cmp::lt, "lt" },
345  { cmp::le, "le" } });
346 
347  JLM_ASSERT(map.find(cmp()) != map.end());
348  return "PtrCmp " + map[cmp()];
349 }
350 
351 std::unique_ptr<rvsdg::Operation>
353 {
354  return std::make_unique<PtrCmpOperation>(*this);
355 }
356 
359  const noexcept
360 {
362 }
363 
367  rvsdg::Output *,
368  rvsdg::Output *) const
369 {
370  JLM_UNREACHABLE("Not implemented!");
371 }
372 
373 ZExtOperation::~ZExtOperation() noexcept = default;
374 
375 bool
376 ZExtOperation::operator==(const Operation & other) const noexcept
377 {
378  const auto op = dynamic_cast<const ZExtOperation *>(&other);
379  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
380 }
381 
382 std::string
384 {
385  return util::strfmt("ZExt[", nsrcbits(), " -> ", ndstbits(), "]");
386 }
387 
388 std::unique_ptr<rvsdg::Operation>
390 {
391  return std::make_unique<ZExtOperation>(*this);
392 }
393 
395 ZExtOperation::can_reduce_operand(const rvsdg::Output * operand) const noexcept
396 {
397  auto & tracedOperand = rvsdg::traceOutputIntraProcedurally(*operand);
398  if (rvsdg::IsOwnerNodeOperation<rvsdg::BitConstantOperation>(tracedOperand))
400 
402 }
403 
406 {
407  if (path == rvsdg::unop_reduction_constant)
408  {
409  auto & tracedOperand = rvsdg::traceOutputIntraProcedurally(*operand);
410  auto [_, constantOperation] =
411  rvsdg::TryGetSimpleNodeAndOptionalOp<rvsdg::BitConstantOperation>(tracedOperand);
412  JLM_ASSERT(constantOperation);
414  *rvsdg::TryGetOwnerNode<rvsdg::Node>(*operand)->region(),
415  constantOperation->value().zext(ndstbits() - nsrcbits()));
416  }
417 
418  return nullptr;
419 }
420 
421 ConstantFP::~ConstantFP() noexcept = default;
422 
423 bool
424 ConstantFP::operator==(const Operation & other) const noexcept
425 {
426  auto op = dynamic_cast<const ConstantFP *>(&other);
427  return op && size() == op->size() && constant().bitwiseIsEqual(op->constant());
428 }
429 
430 std::string
432 {
433  ::llvm::SmallVector<char, 32> v;
434  constant().toString(v, 32, 0);
435 
436  std::string s("FP(");
437  for (const auto & c : v)
438  s += c;
439  s += ")";
440 
441  return s;
442 }
443 
444 std::unique_ptr<rvsdg::Operation>
446 {
447  return std::make_unique<ConstantFP>(*this);
448 }
449 
450 FCmpOperation::~FCmpOperation() noexcept = default;
451 
452 bool
453 FCmpOperation::operator==(const Operation & other) const noexcept
454 {
455  auto op = dynamic_cast<const FCmpOperation *>(&other);
456  return op && op->argument(0) == argument(0) && op->cmp_ == cmp_;
457 }
458 
459 std::string
461 {
462  static std::unordered_map<fpcmp, std::string> map({ { fpcmp::oeq, "oeq" },
463  { fpcmp::ogt, "ogt" },
464  { fpcmp::oge, "oge" },
465  { fpcmp::olt, "olt" },
466  { fpcmp::ole, "ole" },
467  { fpcmp::one, "one" },
468  { fpcmp::ord, "ord" },
469  { fpcmp::ueq, "ueq" },
470  { fpcmp::ugt, "ugt" },
471  { fpcmp::uge, "uge" },
472  { fpcmp::ult, "ult" },
473  { fpcmp::ule, "ule" },
474  { fpcmp::une, "une" },
475  { fpcmp::uno, "uno" } });
476 
477  JLM_ASSERT(map.find(cmp()) != map.end());
478  return "FCmp " + map[cmp()];
479 }
480 
481 std::unique_ptr<rvsdg::Operation>
483 {
484  return std::make_unique<FCmpOperation>(*this);
485 }
486 
489 {
491 }
492 
495  const
496 {
497  JLM_UNREACHABLE("Not implemented!");
498 }
499 
500 UndefValueOperation::~UndefValueOperation() noexcept = default;
501 
502 bool
503 UndefValueOperation::operator==(const Operation & other) const noexcept
504 {
505  auto op = dynamic_cast<const UndefValueOperation *>(&other);
506  return op && op->GetType() == GetType();
507 }
508 
509 std::string
511 {
512  return "undef";
513 }
514 
515 std::unique_ptr<rvsdg::Operation>
517 {
518  return std::make_unique<UndefValueOperation>(*this);
519 }
520 
522 
523 bool
524 PoisonValueOperation::operator==(const Operation & other) const noexcept
525 {
526  auto operation = dynamic_cast<const PoisonValueOperation *>(&other);
527  return operation && operation->GetType() == GetType();
528 }
529 
530 std::string
532 {
533  return "poison";
534 }
535 
536 std::unique_ptr<rvsdg::Operation>
538 {
539  return std::make_unique<PoisonValueOperation>(*this);
540 }
541 
542 FBinaryOperation::~FBinaryOperation() noexcept = default;
543 
544 bool
545 FBinaryOperation::operator==(const Operation & other) const noexcept
546 {
547  auto op = dynamic_cast<const FBinaryOperation *>(&other);
548  return op && op->fpop() == fpop() && op->size() == size();
549 }
550 
551 std::string
553 {
554  static std::unordered_map<llvm::fpop, std::string> map({ { fpop::add, "add" },
555  { fpop::sub, "sub" },
556  { fpop::mul, "mul" },
557  { fpop::div, "div" },
558  { fpop::mod, "mod" } });
559 
560  JLM_ASSERT(map.find(fpop()) != map.end());
561  return "FPOP " + map[fpop()];
562 }
563 
564 std::unique_ptr<rvsdg::Operation>
566 {
567  return std::make_unique<FBinaryOperation>(*this);
568 }
569 
572  const noexcept
573 {
575 }
576 
580  rvsdg::Output *,
581  rvsdg::Output *) const
582 {
583  JLM_UNREACHABLE("Not implemented!");
584 }
585 
586 FPExtOperation::~FPExtOperation() noexcept = default;
587 
588 bool
589 FPExtOperation::operator==(const Operation & other) const noexcept
590 {
591  const auto op = dynamic_cast<const FPExtOperation *>(&other);
592  return op && op->srcsize() == srcsize() && op->dstsize() == dstsize();
593 }
594 
595 std::string
597 {
598  return "FPExt";
599 }
600 
601 std::unique_ptr<rvsdg::Operation>
603 {
604  return std::make_unique<FPExtOperation>(*this);
605 }
606 
609 {
611 }
612 
615 {
616  JLM_UNREACHABLE("Not implemented!");
617 }
618 
619 FNegOperation::~FNegOperation() noexcept = default;
620 
621 bool
622 FNegOperation::operator==(const Operation & other) const noexcept
623 {
624  const auto op = dynamic_cast<const FNegOperation *>(&other);
625  return op && op->size() == size();
626 }
627 
628 std::string
630 {
631  return "FNeg";
632 }
633 
634 std::unique_ptr<rvsdg::Operation>
636 {
637  return std::make_unique<FNegOperation>(*this);
638 }
639 
642 {
644 }
645 
648 {
649  JLM_UNREACHABLE("Not implemented!");
650 }
651 
652 FPTruncOperation::~FPTruncOperation() noexcept = default;
653 
654 bool
655 FPTruncOperation::operator==(const Operation & other) const noexcept
656 {
657  const auto op = dynamic_cast<const FPTruncOperation *>(&other);
658  return op && op->srcsize() == srcsize() && op->dstsize() == dstsize();
659 }
660 
661 std::string
663 {
664  return "FPTrunc";
665 }
666 
667 std::unique_ptr<rvsdg::Operation>
669 {
670  return std::make_unique<FPTruncOperation>(*this);
671 }
672 
675 {
677 }
678 
681 {
682  JLM_UNREACHABLE("Not implemented!");
683 }
684 
686 
687 bool
688 VariadicArgumentListOperation::operator==(const Operation & other) const noexcept
689 {
690  auto op = dynamic_cast<const VariadicArgumentListOperation *>(&other);
691  if (!op || op->narguments() != narguments())
692  return false;
693 
694  for (size_t n = 0; n < narguments(); n++)
695  {
696  if (op->argument(n) != argument(n))
697  return false;
698  }
699 
700  return true;
701 }
702 
703 std::string
705 {
706  return "VariadicArguments";
707 }
708 
709 std::unique_ptr<rvsdg::Operation>
711 {
712  return std::make_unique<VariadicArgumentListOperation>(*this);
713 }
714 
715 BitCastOperation::~BitCastOperation() noexcept = default;
716 
717 bool
718 BitCastOperation::operator==(const Operation & other) const noexcept
719 {
720  auto op = dynamic_cast<const BitCastOperation *>(&other);
721  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
722 }
723 
724 std::string
726 {
727  return util::strfmt(
728  "BitCast[",
729  argument(0)->debug_string(),
730  " -> ",
731  result(0)->debug_string(),
732  "]");
733 }
734 
735 std::unique_ptr<rvsdg::Operation>
737 {
738  return std::make_unique<BitCastOperation>(*this);
739 }
740 
743 {
745 }
746 
749 {
750  JLM_UNREACHABLE("Not implemented!");
751 }
752 
753 /* ConstantStruct operator */
754 
756 {}
757 
758 bool
759 ConstantStruct::operator==(const Operation & other) const noexcept
760 {
761  auto op = dynamic_cast<const ConstantStruct *>(&other);
762  return op && op->result(0) == result(0);
763 }
764 
765 std::string
767 {
768  return "ConstantStruct";
769 }
770 
771 std::unique_ptr<rvsdg::Operation>
773 {
774  return std::make_unique<ConstantStruct>(*this);
775 }
776 
777 TruncOperation::~TruncOperation() noexcept = default;
778 
779 bool
780 TruncOperation::operator==(const Operation & other) const noexcept
781 {
782  const auto op = dynamic_cast<const TruncOperation *>(&other);
783  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
784 }
785 
786 std::string
788 {
789  return util::strfmt("Trunc[", nsrcbits(), " -> ", ndstbits(), "]");
790 }
791 
792 std::unique_ptr<rvsdg::Operation>
794 {
795  return std::make_unique<TruncOperation>(*this);
796 }
797 
800 {
802 }
803 
806 {
807  JLM_UNREACHABLE("Not implemented!");
808 }
809 
810 UIToFPOperation::~UIToFPOperation() noexcept = default;
811 
812 bool
813 UIToFPOperation::operator==(const Operation & other) const noexcept
814 {
815  const auto op = dynamic_cast<const UIToFPOperation *>(&other);
816  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
817 }
818 
819 std::string
821 {
822  return "UIToFP";
823 }
824 
825 std::unique_ptr<rvsdg::Operation>
827 {
828  return std::make_unique<UIToFPOperation>(*this);
829 }
830 
833 {
835 }
836 
839 {
840  JLM_UNREACHABLE("Not implemented!");
841 }
842 
843 SIToFPOperation::~SIToFPOperation() noexcept = default;
844 
845 bool
846 SIToFPOperation::operator==(const Operation & other) const noexcept
847 {
848  const auto op = dynamic_cast<const SIToFPOperation *>(&other);
849  return op && op->argument(0) == argument(0) && op->result(0) == result(0);
850 }
851 
852 std::string
854 {
855  return "SIToFP";
856 }
857 
858 std::unique_ptr<rvsdg::Operation>
860 {
861  return std::make_unique<SIToFPOperation>(*this);
862 }
863 
866 {
868 }
869 
872 {
873  JLM_UNREACHABLE("Not implemented!");
874 }
875 
877 
878 bool
879 ConstantArrayOperation::operator==(const Operation & other) const noexcept
880 {
881  const auto op = dynamic_cast<const ConstantArrayOperation *>(&other);
882  return op && op->result(0) == result(0);
883 }
884 
885 std::string
887 {
888  return "ConstantArray";
889 }
890 
891 std::unique_ptr<rvsdg::Operation>
893 {
894  return std::make_unique<ConstantArrayOperation>(*this);
895 }
896 
898 
899 bool
900 ConstantAggregateZeroOperation::operator==(const Operation & other) const noexcept
901 {
902  const auto op = dynamic_cast<const ConstantAggregateZeroOperation *>(&other);
903  return op && op->result(0) == result(0);
904 }
905 
906 std::string
908 {
909  return "ConstantAggregateZero";
910 }
911 
912 std::unique_ptr<rvsdg::Operation>
914 {
915  return std::make_unique<ConstantAggregateZeroOperation>(*this);
916 }
917 
919 
920 bool
921 ExtractElementOperation::operator==(const Operation & other) const noexcept
922 {
923  auto op = dynamic_cast<const ExtractElementOperation *>(&other);
924  return op && op->argument(0) == argument(0) && op->argument(1) == argument(1);
925 }
926 
927 std::string
929 {
930  return "ExtractElement";
931 }
932 
933 std::unique_ptr<rvsdg::Operation>
935 {
936  return std::make_unique<ExtractElementOperation>(*this);
937 }
938 
940 
941 bool
942 ShuffleVectorOperation::operator==(const Operation & other) const noexcept
943 {
944  auto op = dynamic_cast<const ShuffleVectorOperation *>(&other);
945  return op && op->argument(0) == argument(0) && op->Mask() == Mask();
946 }
947 
948 std::string
950 {
951  return "ShuffleVector";
952 }
953 
954 std::unique_ptr<rvsdg::Operation>
956 {
957  return std::make_unique<ShuffleVectorOperation>(*this);
958 }
959 
961 
962 bool
963 ConstantVectorOperation::operator==(const Operation & other) const noexcept
964 {
965  auto op = dynamic_cast<const ConstantVectorOperation *>(&other);
966  return op && op->result(0) == result(0);
967 }
968 
969 std::string
971 {
972  return "ConstantVector";
973 }
974 
975 std::unique_ptr<rvsdg::Operation>
977 {
978  return std::make_unique<ConstantVectorOperation>(*this);
979 }
980 
982 
983 bool
984 InsertElementOperation::operator==(const Operation & other) const noexcept
985 {
986  auto op = dynamic_cast<const InsertElementOperation *>(&other);
987  return op && op->argument(0) == argument(0) && op->argument(1) == argument(1)
988  && op->argument(2) == argument(2);
989 }
990 
991 std::string
993 {
994  return "InsertElement";
995 }
996 
997 std::unique_ptr<rvsdg::Operation>
999 {
1000  return std::make_unique<InsertElementOperation>(*this);
1001 }
1002 
1003 VectorUnaryOperation::~VectorUnaryOperation() noexcept = default;
1004 
1005 bool
1006 VectorUnaryOperation::operator==(const Operation & other) const noexcept
1007 {
1008  auto op = dynamic_cast<const VectorUnaryOperation *>(&other);
1009  return op && op->operation() == operation();
1010 }
1011 
1012 std::string
1014 {
1015  return util::strfmt("Vector", operation().debug_string());
1016 }
1017 
1018 std::unique_ptr<rvsdg::Operation>
1020 {
1021  return std::make_unique<VectorUnaryOperation>(*this);
1022 }
1023 
1025 
1026 bool
1027 VectorBinaryOperation::operator==(const Operation & other) const noexcept
1028 {
1029  auto op = dynamic_cast<const VectorBinaryOperation *>(&other);
1030  return op && op->operation() == operation();
1031 }
1032 
1033 std::string
1035 {
1036  return util::strfmt("Vector", operation().debug_string());
1037 }
1038 
1039 std::unique_ptr<rvsdg::Operation>
1041 {
1042  return std::make_unique<VectorBinaryOperation>(*this);
1043 }
1044 
1046 
1047 bool
1048 ConstantDataVectorOperation::operator==(const Operation & other) const noexcept
1049 {
1050  auto op = dynamic_cast<const ConstantDataVectorOperation *>(&other);
1051  return op && op->result(0) == result(0);
1052 }
1053 
1054 std::string
1056 {
1057  return "ConstantDataVector";
1058 }
1059 
1060 std::unique_ptr<rvsdg::Operation>
1062 {
1063  return std::make_unique<ConstantDataVectorOperation>(*this);
1064 }
1065 
1067 
1068 bool
1069 ExtractValueOperation::operator==(const Operation & other) const noexcept
1070 {
1071  auto op = dynamic_cast<const ExtractValueOperation *>(&other);
1072  return op && op->indices_ == indices_ && op->type() == type();
1073 }
1074 
1075 std::string
1077 {
1078  return "ExtractValue";
1079 }
1080 
1081 std::unique_ptr<rvsdg::Operation>
1083 {
1084  return std::make_unique<ExtractValueOperation>(*this);
1085 }
1086 
1087 MallocOperation::~MallocOperation() noexcept = default;
1088 
1089 bool
1090 MallocOperation::operator==(const Operation & other) const noexcept
1091 {
1092  // Avoid CNE for malloc operator
1093  return this == &other;
1094 }
1095 
1096 std::string
1098 {
1099  return "Malloc";
1100 }
1101 
1102 std::unique_ptr<rvsdg::Operation>
1104 {
1105  return std::make_unique<MallocOperation>(*this);
1106 }
1107 
1108 /* free operator */
1109 
1110 FreeOperation::~FreeOperation() noexcept = default;
1111 
1112 bool
1113 FreeOperation::operator==(const Operation & other) const noexcept
1114 {
1115  // Avoid CNE for free operator
1116  return this == &other;
1117 }
1118 
1119 std::string
1121 {
1122  return "FREE";
1123 }
1124 
1125 std::unique_ptr<rvsdg::Operation>
1127 {
1128  return std::make_unique<FreeOperation>(*this);
1129 }
1130 
1131 }
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:61
~AssignmentOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:55
std::string debug_string() const override
Definition: operators.cpp:725
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:736
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:748
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:742
~BitCastOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:209
~BranchOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:215
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:913
~ConstantAggregateZeroOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:907
~ConstantArrayOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:892
std::string debug_string() const override
Definition: operators.cpp:886
~ConstantDataArray() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:323
std::string debug_string() const override
Definition: operators.cpp:317
~ConstantDataVectorOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:1061
std::string debug_string() const override
Definition: operators.cpp:1055
~ConstantFP() noexcept override
const fpsize & size() const noexcept
Definition: operators.hpp:880
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:445
const ::llvm::APFloat & constant() const noexcept
Definition: operators.hpp:874
std::string debug_string() const override
Definition: operators.cpp:431
ConstantPointerNullOperation class.
Definition: operators.hpp:430
std::string debug_string() const override
Definition: operators.cpp:230
const PointerType & GetPointerType() const noexcept
Definition: operators.hpp:448
~ConstantPointerNullOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:236
bool operator==(const Operation &other) const noexcept override
Definition: operators.cpp:759
std::string debug_string() const override
Definition: operators.cpp:766
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:772
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:976
~ConstantVectorOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:970
std::string debug_string() const override
Definition: operators.cpp:188
~ControlToIntOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:194
std::string debug_string() const override
Definition: operators.cpp:928
~ExtractElementOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:934
std::vector< unsigned > indices_
Definition: operators.hpp:2394
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:1082
std::string debug_string() const override
Definition: operators.cpp:1076
~ExtractValueOperation() noexcept override
const llvm::fpop & fpop() const noexcept
Definition: operators.hpp:1170
std::string debug_string() const override
Definition: operators.cpp:552
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
Definition: operators.cpp:571
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:565
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
Definition: operators.cpp:578
~FBinaryOperation() 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
Definition: operators.cpp:488
const fpcmp & cmp() const noexcept
Definition: operators.hpp:961
~FCmpOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:460
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
Definition: operators.cpp:494
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:482
const fpsize & size() const noexcept
Definition: operators.hpp:1308
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:647
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:641
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:635
~FNegOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:629
~FPExtOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:596
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:614
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:608
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:602
const fpsize & srcsize() const noexcept
Definition: operators.hpp:1251
const fpsize & srcsize() const noexcept
Definition: operators.hpp:1382
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:674
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:668
std::string debug_string() const override
Definition: operators.cpp:662
~FPTruncOperation() noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:680
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:172
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:166
std::string debug_string() const override
Definition: operators.cpp:154
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:160
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:137
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:131
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:125
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:1126
~FreeOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:1120
std::string debug_string() const override
Definition: operators.cpp:992
~InsertElementOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:998
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:257
std::string debug_string() const override
Definition: operators.cpp:251
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:263
~IntegerToPointerOperation() noexcept override
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:269
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:1103
std::string debug_string() const override
Definition: operators.cpp:1097
~MallocOperation() noexcept override
PoisonValueOperation class.
Definition: operators.hpp:1061
~PoisonValueOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:531
const jlm::rvsdg::Type & GetType() const noexcept
Definition: operators.hpp:1089
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:537
~PtrCmpOperation() noexcept override
llvm::cmp cmp() const noexcept
Definition: operators.hpp:724
jlm::rvsdg::binop_reduction_path_t can_reduce_operand_pair(const jlm::rvsdg::Output *op1, const jlm::rvsdg::Output *op2) const noexcept override
Definition: operators.cpp:358
std::string debug_string() const override
Definition: operators.cpp:338
jlm::rvsdg::Output * reduce_operand_pair(jlm::rvsdg::binop_reduction_path_t path, jlm::rvsdg::Output *op1, jlm::rvsdg::Output *op2) const override
Definition: operators.cpp:365
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:352
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:290
std::string debug_string() const override
Definition: operators.cpp:284
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:296
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:302
~PtrToIntOperation() noexcept override
~SIToFPOperation() noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *output) const noexcept override
Definition: operators.cpp:865
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:859
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *output) const override
Definition: operators.cpp:871
std::string debug_string() const override
Definition: operators.cpp:853
std::string debug_string() const override
Definition: operators.cpp:76
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:82
~SelectOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:949
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:955
~ShuffleVectorOperation() noexcept override
ControlFlowGraphNode * GetIncomingNode(size_t n) const noexcept
Definition: operators.hpp:67
std::string debug_string() const override
Definition: operators.cpp:25
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:40
~SsaPhiOperation() noexcept override
std::vector< ControlFlowGraphNode * > IncomingNodes_
Definition: operators.hpp:91
std::string debug_string() const override
Definition: operators.cpp:787
~TruncOperation() noexcept override
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
Definition: operators.cpp:799
size_t ndstbits() const noexcept
Definition: operators.hpp:1655
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
Definition: operators.cpp:805
size_t nsrcbits() const noexcept
Definition: operators.hpp:1649
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:793
std::string debug_string() const override
Definition: operators.cpp:820
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
Definition: operators.cpp:832
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
Definition: operators.cpp:838
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:826
~UIToFPOperation() noexcept override
UndefValueOperation class.
Definition: operators.hpp:992
~UndefValueOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:510
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:516
const rvsdg::Type & GetType() const noexcept
Definition: operators.hpp:1018
std::string debug_string() const override
Definition: operators.cpp:704
~VariadicArgumentListOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:710
std::string debug_string() const override
Definition: operators.cpp:1034
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:1040
const rvsdg::BinaryOperation & operation() const noexcept
Definition: operators.hpp:2230
~VectorBinaryOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:103
const rvsdg::Type & type() const noexcept
Definition: operators.hpp:188
std::string debug_string() const override
Definition: operators.cpp:97
~VectorSelectOperation() noexcept override
~VectorUnaryOperation() noexcept override
std::string debug_string() const override
Definition: operators.cpp:1013
const rvsdg::UnaryOperation & operation() const noexcept
Definition: operators.hpp:2137
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:1019
std::string debug_string() const override
Definition: operators.cpp:383
size_t nsrcbits() const noexcept
Definition: operators.hpp:799
jlm::rvsdg::Output * reduce_operand(jlm::rvsdg::unop_reduction_path_t path, jlm::rvsdg::Output *operand) const override
Definition: operators.cpp:405
~ZExtOperation() noexcept override
std::unique_ptr< Operation > copy() const override
Definition: operators.cpp:389
jlm::rvsdg::unop_reduction_path_t can_reduce_operand(const jlm::rvsdg::Output *operand) const noexcept override
Definition: operators.cpp:395
size_t ndstbits() const noexcept
Definition: operators.hpp:805
static Output & create(Region &region, BitValueRepresentation value)
Definition: constant.hpp:44
const std::shared_ptr< const rvsdg::Type > & argument(size_t index) const noexcept
Definition: operation.cpp:23
const std::shared_ptr< const rvsdg::Type > & result(size_t index) const noexcept
Definition: operation.cpp:36
size_t narguments() const noexcept
Definition: operation.cpp:17
#define JLM_ASSERT(x)
Definition: common.hpp:16
#define JLM_UNREACHABLE(msg)
Definition: common.hpp:43
Global memory state passed between functions.
size_t unop_reduction_path_t
Definition: unary.hpp:18
static std::string type(const Node *n)
Definition: view.cpp:255
size_t binop_reduction_path_t
Definition: binary.hpp:19
static const unop_reduction_path_t unop_reduction_constant
Definition: unary.hpp:45
static const unop_reduction_path_t unop_reduction_none
Definition: unary.hpp:43
Output & traceOutputIntraProcedurally(Output &output)
Definition: Trace.cpp:223
static const binop_reduction_path_t binop_reduction_none
Definition: binary.hpp:203
static std::string strfmt(Args... args)
Definition: strfmt.hpp:35