LLVM: include/llvm/CodeGen/GlobalISel/LegalizerInfo.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H
15#define LLVM_CODEGEN_GLOBALISEL_LEGALIZERINFO_H
16
27#include
28#include
29#include
30#include
31
32namespace llvm {
33
35
43
46
47
49
50
51
52
54
55
56
57
59
60
61
62
63
64
65
67
68
69
70
71
73
74
76
77
78
80
81
82
83
85
86
87
89
90
91
93
94
96
97
98
100};
101}
104
106
107
108
109
110
114
120
127 : MemDesc(MMO.getMemoryType(), MMO.getAlign().value() * 8,
128 MMO.getSuccessOrdering(), MMO.getFailureOrdering()) {}
129 };
130
131
132
134
138
139 LLVM_ABI raw_ostream &print(raw_ostream &OS) const;
140};
141
142
143
144
146
148
150
152
156
159 switch (Step.Action) {
160 case LegacyLegalizeActions::Legal:
161 Action = LegalizeActions::Legal;
162 break;
163 case LegacyLegalizeActions::NarrowScalar:
164 Action = LegalizeActions::NarrowScalar;
165 break;
166 case LegacyLegalizeActions::WidenScalar:
167 Action = LegalizeActions::WidenScalar;
168 break;
169 case LegacyLegalizeActions::FewerElements:
170 Action = LegalizeActions::FewerElements;
171 break;
172 case LegacyLegalizeActions::MoreElements:
173 Action = LegalizeActions::MoreElements;
174 break;
175 case LegacyLegalizeActions::Bitcast:
176 Action = LegalizeActions::Bitcast;
177 break;
178 case LegacyLegalizeActions::Lower:
179 Action = LegalizeActions::Lower;
180 break;
181 case LegacyLegalizeActions::Libcall:
182 Action = LegalizeActions::Libcall;
183 break;
184 case LegacyLegalizeActions::Custom:
185 Action = LegalizeActions::Custom;
186 break;
187 case LegacyLegalizeActions::Unsupported:
188 Action = LegalizeActions::Unsupported;
189 break;
190 case LegacyLegalizeActions::NotFound:
191 Action = LegalizeActions::NotFound;
192 break;
193 }
194 }
195
198 std::tie(RHS.Action, RHS.TypeIdx, RHS.NewType);
199 }
200};
201
204 std::function<std::pair<unsigned, LLT>(const LegalityQuery &)>;
205
212
217
218
219
223
224
225 MemTy.getSizeInBits() == Other.MemTy.getSizeInBits();
226 }
227};
228
229
231 return [=](const LegalityQuery &Query) { return (Query); };
232}
233
234
235template
238 return P0(Query) && P1(Query);
239 };
240}
241
242template<typename Predicate, typename... Args>
246
247
248template
251 return P0(Query) || P1(Query);
252 };
253}
254
255template<typename Predicate, typename... Args>
259
260
262
264 std::initializer_list TypesInit);
265
266
269 return Query.Types[TypeIdx] != Type;
270 };
271}
272
273
274
276typePairInSet(unsigned TypeIdx0, unsigned TypeIdx1,
277 std::initializer_list<std::pair<LLT, LLT>> TypesInit);
278
279
281typeTupleInSet(unsigned TypeIdx0, unsigned TypeIdx1, unsigned Type2,
282 std::initializer_list<std::tuple<LLT, LLT, LLT>> TypesInit);
283
284
286 unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx,
287 std::initializer_list TypesAndMemDescInit);
288
290
292
294
295
297
298
300
301
303
304
305
307
308
309
311
312
313
315 unsigned Size);
316
317
318
320 unsigned Size);
321
322
323
326
327
328
330 unsigned Size);
331
332
333
335
336
337
339
340
341
343
344
346
347
349
350
351
353
354
355
357
358
359
361
362
363
365
366
367
369
370
373}
374
376
378
379
381
382
384 unsigned FromTypeIdx);
385
386
388
389
390
392 unsigned FromTypeIdx);
393
394
395
398
399
400
401
403 unsigned FromTypeIdx);
404
405
406
408 unsigned Min = 0);
409
410
411
413 unsigned Size);
414
415
416
418 unsigned Min = 0);
419
421}
422
423
424
425
426
431
432public:
435 : Predicate(Predicate), Action(Action), Mutation(Mutation) {}
436
437
439 return Predicate(Query);
440 }
441
443
444
446 if (Mutation)
448 return std::make_pair(0, LLT{});
449 }
450};
451
453
454 unsigned AliasOf = 0;
455
456 bool IsAliasedByAnother = false;
458
459#ifndef NDEBUG
460
461
462
463
464
465
466
471#endif
472
473 unsigned typeIdx(unsigned TypeIdx) {
476 "Type Index is out of bounds");
477#ifndef NDEBUG
478 TypeIdxsCovered.set(TypeIdx);
479#endif
480 return TypeIdx;
481 }
482
483 void markAllIdxsAsCovered() {
484#ifndef NDEBUG
485 TypeIdxsCovered.set();
486 ImmIdxsCovered.set();
487#endif
488 }
489
491 assert(AliasOf == 0 &&
492 "RuleSet is aliased, change the representative opcode instead");
493 Rules.push_back(Rule);
494 }
495
496 static bool always(const LegalityQuery &) { return true; }
497
498
499
503 return *this;
504 }
505
506
510 return *this;
511 }
512
513
515 std::initializer_list Types) {
517 return actionIf(Action, typeInSet(typeIdx(0), Types));
518 }
519
520
522 std::initializer_list Types,
525 return actionIf(Action, typeInSet(typeIdx(0), Types), Mutation);
526 }
527
528
529
531 std::initializer_list<std::pair<LLT, LLT>> Types) {
533 return actionIf(Action, typePairInSet(typeIdx(0), typeIdx(1), Types));
534 }
535
538 std::initializer_list<std::tuple<LLT, LLT, LLT>> Types) {
540 return actionIf(Action,
541 typeTupleInSet(typeIdx(0), typeIdx(1), typeIdx(2), Types));
542 }
543
544
545
546
548 std::initializer_list<std::pair<LLT, LLT>> Types,
551 return actionIf(Action, typePairInSet(typeIdx(0), typeIdx(1), Types),
553 }
554
555
556
558 std::initializer_list Types) {
560 immIdx(0);
561 return actionIf(Action, typeInSet(typeIdx(0), Types));
562 }
563
565 LegalizeAction Action, std::initializer_list<std::pair<LLT, LLT>> Types) {
567 immIdx(0);
568 return actionIf(Action, typePairInSet(typeIdx(0), typeIdx(1), Types));
569 }
570
571
572
573
575 std::initializer_list Types) {
577 return actionIf(Action, all(typeInSet(typeIdx(0), Types),
578 typeInSet(typeIdx(1), Types)));
579 }
580
581
582
583
586 std::initializer_list Types0,
587 std::initializer_list Types1) {
589 return actionIf(Action, all(typeInSet(typeIdx(0), Types0),
590 typeInSet(typeIdx(1), Types1)));
591 }
592
593
594
595
597 LegalizeAction Action, std::initializer_list Types0,
598 std::initializer_list Types1, std::initializer_list Types2) {
600 return actionIf(Action, all(typeInSet(typeIdx(0), Types0),
601 all(typeInSet(typeIdx(1), Types1),
602 typeInSet(typeIdx(2), Types2))));
603 }
604
605public:
607
611 assert((AliasOf == 0 || AliasOf == Opcode) &&
612 "Opcode is already aliased to another opcode");
613 assert(Rules.empty() && "Aliasing will discard rules");
614 AliasOf = Opcode;
615 }
616 unsigned getAlias() const { return AliasOf; }
617
618 unsigned immIdx(unsigned ImmIdx) {
621 "Imm Index is out of bounds");
622#ifndef NDEBUG
623 ImmIdxsCovered.set(ImmIdx);
624#endif
625 return ImmIdx;
626 }
627
628
630
631
632 markAllIdxsAsCovered();
633 return actionIf(LegalizeAction::Legal, Predicate);
634 }
635
637 return actionFor(LegalizeAction::Legal, Types);
638 }
640 if (!Pred)
641 return *this;
642 return actionFor(LegalizeAction::Legal, Types);
643 }
644
645
647 return actionFor(LegalizeAction::Legal, Types);
648 }
650 std::initializer_list<std::pair<LLT, LLT>> Types) {
651 if (!Pred)
652 return *this;
653 return actionFor(LegalizeAction::Legal, Types);
654 }
656 legalFor(bool Pred, std::initializer_list<std::tuple<LLT, LLT, LLT>> Types) {
657 if (!Pred)
658 return *this;
659 return actionFor(LegalizeAction::Legal, Types);
660 }
661
662
664 markAllIdxsAsCovered();
665 return actionForTypeWithAnyImm(LegalizeAction::Legal, Types);
666 }
667
669 std::initializer_list<std::pair<LLT, LLT>> Types) {
670 markAllIdxsAsCovered();
671 return actionForTypeWithAnyImm(LegalizeAction::Legal, Types);
672 }
673
674
675
677 std::initializer_listLegalityPredicates::TypePairAndMemDesc
678 TypesAndMemDesc) {
679 return actionIf(LegalizeAction::Legal,
681 typeIdx(0), typeIdx(1), 0, TypesAndMemDesc));
682 }
683
684
686 return actionForCartesianProduct(LegalizeAction::Legal, Types);
687 }
688
689
691 std::initializer_list Types1) {
692 return actionForCartesianProduct(LegalizeAction::Legal, Types0, Types1);
693 }
694
695
697 std::initializer_list Types1,
698 std::initializer_list Types2) {
699 return actionForCartesianProduct(LegalizeAction::Legal, Types0, Types1,
700 Types2);
701 }
702
705 markAllIdxsAsCovered();
706 return actionIf(LegalizeAction::Legal, always);
707 }
708
709
712
713
714 markAllIdxsAsCovered();
716 }
717
718
721
722
723 markAllIdxsAsCovered();
724 return actionIf(LegalizeAction::Lower, always);
725 }
726
727
730
731
732 markAllIdxsAsCovered();
733 return actionIf(LegalizeAction::Lower, Predicate);
734 }
735
738
739
740 markAllIdxsAsCovered();
742 }
743
744
746 return actionFor(LegalizeAction::Lower, Types);
747 }
748
749
752 return actionFor(LegalizeAction::Lower, Types, Mutation);
753 }
754
755
757 return actionFor(LegalizeAction::Lower, Types);
758 }
759
760
763 return actionFor(LegalizeAction::Lower, Types, Mutation);
764 }
765
766
768 std::initializer_list Types1) {
770 return actionForCartesianProduct(LegalizeAction::Lower, Types0, Types1);
771 }
772
773
775 std::initializer_list Types1,
776 std::initializer_list Types2) {
778 return actionForCartesianProduct(LegalizeAction::Lower, Types0, Types1,
779 Types2);
780 }
781
782
785
786
787 markAllIdxsAsCovered();
788 return actionIf(LegalizeAction::Libcall, always);
789 }
790
791
793
794
795 markAllIdxsAsCovered();
796 return actionIf(LegalizeAction::Libcall, Predicate);
797 }
799 return actionFor(LegalizeAction::Libcall, Types);
800 }
802 if (!Pred)
803 return *this;
804 return actionFor(LegalizeAction::Libcall, Types);
805 }
807 libcallFor(std::initializer_list<std::pair<LLT, LLT>> Types) {
808 return actionFor(LegalizeAction::Libcall, Types);
809 }
811 libcallFor(bool Pred, std::initializer_list<std::pair<LLT, LLT>> Types) {
812 if (!Pred)
813 return *this;
814 return actionFor(LegalizeAction::Libcall, Types);
815 }
818 return actionForCartesianProduct(LegalizeAction::Libcall, Types);
819 }
822 std::initializer_list Types1) {
823 return actionForCartesianProduct(LegalizeAction::Libcall, Types0, Types1);
824 }
825
826
827
830
831
832 markAllIdxsAsCovered();
833 return actionIf(LegalizeAction::WidenScalar, Predicate, Mutation);
834 }
835
836
839
840
841 markAllIdxsAsCovered();
842 return actionIf(LegalizeAction::NarrowScalar, Predicate, Mutation);
843 }
844
845
849 return actionFor(LegalizeAction::NarrowScalar, Types, Mutation);
850 }
851
852
853
856
857
858 markAllIdxsAsCovered();
859 return actionIf(LegalizeAction::MoreElements, Predicate, Mutation);
860 }
861
862
865
866
867 markAllIdxsAsCovered();
868 return actionIf(LegalizeAction::FewerElements, Predicate, Mutation);
869 }
870
871
873 markAllIdxsAsCovered();
874 return actionIf(LegalizeAction::Unsupported, always);
875 }
877 return actionIf(LegalizeAction::Unsupported, Predicate);
878 }
879
881 return actionFor(LegalizeAction::Unsupported, Types);
882 }
883
885 return actionIf(LegalizeAction::Unsupported,
887 }
888
889
890
891
893 return actionIf(LegalizeAction::Lower,
895 }
896
897
898
899
901 return actionIf(LegalizeAction::Lower,
903 }
904
906
907
908 markAllIdxsAsCovered();
909 return actionIf(LegalizeAction::Custom, Predicate);
910 }
912 return actionFor(LegalizeAction::Custom, Types);
913 }
915 if (!Pred)
916 return *this;
917 return actionFor(LegalizeAction::Custom, Types);
918 }
919
920
921
923 return actionFor(LegalizeAction::Custom, Types);
924 }
926 std::initializer_list<std::pair<LLT, LLT>> Types) {
927 if (!Pred)
928 return *this;
929 return actionFor(LegalizeAction::Custom, Types);
930 }
931
933 return actionForCartesianProduct(LegalizeAction::Custom, Types);
934 }
935
936
939 std::initializer_list Types1) {
940 return actionForCartesianProduct(LegalizeAction::Custom, Types0, Types1);
941 }
942
943
946 std::initializer_list Types1,
947 std::initializer_list Types2) {
948 return actionForCartesianProduct(LegalizeAction::Custom, Types0, Types1,
949 Types2);
950 }
951
952
953
956 std::initializer_list Types1) {
957 if (!Pred)
958 return *this;
959 return actionForCartesianProduct(LegalizeAction::Custom, Types0, Types1);
960 }
961
962
966
967
968
969
971 unsigned MinSize = 0) {
973 return actionIf(
974 LegalizeAction::WidenScalar, sizeNotPow2(typeIdx(TypeIdx)),
976 }
977
978
979
981 unsigned Size) {
983 return actionIf(
984 LegalizeAction::WidenScalar, sizeNotMultipleOf(typeIdx(TypeIdx), Size),
986 }
987
988
989
991 unsigned MinSize = 0) {
993 return actionIf(
994 LegalizeAction::WidenScalar, scalarOrEltSizeNotPow2(typeIdx(TypeIdx)),
996 }
997
998
999
1001 unsigned MinSize = 0) {
1003 return actionIf(
1004 LegalizeAction::WidenScalar,
1005 any(scalarOrEltNarrowerThan(TypeIdx, MinSize),
1006 scalarOrEltSizeNotPow2(typeIdx(TypeIdx))),
1008 }
1009
1012 return actionIf(LegalizeAction::NarrowScalar, isScalar(typeIdx(TypeIdx)),
1014 }
1015
1018 return actionIf(LegalizeAction::FewerElements, isVector(typeIdx(TypeIdx)),
1020 }
1021
1024 return actionIf(LegalizeAction::FewerElements,
1025 all(Predicate, isVector(typeIdx(TypeIdx))),
1027 }
1028
1029
1033 return actionIf(LegalizeAction::WidenScalar,
1034 scalarOrEltNarrowerThan(TypeIdx, Ty.getScalarSizeInBits()),
1035 changeElementTo(typeIdx(TypeIdx), Ty));
1036 }
1037
1038
1040 unsigned TypeIdx, const LLT Ty) {
1043 return actionIf(LegalizeAction::WidenScalar,
1044 all(Predicate, scalarOrEltNarrowerThan(
1045 TypeIdx, Ty.getScalarSizeInBits())),
1046 changeElementTo(typeIdx(TypeIdx), Ty));
1047 }
1048
1049
1050
1052 unsigned VectorSize) {
1055 return actionIf(
1056 LegalizeAction::WidenScalar,
1058 const LLT VecTy = Query.Types[TypeIdx];
1060 },
1062 const LLT VecTy = Query.Types[TypeIdx];
1064 unsigned MinSize = VectorSize / NumElts;
1066 return std::make_pair(TypeIdx, NewTy);
1067 });
1068 }
1069
1070
1074 return actionIf(LegalizeAction::WidenScalar,
1075 scalarNarrowerThan(TypeIdx, Ty.getSizeInBits()),
1076 changeTo(typeIdx(TypeIdx), Ty));
1077 }
1079 if (!Pred)
1080 return *this;
1082 }
1083
1084
1086 const LLT Ty) {
1089 return actionIf(
1090 LegalizeAction::WidenScalar,
1092 const LLT QueryTy = Query.Types[TypeIdx];
1093 return QueryTy.isScalar() &&
1096 },
1097 changeTo(typeIdx(TypeIdx), Ty));
1098 }
1099
1100
1104 return actionIf(LegalizeAction::NarrowScalar,
1105 scalarOrEltWiderThan(TypeIdx, Ty.getScalarSizeInBits()),
1106 changeElementTo(typeIdx(TypeIdx), Ty));
1107 }
1108
1109
1113 return actionIf(LegalizeAction::NarrowScalar,
1114 scalarWiderThan(TypeIdx, Ty.getSizeInBits()),
1115 changeTo(typeIdx(TypeIdx), Ty));
1116 }
1117
1118
1119
1120
1122 const LLT Ty) {
1125 return actionIf(
1126 LegalizeAction::NarrowScalar,
1128 const LLT QueryTy = Query.Types[TypeIdx];
1129 return QueryTy.isScalar() &&
1132 },
1133 changeElementTo(typeIdx(TypeIdx), Ty));
1134 }
1135
1136
1138 const LLT MaxTy) {
1141 }
1142
1144 const LLT MaxTy) {
1145 if (!Pred)
1146 return *this;
1147 return clampScalar(TypeIdx, MinTy, MaxTy);
1148 }
1149
1150
1152 const LLT MaxTy) {
1154 }
1155
1156
1158 typeIdx(TypeIdx);
1159 return actionIf(
1160 LegalizeAction::WidenScalar,
1162 return Query.Types[LargeTypeIdx].getScalarSizeInBits() >
1163 Query.Types[TypeIdx].getSizeInBits();
1164 },
1166 }
1167
1168
1170 typeIdx(TypeIdx);
1171 return actionIf(
1172 LegalizeAction::NarrowScalar,
1174 return Query.Types[NarrowTypeIdx].getScalarSizeInBits() <
1175 Query.Types[TypeIdx].getSizeInBits();
1176 },
1178 }
1179
1180
1181
1186
1187
1189 unsigned TypeIdx, unsigned LargeTypeIdx) {
1190 typeIdx(TypeIdx);
1193 return Query.Types[LargeTypeIdx].getScalarSizeInBits() >
1194 Query.Types[TypeIdx].getScalarSizeInBits() &&
1196 },
1198 LLT T = Query.Types[LargeTypeIdx];
1199 if (T.isPointerVector())
1200 T = T.changeElementType(LLT::scalar(T.getScalarSizeInBits()));
1201 return std::make_pair(TypeIdx, T);
1202 });
1203 }
1204
1205
1207 unsigned TypeIdx,
1208 unsigned SmallTypeIdx) {
1209 typeIdx(TypeIdx);
1212 return Query.Types[SmallTypeIdx].getScalarSizeInBits() <
1213 Query.Types[TypeIdx].getScalarSizeInBits() &&
1215 },
1217 LLT T = Query.Types[SmallTypeIdx];
1218 return std::make_pair(TypeIdx, T);
1219 });
1220 }
1221
1222
1223
1224
1227 return actionIf(LegalizeAction::MoreElements,
1228 numElementsNotPow2(typeIdx(TypeIdx)),
1230 }
1231
1232
1234 unsigned MinElements) {
1235
1236 typeIdx(TypeIdx);
1237 return actionIf(
1238 LegalizeAction::MoreElements,
1240 LLT VecTy = Query.Types[TypeIdx];
1243 },
1245 LLT VecTy = Query.Types[TypeIdx];
1246 return std::make_pair(
1248 });
1249 }
1250
1251
1253 unsigned NumElts) {
1254 typeIdx(TypeIdx);
1255 return actionIf(
1256 LegalizeAction::MoreElements,
1258 LLT VecTy = Query.Types[TypeIdx];
1261 },
1263 LLT VecTy = Query.Types[TypeIdx];
1265 return std::make_pair(
1267 });
1268 }
1269
1270
1272 unsigned MaxElements) {
1273
1274 typeIdx(TypeIdx);
1275 return actionIf(
1276 LegalizeAction::FewerElements,
1278 LLT VecTy = Query.Types[TypeIdx];
1281 },
1283 LLT VecTy = Query.Types[TypeIdx];
1286 return std::make_pair(TypeIdx, NewTy);
1287 });
1288 }
1289
1290
1291
1292
1293
1294
1296 const LLT MaxTy) {
1298 "Expected element types to agree");
1299
1301 "Unexpected scalable vectors");
1302
1306 }
1307
1308
1309
1310
1311
1312
1313
1314
1316 unsigned NumElts) {
1319 }
1320
1321
1322
1324 add({always, LegalizeAction::UseLegacyRules});
1325 return *this;
1326 }
1327
1328
1329
1330
1332
1333
1334
1336
1337
1339};
1340
1342public:
1344
1346 return LegacyInfo;
1347 }
1349
1350 unsigned getOpcodeIdxForOpcode(unsigned Opcode) const;
1351 unsigned getActionDefinitionsIdx(unsigned Opcode) const;
1352
1353
1354
1356
1357
1358
1359 const LegalizeRuleSet &getActionDefinitions(unsigned Opcode) const;
1360
1361
1362
1363
1364
1365
1366 LegalizeRuleSet &getActionDefinitionsBuilder(unsigned Opcode);
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1382 getActionDefinitionsBuilder(std::initializer_list Opcodes);
1383 void aliasActionDefinitions(unsigned OpcodeTo, unsigned OpcodeFrom);
1384
1385
1386
1387
1388
1390
1391
1392
1393
1394
1397
1399 return getAction(Query).Action == LegalizeAction::Legal;
1400 }
1401
1403 auto Action = getAction(Query).Action;
1404 return Action == LegalizeAction::Legal || Action == LegalizeAction::Custom;
1405 }
1406
1410
1411
1416
1417
1418
1419
1420
1425
1426
1427
1428
1429
1430 virtual unsigned getExtOpcodeForWideningConstant(LLT SmallTy) const;
1431
1432private:
1433 static const int FirstOp = TargetOpcode::PRE_ISEL_GENERIC_OPCODE_START;
1434 static const int LastOp = TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END;
1435
1438};
1439
1440#ifndef NDEBUG
1441
1442
1444#endif
1445
1446}
1447
1448#endif
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
Atomic ordering constants.
Interface for Targets to specify which operations they can successfully select and how the others sho...
Implement a low-level type suitable for MachineInstr level instruction selection.
This file implements the SmallBitVector class.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
static constexpr ElementCount getFixed(ScalarTy MinVal)
constexpr bool isScalableVector() const
Returns true if the LLT is a scalable vector.
constexpr bool isScalar() const
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
constexpr uint16_t getNumElements() const
Returns the number of elements in a vector LLT.
constexpr TypeSize getSizeInBits() const
Returns the total size of the type. Must only be called on sized types.
constexpr LLT getElementType() const
Returns the vector's element type. Only valid for vector types.
static constexpr LLT fixed_vector(unsigned NumElements, unsigned ScalarSizeInBits)
Get a low-level fixed-width vector of some number of elements and element width.
constexpr bool isFixedVector() const
Returns true if the LLT is a fixed vector.
static constexpr LLT scalarOrVector(ElementCount EC, LLT ScalarTy)
Definition LegalizerInfo.h:452
LegalizeRuleSet & minScalar(unsigned TypeIdx, const LLT Ty)
Ensure the scalar is at least as wide as Ty.
Definition LegalizerInfo.h:1071
LegalizeRuleSet & clampScalar(bool Pred, unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
Definition LegalizerInfo.h:1143
LegalizeRuleSet & maxScalarSameAs(unsigned TypeIdx, unsigned NarrowTypeIdx)
Narrow the scalar to match the size of another.
Definition LegalizerInfo.h:1169
LegalizeRuleSet & widenScalarOrEltToNextPow2OrMinSize(unsigned TypeIdx, unsigned MinSize=0)
Widen the scalar or vector element type to the next power of two that is at least MinSize.
Definition LegalizerInfo.h:1000
LegalizeRuleSet & customForCartesianProduct(bool Pred, std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
The instruction is custom when the predicate is true and type indexes 0 and 1 are all in their respec...
Definition LegalizerInfo.h:955
LegalizeRuleSet & legalFor(std::initializer_list< LLT > Types)
The instruction is legal when type index 0 is any type in the given list.
Definition LegalizerInfo.h:636
LegalizeRuleSet & maxScalarEltSameAsIf(LegalityPredicate Predicate, unsigned TypeIdx, unsigned SmallTypeIdx)
Conditionally narrow the scalar or elt to match the size of another.
Definition LegalizerInfo.h:1206
LegalizeRuleSet & unsupported()
The instruction is unsupported.
Definition LegalizerInfo.h:872
LegalizeRuleSet & legalFor(bool Pred, std::initializer_list< std::tuple< LLT, LLT, LLT > > Types)
Definition LegalizerInfo.h:656
LegalizeRuleSet & scalarSameSizeAs(unsigned TypeIdx, unsigned SameSizeIdx)
Change the type TypeIdx to have the same scalar size as type SameSizeIdx.
Definition LegalizerInfo.h:1182
LegalizeRuleSet & fewerElementsIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Remove elements to reach the type selected by the mutation if the predicate is true.
Definition LegalizerInfo.h:863
LegalizeRuleSet & clampScalarOrElt(unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
Limit the range of scalar sizes to MinTy and MaxTy.
Definition LegalizerInfo.h:1151
void aliasTo(unsigned Opcode)
Definition LegalizerInfo.h:610
LegalizeRuleSet & bitcastIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
The specified type index is coerced if predicate is true.
Definition LegalizerInfo.h:710
LegalizeRuleSet & libcall()
The instruction is emitted as a library call.
Definition LegalizerInfo.h:783
LegalizeRuleSet & libcallFor(std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:798
LLVM_ABI bool verifyImmIdxsCoverage(unsigned NumImmIdxs) const
Check if there is no imm index which is obviously not handled by the LegalizeRuleSet in any way at al...
LegalizeRuleSet & maxScalar(unsigned TypeIdx, const LLT Ty)
Ensure the scalar is at most as wide as Ty.
Definition LegalizerInfo.h:1110
LegalizeRuleSet & minScalarOrElt(unsigned TypeIdx, const LLT Ty)
Ensure the scalar or element is at least as wide as Ty.
Definition LegalizerInfo.h:1030
LegalizeRuleSet()=default
LegalizeRuleSet & clampMaxNumElements(unsigned TypeIdx, const LLT EltTy, unsigned MaxElements)
Limit the number of elements in EltTy vectors to at most MaxElements.
Definition LegalizerInfo.h:1271
LegalizeRuleSet & clampMinNumElements(unsigned TypeIdx, const LLT EltTy, unsigned MinElements)
Limit the number of elements in EltTy vectors to at least MinElements.
Definition LegalizerInfo.h:1233
LegalizeRuleSet & libcallForCartesianProduct(std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:817
LegalizeRuleSet & unsupportedFor(std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:880
LegalizeRuleSet & legalFor(bool Pred, std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:639
LegalizeRuleSet & widenVectorEltsToVectorMinSize(unsigned TypeIdx, unsigned VectorSize)
Ensure the vector size is at least as wide as VectorSize by promoting the element.
Definition LegalizerInfo.h:1051
LegalizeRuleSet & legalForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
The instruction is legal when type indexes 0 and 1 are both their respective lists.
Definition LegalizerInfo.h:690
LegalizeRuleSet & lowerIfMemSizeNotPow2()
Lower a memory operation if the memory size, rounded to bytes, is not a power of 2.
Definition LegalizerInfo.h:892
LegalizeRuleSet & lowerFor(std::initializer_list< LLT > Types, LegalizeMutation Mutation)
The instruction is lowered when type index 0 is any type in the given list.
Definition LegalizerInfo.h:750
LegalizeRuleSet & minScalarEltSameAsIf(LegalityPredicate Predicate, unsigned TypeIdx, unsigned LargeTypeIdx)
Conditionally widen the scalar or elt to match the size of another.
Definition LegalizerInfo.h:1188
LegalizeRuleSet & customForCartesianProduct(std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:932
LegalizeRuleSet & lowerIfMemSizeNotByteSizePow2()
Lower a memory operation if the memory access size is not a round power of 2 byte size.
Definition LegalizerInfo.h:900
LegalizeRuleSet & minScalar(bool Pred, unsigned TypeIdx, const LLT Ty)
Definition LegalizerInfo.h:1078
LegalizeRuleSet & moreElementsToNextPow2(unsigned TypeIdx)
Add more elements to the vector to reach the next power of two.
Definition LegalizerInfo.h:1225
LegalizeRuleSet & customForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
The instruction is custom when type indexes 0 and 1 are both in their respective lists.
Definition LegalizerInfo.h:938
LegalizeRuleSet & legalForTypeWithAnyImm(std::initializer_list< std::pair< LLT, LLT > > Types)
Definition LegalizerInfo.h:668
LegalizeRuleSet & lowerFor(std::initializer_list< std::pair< LLT, LLT > > Types)
The instruction is lowered when type indexes 0 and 1 is any type pair in the given list.
Definition LegalizerInfo.h:756
LegalizeRuleSet & narrowScalarIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Narrow the scalar to the one selected by the mutation if the predicate is true.
Definition LegalizerInfo.h:837
LegalizeRuleSet & lower()
The instruction is lowered.
Definition LegalizerInfo.h:719
LegalizeRuleSet & moreElementsIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Add more elements to reach the type selected by the mutation if the predicate is true.
Definition LegalizerInfo.h:854
LegalizeRuleSet & narrowScalarFor(std::initializer_list< std::pair< LLT, LLT > > Types, LegalizeMutation Mutation)
Narrow the scalar, specified in mutation, when type indexes 0 and 1 is any type pair in the given lis...
Definition LegalizerInfo.h:847
LegalizeRuleSet & narrowScalar(unsigned TypeIdx, LegalizeMutation Mutation)
Definition LegalizerInfo.h:1010
LegalizeRuleSet & customFor(bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
Definition LegalizerInfo.h:925
LegalizeRuleSet & lowerFor(std::initializer_list< LLT > Types)
The instruction is lowered when type index 0 is any type in the given list.
Definition LegalizerInfo.h:745
LegalizeRuleSet & scalarizeIf(LegalityPredicate Predicate, unsigned TypeIdx)
Definition LegalizerInfo.h:1022
LegalizeRuleSet & lowerIf(LegalityPredicate Predicate)
The instruction is lowered if predicate is true.
Definition LegalizerInfo.h:728
bool isAliasedByAnother()
Definition LegalizerInfo.h:608
LegalizeRuleSet & clampScalar(unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
Limit the range of scalar sizes to MinTy and MaxTy.
Definition LegalizerInfo.h:1137
LegalizeRuleSet & legalForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
The instruction is legal when type indexes 0, 1, and 2 are both their respective lists.
Definition LegalizerInfo.h:696
LegalizeRuleSet & alignNumElementsTo(unsigned TypeIdx, const LLT EltTy, unsigned NumElts)
Set number of elements to nearest larger multiple of NumElts.
Definition LegalizerInfo.h:1252
LegalizeRuleSet & custom()
Unconditionally custom lower.
Definition LegalizerInfo.h:963
LegalizeRuleSet & libcallForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
Definition LegalizerInfo.h:821
LegalizeRuleSet & clampMaxNumElementsStrict(unsigned TypeIdx, const LLT EltTy, unsigned NumElts)
Express EltTy vectors strictly using vectors with NumElts elements (or scalars when NumElts equals 1)...
Definition LegalizerInfo.h:1315
LegalizeRuleSet & minScalarSameAs(unsigned TypeIdx, unsigned LargeTypeIdx)
Widen the scalar to match the size of another.
Definition LegalizerInfo.h:1157
LegalizeRuleSet & unsupportedIf(LegalityPredicate Predicate)
Definition LegalizerInfo.h:876
LegalizeRuleSet & minScalarOrEltIf(LegalityPredicate Predicate, unsigned TypeIdx, const LLT Ty)
Ensure the scalar or element is at least as wide as Ty.
Definition LegalizerInfo.h:1039
LegalizeRuleSet & widenScalarIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
Widen the scalar to the one selected by the mutation if the predicate is true.
Definition LegalizerInfo.h:828
LegalizeRuleSet & libcallFor(std::initializer_list< std::pair< LLT, LLT > > Types)
Definition LegalizerInfo.h:807
LegalizeRuleSet & customFor(bool Pred, std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:914
LegalizeRuleSet & fallback()
Fallback on the previous implementation.
Definition LegalizerInfo.h:1323
LegalizeRuleSet & legalForTypeWithAnyImm(std::initializer_list< LLT > Types)
The instruction is legal when type index 0 is any type in the given list and imm index 0 is anything.
Definition LegalizerInfo.h:663
LegalizeRuleSet & lowerForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
The instruction is lowered when type indexes 0, 1, and 2 are all in their respective lists.
Definition LegalizerInfo.h:774
LegalizeRuleSet & legalFor(std::initializer_list< std::pair< LLT, LLT > > Types)
The instruction is legal when type indexes 0 and 1 is any type pair in the given list.
Definition LegalizerInfo.h:646
LegalizeRuleSet & libcallFor(bool Pred, std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:801
LegalizeRuleSet & libcallFor(bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
Definition LegalizerInfo.h:811
LegalizeRuleSet & alwaysLegal()
Definition LegalizerInfo.h:703
LegalizeRuleSet & legalFor(bool Pred, std::initializer_list< std::pair< LLT, LLT > > Types)
Definition LegalizerInfo.h:649
unsigned getAlias() const
Definition LegalizerInfo.h:616
LegalizeRuleSet & clampNumElements(unsigned TypeIdx, const LLT MinTy, const LLT MaxTy)
Limit the number of elements for the given vectors to at least MinTy's number of elements and at most...
Definition LegalizerInfo.h:1295
LegalizeRuleSet & unsupportedIfMemSizeNotPow2()
Definition LegalizerInfo.h:884
LegalizeRuleSet & maxScalarIf(LegalityPredicate Predicate, unsigned TypeIdx, const LLT Ty)
Conditionally limit the maximum size of the scalar.
Definition LegalizerInfo.h:1121
LegalizeRuleSet & customIf(LegalityPredicate Predicate)
Definition LegalizerInfo.h:905
LegalizeRuleSet & customForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1, std::initializer_list< LLT > Types2)
The instruction is custom when type indexes 0, 1, and 2 are all in their respective lists.
Definition LegalizerInfo.h:945
LegalizeRuleSet & widenScalarToNextPow2(unsigned TypeIdx, unsigned MinSize=0)
Widen the scalar to the next power of two that is at least MinSize.
Definition LegalizerInfo.h:970
LegalizeRuleSet & scalarize(unsigned TypeIdx)
Definition LegalizerInfo.h:1016
void setIsAliasedByAnother()
Definition LegalizerInfo.h:609
LegalizeRuleSet & legalForCartesianProduct(std::initializer_list< LLT > Types)
The instruction is legal when type indexes 0 and 1 are both in the given list.
Definition LegalizerInfo.h:685
LegalizeRuleSet & lowerForCartesianProduct(std::initializer_list< LLT > Types0, std::initializer_list< LLT > Types1)
The instruction is lowered when type indexes 0 and 1 are both in their respective lists.
Definition LegalizerInfo.h:767
LegalizeRuleSet & lowerIf(LegalityPredicate Predicate, LegalizeMutation Mutation)
The instruction is lowered if predicate is true.
Definition LegalizerInfo.h:736
LegalizeRuleSet & legalForTypesWithMemDesc(std::initializer_list< LegalityPredicates::TypePairAndMemDesc > TypesAndMemDesc)
The instruction is legal when type indexes 0 and 1 along with the memory size and minimum alignment i...
Definition LegalizerInfo.h:676
LegalizeRuleSet & libcallIf(LegalityPredicate Predicate)
Like legalIf, but for the Libcall action.
Definition LegalizerInfo.h:792
LegalizeRuleSet & maxScalarOrElt(unsigned TypeIdx, const LLT Ty)
Ensure the scalar is at most as wide as Ty.
Definition LegalizerInfo.h:1101
LegalizeRuleSet & customFor(std::initializer_list< std::pair< LLT, LLT > > Types)
The instruction is custom when type indexes 0 and 1 is any type pair in the given list.
Definition LegalizerInfo.h:922
LegalizeRuleSet & minScalarIf(LegalityPredicate Predicate, unsigned TypeIdx, const LLT Ty)
Ensure the scalar is at least as wide as Ty if condition is met.
Definition LegalizerInfo.h:1085
unsigned immIdx(unsigned ImmIdx)
Definition LegalizerInfo.h:618
LLVM_ABI bool verifyTypeIdxsCoverage(unsigned NumTypeIdxs) const
Check if there is no type index which is obviously not handled by the LegalizeRuleSet in any way at a...
LegalizeRuleSet & widenScalarOrEltToNextPow2(unsigned TypeIdx, unsigned MinSize=0)
Widen the scalar or vector element type to the next power of two that is at least MinSize.
Definition LegalizerInfo.h:990
LLVM_ABI LegalizeActionStep apply(const LegalityQuery &Query) const
Apply the ruleset to the given LegalityQuery.
LegalizeRuleSet & lowerFor(std::initializer_list< std::pair< LLT, LLT > > Types, LegalizeMutation Mutation)
The instruction is lowered when type indexes 0 and 1 is any type pair in the given list.
Definition LegalizerInfo.h:761
LegalizeRuleSet & legalIf(LegalityPredicate Predicate)
The instruction is legal if predicate is true.
Definition LegalizerInfo.h:629
LegalizeRuleSet & customFor(std::initializer_list< LLT > Types)
Definition LegalizerInfo.h:911
LegalizeRuleSet & widenScalarToNextMultipleOf(unsigned TypeIdx, unsigned Size)
Widen the scalar to the next multiple of Size.
Definition LegalizerInfo.h:980
A single rule in a legalizer info ruleset.
Definition LegalizerInfo.h:427
std::pair< unsigned, LLT > determineMutation(const LegalityQuery &Query) const
Determine the change to make.
Definition LegalizerInfo.h:445
bool match(const LegalityQuery &Query) const
Test whether the LegalityQuery matches.
Definition LegalizerInfo.h:438
LegalizeRule(LegalityPredicate Predicate, LegalizeAction Action, LegalizeMutation Mutation=nullptr)
Definition LegalizerInfo.h:433
LegalizeAction getAction() const
Definition LegalizerInfo.h:442
Definition LegalizerInfo.h:1341
virtual ~LegalizerInfo()=default
const LegacyLegalizerInfo & getLegacyLegalizerInfo() const
Definition LegalizerInfo.h:1345
LegacyLegalizerInfo & getLegacyLegalizerInfo()
Definition LegalizerInfo.h:1348
bool isLegalOrCustom(const LegalityQuery &Query) const
Definition LegalizerInfo.h:1402
virtual bool legalizeCustom(LegalizerHelper &Helper, MachineInstr &MI, LostDebugLocObserver &LocObserver) const
Called for instructions with the Custom LegalizationAction.
Definition LegalizerInfo.h:1412
bool isLegal(const LegalityQuery &Query) const
Definition LegalizerInfo.h:1398
virtual bool legalizeIntrinsic(LegalizerHelper &Helper, MachineInstr &MI) const
Definition LegalizerInfo.h:1421
LegalizeActionStep getAction(const LegalityQuery &Query) const
Determine what action should be taken to legalize the described instruction.
Interface to description of machine instruction set.
Representation of each machine instruction.
A description of a memory reference used in the backend.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
This class implements an extremely fast bulk output stream that can only output to a stream.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition LegalizerInfo.h:206
LLVM_ABI LegalityPredicate scalarOrEltWiderThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar or a vector with an element type that's wider than the ...
LLVM_ABI LegalityPredicate isScalar(unsigned TypeIdx)
True iff the specified type index is a scalar.
LLVM_ABI LegalityPredicate memSizeInBytesNotPow2(unsigned MMOIdx)
True iff the specified MMO index has a size (rounded to bytes) that is not a power of 2.
LLVM_ABI LegalityPredicate numElementsNotPow2(unsigned TypeIdx)
True iff the specified type index is a vector whose element count is not a power of 2.
LLVM_ABI LegalityPredicate isPointerVector(unsigned TypeIdx)
True iff the specified type index is a vector of pointers (with any address space).
LLVM_ABI LegalityPredicate isPointer(unsigned TypeIdx)
True iff the specified type index is a pointer (with any address space).
LLVM_ABI LegalityPredicate vectorElementCountIsLessThanOrEqualTo(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a vector with a number of elements that's less than or equal to ...
LLVM_ABI LegalityPredicate typeInSet(unsigned TypeIdx, std::initializer_list< LLT > TypesInit)
True iff the given type index is one of the specified types.
LLVM_ABI LegalityPredicate smallerThan(unsigned TypeIdx0, unsigned TypeIdx1)
True iff the first type index has a smaller total bit size than second type index.
LLVM_ABI LegalityPredicate atomicOrderingAtLeastOrStrongerThan(unsigned MMOIdx, AtomicOrdering Ordering)
True iff the specified MMO index has at an atomic ordering of at Ordering or stronger.
LLVM_ABI LegalityPredicate scalarOrEltSizeNotPow2(unsigned TypeIdx)
True iff the specified type index is a scalar or vector whose element size is not a power of 2.
LLVM_ABI LegalityPredicate largerThan(unsigned TypeIdx0, unsigned TypeIdx1)
True iff the first type index has a larger total bit size than second type index.
LLVM_ABI LegalityPredicate typePairInSet(unsigned TypeIdx0, unsigned TypeIdx1, std::initializer_list< std::pair< LLT, LLT > > TypesInit)
True iff the given types for the given pair of type indexes is one of the specified type pairs.
LLVM_ABI LegalityPredicate vectorElementCountIsGreaterThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a vector with a number of elements that's greater than the given...
LLVM_ABI LegalityPredicate memSizeNotByteSizePow2(unsigned MMOIdx)
True iff the specified MMO index has a size that is not an even byte size, or that even byte size is ...
Predicate any(Predicate P0, Predicate P1)
True iff P0 or P1 are true.
Definition LegalizerInfo.h:249
LLVM_ABI LegalityPredicate elementTypeIs(unsigned TypeIdx, LLT EltTy)
True if the type index is a vector with element type EltTy.
LLVM_ABI LegalityPredicate sameSize(unsigned TypeIdx0, unsigned TypeIdx1)
True iff the specified type indices are both the same bit size.
LLVM_ABI LegalityPredicate scalarOrEltNarrowerThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar or vector with an element type that's narrower than the...
LLVM_ABI LegalityPredicate sizeIs(unsigned TypeIdx, unsigned Size)
True if the total bitwidth of the specified type index is Size bits.
LegalityPredicate typeIsNot(unsigned TypeIdx, LLT Type)
True iff the given type index is not the specified type.
Definition LegalizerInfo.h:267
LLVM_ABI LegalityPredicate isVector(unsigned TypeIdx)
True iff the specified type index is a vector.
LLVM_ABI LegalityPredicate sizeNotPow2(unsigned TypeIdx)
True iff the specified type index is a scalar whose size is not a power of.
LLVM_ABI LegalityPredicate typeTupleInSet(unsigned TypeIdx0, unsigned TypeIdx1, unsigned Type2, std::initializer_list< std::tuple< LLT, LLT, LLT > > TypesInit)
True iff the given types for the given tuple of type indexes is one of the specified type tuple.
Predicate all(Predicate P0, Predicate P1)
True iff P0 and P1 are true.
Definition LegalizerInfo.h:236
LLVM_ABI LegalityPredicate typePairAndMemDescInSet(unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx, std::initializer_list< TypePairAndMemDesc > TypesAndMemDescInit)
True iff the given types for the given pair of type indexes is one of the specified type pairs.
LLVM_ABI LegalityPredicate sizeNotMultipleOf(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar whose size is not a multiple of Size.
LLVM_ABI LegalityPredicate typeIs(unsigned TypeIdx, LLT TypesInit)
True iff the given type index is the specified type.
Predicate predNot(Predicate P)
True iff P is false.
Definition LegalizerInfo.h:230
LLVM_ABI LegalityPredicate scalarWiderThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar that's wider than the given size.
LLVM_ABI LegalityPredicate scalarNarrowerThan(unsigned TypeIdx, unsigned Size)
True iff the specified type index is a scalar that's narrower than the given size.
Definition LegalizerInfo.h:44
LegalizeAction
Definition LegalizerInfo.h:45
@ FewerElements
The (vector) operation should be implemented by splitting it into sub-vectors where the operation is ...
Definition LegalizerInfo.h:66
@ Legal
The operation is expected to be selectable directly by the target, and no transformation is necessary...
Definition LegalizerInfo.h:48
@ Libcall
The operation should be implemented as a call to some kind of runtime support library.
Definition LegalizerInfo.h:84
@ Unsupported
This operation is completely unsupported on the target.
Definition LegalizerInfo.h:92
@ Lower
The operation itself must be expressed in terms of simpler actions on this target.
Definition LegalizerInfo.h:79
@ UseLegacyRules
Fall back onto the old rules.
Definition LegalizerInfo.h:99
@ WidenScalar
The operation should be implemented in terms of a wider scalar base-type.
Definition LegalizerInfo.h:58
@ Bitcast
Perform the operation on a different, but equivalently sized type.
Definition LegalizerInfo.h:75
@ NarrowScalar
The operation should be synthesized from multiple instructions acting on a narrower scalar base-type.
Definition LegalizerInfo.h:53
@ Custom
The target wants to do something special with this combination of operand and type.
Definition LegalizerInfo.h:88
@ NotFound
Sentinel value for when no action was found in the specified table.
Definition LegalizerInfo.h:95
@ MoreElements
The (vector) operation should be implemented by widening the input vector and ignoring the lanes adde...
Definition LegalizerInfo.h:72
Definition LegalizerInfo.h:375
LLVM_ABI LegalizeMutation moreElementsToNextPow2(unsigned TypeIdx, unsigned Min=0)
Add more elements to the type for the given type index to the next power of.
LLVM_ABI LegalizeMutation changeElementCountTo(unsigned TypeIdx, unsigned FromTypeIdx)
Keep the same scalar or element type as TypeIdx, but take the number of elements from FromTypeIdx.
LLVM_ABI LegalizeMutation scalarize(unsigned TypeIdx)
Break up the vector type for the given type index into the element type.
LLVM_ABI LegalizeMutation changeElementTo(unsigned TypeIdx, unsigned FromTypeIdx)
Keep the same scalar or element type as the given type index.
LLVM_ABI LegalizeMutation widenScalarOrEltToNextPow2(unsigned TypeIdx, unsigned Min=0)
Widen the scalar type or vector element type for the given type index to the next power of 2.
LLVM_ABI LegalizeMutation changeTo(unsigned TypeIdx, LLT Ty)
Select this specific type for the given type index.
LLVM_ABI LegalizeMutation widenScalarOrEltToNextMultipleOf(unsigned TypeIdx, unsigned Size)
Widen the scalar type or vector element type for the given type index to next multiple of Size.
LLVM_ABI LegalizeMutation changeElementSizeTo(unsigned TypeIdx, unsigned FromTypeIdx)
Change the scalar size or element size to have the same scalar size as type index FromIndex.
@ OPERAND_FIRST_GENERIC_IMM
@ OPERAND_LAST_GENERIC_IMM
This is an optimization pass for GlobalISel generic memory operations.
MaybeAlign getAlign(const CallInst &I, unsigned Index)
std::function< std::pair< unsigned, LLT >(const LegalityQuery &)> LegalizeMutation
Definition LegalizerInfo.h:203
std::function< bool(const LegalityQuery &)> LegalityPredicate
Definition LegalizerInfo.h:202
LLVM_ABI cl::opt< bool > DisableGISelLegalityCheck
const MachineInstr * machineFunctionIsIllegal(const MachineFunction &MF)
Checks that MIR is fully legal, returns an illegal instruction if it's not, nullptr otherwise.
AtomicOrdering
Atomic ordering for LLVM's memory model.
uint64_t alignTo(uint64_t Size, Align A)
Returns a multiple of A needed to store Size bytes.
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
LegacyLegalizeActions::LegacyLegalizeAction Action
The action to take or the final answer.
Definition LegalizerInfo.h:207
LLT Type1
Definition LegalizerInfo.h:209
bool operator==(const TypePairAndMemDesc &Other) const
Definition LegalizerInfo.h:213
LLT MemTy
Definition LegalizerInfo.h:210
LLT Type0
Definition LegalizerInfo.h:208
uint64_t Align
Definition LegalizerInfo.h:211
bool isCompatible(const TypePairAndMemDesc &Other) const
Definition LegalizerInfo.h:220
MemDesc(const MachineMemOperand &MMO)
Definition LegalizerInfo.h:126
LLT MemoryTy
Definition LegalizerInfo.h:116
uint64_t AlignInBits
Definition LegalizerInfo.h:117
AtomicOrdering Ordering
Definition LegalizerInfo.h:118
MemDesc(LLT MemoryTy, uint64_t AlignInBits, AtomicOrdering Ordering, AtomicOrdering FailureOrdering)
Definition LegalizerInfo.h:122
AtomicOrdering FailureOrdering
Definition LegalizerInfo.h:119
The LegalityQuery object bundles together all the information that's needed to decide whether a given...
Definition LegalizerInfo.h:111
ArrayRef< MemDesc > MMODescrs
Operations which require memory can use this to place requirements on the memory type for each MMO.
Definition LegalizerInfo.h:133
ArrayRef< LLT > Types
Definition LegalizerInfo.h:113
LLVM_ABI raw_ostream & print(raw_ostream &OS) const
constexpr LegalityQuery(unsigned Opcode, ArrayRef< LLT > Types, ArrayRef< MemDesc > MMODescrs={})
Definition LegalizerInfo.h:135
unsigned Opcode
Definition LegalizerInfo.h:112
The result of a query.
Definition LegalizerInfo.h:145
LegalizeAction Action
The action to take or the final answer.
Definition LegalizerInfo.h:147
LegalizeActionStep(LegacyLegalizeActionStep Step)
Definition LegalizerInfo.h:157
LLT NewType
If describing an action, the new type for TypeIdx. Otherwise LLT{}.
Definition LegalizerInfo.h:151
unsigned TypeIdx
If describing an action, the type index to change. Otherwise zero.
Definition LegalizerInfo.h:149
LegalizeActionStep(LegalizeAction Action, unsigned TypeIdx, const LLT NewType)
Definition LegalizerInfo.h:153
bool operator==(const LegalizeActionStep &RHS) const
Definition LegalizerInfo.h:196