LLVM: include/llvm/SandboxIR/Instruction.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9#ifndef LLVM_SANDBOXIR_INSTRUCTION_H
10#define LLVM_SANDBOXIR_INSTRUCTION_H
11
20
22
23
25
27 BBIterator InsertAt;
28
29public:
31 assert(InsertAtEnd != nullptr && "Expected non-null!");
32 InsertAt = InsertAtEnd->end();
33 }
35 operator BBIterator() { return InsertAt; }
36 const BBIterator &getIterator() const { return InsertAt; }
39};
40
41
42
44public:
46#define OP(OPC) OPC,
47#define OPCODES(...) __VA_ARGS__
48#define DEF_INSTR(ID, OPC, CLASS) OPC
49#include "llvm/SandboxIR/Values.def"
50 };
51
52protected:
56
58
59
60
63 friend class FreezeInst;
65 friend class SelectInst;
71 friend class BranchInst;
74 friend class ReturnInst;
76 friend class InvokeInst;
77 friend class CallBrInst;
78 friend class LandingPadInst;
79 friend class CatchPadInst;
80 friend class CleanupPadInst;
84 friend class ResumeInst;
86 friend class SwitchInst;
87 friend class UnaryOperator;
88 friend class BinaryOperator;
89 friend class AtomicRMWInst;
91 friend class AllocaInst;
96
97
98
101
102
103
107 auto &Ctx = WhereBB->getContext();
108 auto &Builder = Ctx.getLLVMIRBuilder();
109 if (WhereIt != WhereBB->end())
110 Builder.SetInsertPoint((*Pos).getTopmostLLVMInstruction());
111 else
113 return Builder;
114 }
115
116public:
118
120
122
123
125
126
128
129
131
133
137
138
139
140
141
142
165
166
167
168
169
170
174
175
176
180
181
185
186
187
188
189
190
191
193
195
197
199
201
203
207
211
212
213
214
219
220
222
224
225
229
230
232
236
237
239
241
242
243
245
249
250
251
253
255
256
258
260
261
262
264
266
267
268
270
274
275
276
278
282
283
284
286
290
291
292
294
298
299
300
302
303
304
308
309
310
312
313
314
316
320
324
328
332
336
343
345
349
353
355
357
358 bool mayThrow(bool IncludePhaseOneUnwind = false) const {
360 }
361
365
369
370
371
372#ifndef NDEBUG
374#endif
375};
376
377
378template class SingleLLVMInstructionImpl : public Instruction {
382
383
384#define DEF_INSTR(ID, OPC, CLASS) friend class CLASS;
385#include "llvm/SandboxIR/Values.def"
390
391 Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final {
393 }
396 }
397
398public:
403#ifndef NDEBUG
409#endif
410};
411
412class FenceInst : public SingleLLVMInstructionImplllvm::FenceInst {
414 : SingleLLVMInstructionImpl(ClassID::Fence, Opcode::Fence, FI, Ctx) {}
415 friend Context;
416
417public:
419 Context &Ctx,
421
425
426
428
432
437};
438
439class SelectInst : public SingleLLVMInstructionImplllvm::SelectInst {
440
441
443 : SingleLLVMInstructionImpl(ClassID::Select, Opcode::Select, CI, Ctx) {}
444 friend Context;
445
446public:
449 const Twine &Name = "");
450
457
462
463
464
470
471
473};
474
475class InsertElementInst final
476 : public SingleLLVMInstructionImplllvm::InsertElementInst {
477
479 : SingleLLVMInstructionImpl(ClassID::InsertElement, Opcode::InsertElement,
482
483public:
486 const Twine &Name = "");
488 return From->getSubclassID() == ClassID::InsertElement;
489 }
491 const Value *Idx) {
493 Idx->Val);
494 }
495};
496
497class ExtractElementInst final
498 : public SingleLLVMInstructionImplllvm::ExtractElementInst {
499
501 : SingleLLVMInstructionImpl(ClassID::ExtractElement,
502 Opcode::ExtractElement, I, Ctx) {}
504
505
506public:
510 return From->getSubclassID() == ClassID::ExtractElement;
511 }
512
521};
522
523class ShuffleVectorInst final
524 : public SingleLLVMInstructionImplllvm::ShuffleVectorInst {
525
527 : SingleLLVMInstructionImpl(ClassID::ShuffleVector, Opcode::ShuffleVector,
530
531public:
534 const Twine &Name = "");
537 const Twine &Name = "");
539 return From->getSubclassID() == ClassID::ShuffleVector;
540 }
541
542
543
545
546
547
549 const Value *Mask) {
551 Mask->Val);
552 }
557
558
560
561
562
566
567
568
574
575
576
580
581
583
585 Type *ResultTy);
586
588
592
593
594
595
596
600
601
602
603
607
608
609
610
611
612
620
621
622
623
627
628
629
630
631
632
640
641
642
643
644
648
649
650
654
655
656
660
661
662
663
667
668
669
670
671
672
673
674
675
683
684
685
686
687
688
689
690
694
695
696
697
698
699
707
708
709
710
714
715
716
717
718
719
727
728
729
730
731
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
775
776
777
778
779
780
784
785
786
787
788
789
790
798
799
800
801
802
806
807
808
809
811 int &Index) {
813 Index);
814 }
820
821
825
826
827
828
829
831 int &NumSubElts, int &Index) {
833 NumSubElts, Index);
834 }
836 int &NumSubElts, int &Index) {
839 }
840
841
846
847
848
849
850
852 int &VF) {
854 VF);
855 }
861
862
865 ReplicationFactor, VF);
866 }
867
868
869
870
871
872
873
874
875
876
880
881
882
886
887
888
890 unsigned InVecNumElts) {
892 }
893
894
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
919 unsigned NumInputElts,
922 StartIndexes);
923 }
925 unsigned NumInputElts) {
927 NumInputElts);
928 }
929
930
931
932
934 unsigned &Index) {
936 Index);
937 }
941
942
943
944
945
946
947
948
949
950
951
952
954 unsigned MinSubElts, unsigned MaxSubElts,
955 unsigned &NumSubElts, unsigned &RotateAmt) {
957 Mask, EltSizeInBits, MinSubElts, MaxSubElts, NumSubElts, RotateAmt);
958 }
959};
960
961class InsertValueInst
962 : public SingleLLVMInstructionImplllvm::InsertValueInst {
963
965 : SingleLLVMInstructionImpl(ClassID::InsertValue, Opcode::InsertValue,
966 IVI, Ctx) {}
967 friend Context;
968
969public:
972 const Twine &Name = "");
973
977
988
998
1008
1012
1016
1020};
1021
1022class BranchInst : public SingleLLVMInstructionImplllvm::BranchInst {
1023
1025 : SingleLLVMInstructionImpl(ClassID::Br, Opcode::Br, BI, Ctx) {}
1026 friend Context;
1027
1028public:
1030 Context &Ctx);
1033 Context &Ctx);
1034
1048
1049private:
1050 struct LLVMBBToSBBB {
1052 LLVMBBToSBBB(Context &Ctx) : Ctx(Ctx) {}
1054 };
1055
1056 struct ConstLLVMBBToSBBB {
1057 Context &Ctx;
1058 ConstLLVMBBToSBBB(Context &Ctx) : Ctx(Ctx) {}
1059 LLVM_ABI const BasicBlock *operator()(const llvm::BasicBlock *BB) const;
1060 };
1061
1062public:
1068 LLVMBBToSBBB BBMap(Ctx);
1071 return make_range(MappedBegin, MappedEnd);
1072 }
1073
1076 ConstLLVMBBToSBBB>;
1081 ConstLLVMBBToSBBB ConstBBMap(Ctx);
1086 return make_range(ConstMappedBegin, ConstMappedEnd);
1087 }
1088};
1089
1090
1092 : public SingleLLVMInstructionImplllvm::UnaryInstruction {
1093protected:
1096 : SingleLLVMInstructionImpl(ID, Opc, LLVMI, Ctx) {}
1097
1098public:
1105};
1106
1108
1110 : UnaryInstruction(ClassID::ExtractValue, Opcode::ExtractValue, EVI,
1112 friend Context;
1113
1114public:
1117 const Twine &Name = "");
1118
1120 return From->getSubclassID() == ClassID::ExtractValue;
1121 }
1122
1123
1124
1125
1126
1128
1130
1140
1150
1154
1158
1162};
1163
1167 friend Context;
1168
1169public:
1171 Context &Ctx, const Twine &Name = "");
1182};
1183
1187 friend Context;
1188
1189public:
1191 const Twine &Name = "");
1195};
1196
1198
1201 friend Context;
1202
1203public:
1204
1206
1208
1214 const Twine &Name = "") {
1215 return create(Ty, Ptr, Align, Pos, false, Ctx, Name);
1216 }
1217
1218
1224};
1225
1226class StoreInst final : public SingleLLVMInstructionImplllvm::StoreInst {
1227
1229 : SingleLLVMInstructionImpl(ClassID::Store, Opcode::Store, SI, Ctx) {}
1230 friend Context;
1231
1232public:
1233
1235
1237
1245
1246
1253};
1254
1256
1258 : Instruction(ClassID::Unreachable, Opcode::Unreachable, I, Ctx) {}
1259 friend Context;
1260 Use getOperandUseInternal(unsigned OpIdx, bool Verify) const final {
1262 }
1265 }
1266
1267public:
1275};
1276
1277class ReturnInst final : public SingleLLVMInstructionImplllvm::ReturnInst {
1278
1280 : SingleLLVMInstructionImpl(ClassID::Ret, Opcode::Ret, I, Ctx) {}
1282 : SingleLLVMInstructionImpl(SubclassID, Opcode::Ret, I, Ctx) {}
1284 static ReturnInst *createCommon(Value *RetVal, IRBuilder<> &Builder,
1286
1287public:
1293
1295};
1296
1297class CallBase : public SingleLLVMInstructionImplllvm::CallBase {
1299 : SingleLLVMInstructionImpl(ID, Opc, I, Ctx) {}
1303
1304public:
1307 return Opc == Instruction::ClassID::Call ||
1308 Opc == Instruction::ClassID::Invoke ||
1309 Opc == Instruction::ClassID::CallBr;
1310 }
1311
1313
1320 auto Dist = LLVMCB->data_operands_end() - LLVMCB->data_operands_begin();
1322 }
1325 auto Dist = LLVMCB->data_operands_end() - LLVMCB->data_operands_begin();
1327 }
1341 assert(this == U.getUser() &&
1342 "Only valid to query with a use of this instruction!");
1344 }
1349
1350
1351
1355
1362 return const_cast<CallBase *>(this)->arg_end();
1363 }
1372
1381
1390
1398
1401
1411 return const_cast<CallBase *>(this)->getCaller();
1412 }
1426};
1427
1428class CallInst : public CallBase {
1429
1430
1432 : CallBase(ClassID::Call, Opcode::Call, I, Ctx) {}
1435
1436public:
1440
1444};
1445
1446class InvokeInst final : public CallBase {
1447
1448
1450 : CallBase(ClassID::Invoke, Opcode::Invoke, I, Ctx) {}
1452
1453
1454public:
1460
1471 assert(SuccIdx < 2 && "Successor # out of range for invoke!");
1472 if (SuccIdx == 0)
1474 else
1476 }
1480};
1481
1482class CallBrInst final : public CallBase {
1483
1484
1486 : CallBase(ClassID::CallBr, Opcode::CallBr, I, Ctx) {}
1488
1489
1490public:
1513};
1514
1515class LandingPadInst : public SingleLLVMInstructionImplllvm::LandingPadInst {
1517 : SingleLLVMInstructionImpl(ClassID::LandingPad, Opcode::LandingPad, LP,
1520
1521public:
1523 unsigned NumReservedClauses,
1525 const Twine &Name = "");
1526
1527
1528
1532
1534
1535
1536
1537
1538
1539
1541
1542
1546
1550
1554
1558};
1559
1560class FuncletPadInst : public SingleLLVMInstructionImplllvm::FuncletPadInst {
1566
1567public:
1568
1572
1573
1574
1575
1578
1580
1582
1583
1588};
1589
1590class CatchPadInst : public FuncletPadInst {
1592 : FuncletPadInst(ClassID::CatchPad, Opcode::CatchPad, CPI, Ctx) {}
1594
1595public:
1597
1598
1599
1602 const Twine &Name = "");
1606};
1607
1608class CleanupPadInst : public FuncletPadInst {
1610 : FuncletPadInst(ClassID::CleanupPad, Opcode::CleanupPad, CPI, Ctx) {}
1612
1613public:
1617 const Twine &Name = "");
1621};
1622
1623class CatchReturnInst
1624 : public SingleLLVMInstructionImplllvm::CatchReturnInst {
1626 : SingleLLVMInstructionImpl(ClassID::CatchRet, Opcode::CatchRet, CRI,
1629
1630public:
1645};
1646
1647class CleanupReturnInst
1648 : public SingleLLVMInstructionImplllvm::CleanupReturnInst {
1650 : SingleLLVMInstructionImpl(ClassID::CleanupRet, Opcode::CleanupRet, CRI,
1653
1654public:
1671
1675};
1676
1677class GetElementPtrInst final
1678 : public SingleLLVMInstructionImplllvm::GetElementPtrInst {
1679
1680
1682 : SingleLLVMInstructionImpl(ClassID::GetElementPtr, Opcode::GetElementPtr,
1685 : SingleLLVMInstructionImpl(SubclassID, Opcode::GetElementPtr, I, Ctx) {}
1687
1688
1689public:
1692 const Twine &NameStr = "");
1693
1695 return From->getSubclassID() == ClassID::GetElementPtr;
1696 }
1697
1703
1706 return const_cast<GetElementPtrInst *>(this)->idx_begin();
1707 }
1710 return const_cast<GetElementPtrInst *>(this)->idx_end();
1711 }
1716 return const_cast<GetElementPtrInst *>(this)->indices();
1717 }
1718
1752
1753};
1754
1755class CatchSwitchInst
1756 : public SingleLLVMInstructionImplllvm::CatchSwitchInst {
1758 : SingleLLVMInstructionImpl(ClassID::CatchSwitch, Opcode::CatchSwitch,
1759 CSI, Ctx) {}
1761
1762public:
1763 LLVM_ABI static CatchSwitchInst *
1766
1769
1778
1782
1783private:
1785 static const BasicBlock *handler_helper(const Value *V) {
1787 }
1788
1789public:
1797
1822
1824
1825
1826
1827
1828
1832 "Successor # out of range for catchswitch!");
1834 }
1837 "Successor # out of range for catchswitch!");
1839 }
1840
1842 return From->getSubclassID() == ClassID::CatchSwitch;
1843 }
1844};
1845
1846class ResumeInst : public SingleLLVMInstructionImplllvm::ResumeInst {
1848 : SingleLLVMInstructionImpl(ClassID::Resume, Opcode::Resume, CSI, Ctx) {}
1850
1851public:
1861};
1862
1863class SwitchInst : public SingleLLVMInstructionImplllvm::SwitchInst {
1865 : SingleLLVMInstructionImpl(ClassID::Switch, Opcode::Switch, SI, Ctx) {}
1867
1868public:
1871
1875
1886
1887 template <typename LLVMCaseItT, typename BlockT, typename ConstT>
1888 class CaseItImpl;
1889
1890
1891
1892 template <typename LLVMCaseItT, typename BlockT, typename ConstT>
1895
1896
1897
1898 LLVMCaseItT LLVMCaseIt;
1899 template <typename T1, typename T2, typename T3> friend class CaseItImpl;
1900
1901 public:
1903 : Ctx(Ctx), LLVMCaseIt(LLVMCaseIt) {}
1907 const auto &LLVMCaseHandle = *LLVMCaseIt;
1908 return LLVMCaseHandle.getCaseIndex();
1909 }
1911 const auto &LLVMCaseHandle = *LLVMCaseIt;
1912 return LLVMCaseHandle.getSuccessorIndex();
1913 }
1914 };
1915
1916
1917
1918 template <typename LLVMCaseItT, typename BlockT, typename ConstT>
1920 CaseItImpl<LLVMCaseItT, BlockT, ConstT>,
1921 std::random_access_iterator_tag,
1922 const CaseHandleImpl<LLVMCaseItT, BlockT, ConstT>> {
1924
1925 public:
1931 CH.LLVMCaseIt += N;
1932 return *this;
1933 }
1935 CH.LLVMCaseIt -= N;
1936 return *this;
1937 }
1939 return CH.LLVMCaseIt - Other.CH.LLVMCaseIt;
1940 }
1942 return CH.LLVMCaseIt == Other.CH.LLVMCaseIt;
1943 }
1945 return CH.LLVMCaseIt < Other.CH.LLVMCaseIt;
1946 }
1950 };
1951
1955
1960
1961
1962
1969
1970
1977
1999
2001
2002
2003
2004
2005
2006
2007
2009
2018};
2019
2022 switch (UnOp) {
2023 case llvm::Instruction::FNeg:
2024 return Opcode::FNeg;
2025 case llvm::Instruction::UnaryOpsEnd:
2027 }
2029 }
2033 friend Context;
2034public:
2037 const Twine &Name = "");
2041 const Twine &Name = "");
2042
2046};
2047
2048class BinaryOperator : public SingleLLVMInstructionImplllvm::BinaryOperator {
2049protected:
2051 switch (BinOp) {
2052 case llvm::Instruction::Add:
2053 return Opcode::Add;
2054 case llvm::Instruction::FAdd:
2055 return Opcode::FAdd;
2056 case llvm::Instruction::Sub:
2057 return Opcode::Sub;
2058 case llvm::Instruction::FSub:
2059 return Opcode::FSub;
2060 case llvm::Instruction::Mul:
2061 return Opcode::Mul;
2062 case llvm::Instruction::FMul:
2063 return Opcode::FMul;
2064 case llvm::Instruction::UDiv:
2065 return Opcode::UDiv;
2066 case llvm::Instruction::SDiv:
2067 return Opcode::SDiv;
2068 case llvm::Instruction::FDiv:
2069 return Opcode::FDiv;
2070 case llvm::Instruction::URem:
2071 return Opcode::URem;
2072 case llvm::Instruction::SRem:
2073 return Opcode::SRem;
2074 case llvm::Instruction::FRem:
2075 return Opcode::FRem;
2076 case llvm::Instruction::Shl:
2077 return Opcode::Shl;
2078 case llvm::Instruction::LShr:
2079 return Opcode::LShr;
2080 case llvm::Instruction::AShr:
2081 return Opcode::AShr;
2082 case llvm::Instruction::And:
2083 return Opcode::And;
2084 case llvm::Instruction::Or:
2085 return Opcode::Or;
2086 case llvm::Instruction::Xor:
2087 return Opcode::Xor;
2088 case llvm::Instruction::BinaryOpsEnd:
2090 }
2092 }
2098
2099public:
2102 const Twine &Name = "");
2103
2106 Value *CopyFrom,
2108 const Twine &Name = "");
2109
2111 return From->getSubclassID() == ClassID::BinaryOperator;
2112 }
2114};
2115
2116
2117
2118
2131
2132class AtomicRMWInst : public SingleLLVMInstructionImplllvm::AtomicRMWInst {
2134 : SingleLLVMInstructionImpl(ClassID::AtomicRMW,
2135 Instruction::Opcode::AtomicRMW, Atomic, Ctx) {
2136 }
2138
2139public:
2173 return const_cast<AtomicRMWInst *>(this)->getValOperand();
2174 }
2184
2189};
2190
2191class AtomicCmpXchgInst
2192 : public SingleLLVMInstructionImplllvm::AtomicCmpXchgInst {
2194 : SingleLLVMInstructionImpl(ClassID::AtomicCmpXchg,
2195 Instruction::Opcode::AtomicCmpXchg, Atomic,
2198
2199public:
2200
2201
2205
2207
2208
2212
2214
2227
2243
2248
2253
2254
2258
2264
2266 return From->getSubclassID() == ClassID::AtomicCmpXchg;
2267 }
2268};
2269
2272 : UnaryInstruction(ClassID::Alloca, Instruction::Opcode::Alloca, AI,
2275
2276public:
2279 Value *ArraySize = nullptr,
2280 const Twine &Name = "");
2281
2282
2283
2287
2288
2291 return const_cast<AllocaInst *>(this)->getArraySize();
2292 }
2293
2295
2299
2300
2304
2305
2309
2311
2312
2314
2315
2318
2319
2320
2324
2325
2329
2331
2334 return I->getSubclassID() == Instruction::ClassID::Alloca;
2335 return false;
2336 }
2337};
2338
2341 switch (CastOp) {
2342 case llvm::Instruction::ZExt:
2343 return Opcode::ZExt;
2344 case llvm::Instruction::SExt:
2345 return Opcode::SExt;
2346 case llvm::Instruction::FPToUI:
2347 return Opcode::FPToUI;
2348 case llvm::Instruction::FPToSI:
2349 return Opcode::FPToSI;
2350 case llvm::Instruction::FPExt:
2351 return Opcode::FPExt;
2352 case llvm::Instruction::PtrToAddr:
2353 return Opcode::PtrToAddr;
2354 case llvm::Instruction::PtrToInt:
2355 return Opcode::PtrToInt;
2356 case llvm::Instruction::IntToPtr:
2357 return Opcode::IntToPtr;
2358 case llvm::Instruction::SIToFP:
2359 return Opcode::SIToFP;
2360 case llvm::Instruction::UIToFP:
2361 return Opcode::UIToFP;
2362 case llvm::Instruction::Trunc:
2363 return Opcode::Trunc;
2364 case llvm::Instruction::FPTrunc:
2365 return Opcode::FPTrunc;
2366 case llvm::Instruction::BitCast:
2367 return Opcode::BitCast;
2368 case llvm::Instruction::AddrSpaceCast:
2369 return Opcode::AddrSpaceCast;
2370 case llvm::Instruction::CastOpsEnd:
2372 }
2374 }
2375
2376
2380 friend Context;
2381
2382public:
2385 const Twine &Name = "");
2386
2390};
2391
2392
2394public:
2399
2402 switch (I->getOpcode()) {
2403 case Opcode::ZExt:
2404 case Opcode::UIToFP:
2405 return true;
2406 default:
2407 return false;
2408 }
2409 }
2410 return false;
2411 }
2412};
2413
2414
2415template <Instruction::Opcode Op> class CastInstImpl : public CastInst {
2416public:
2418 Context &Ctx, const Twine &Name = "") {
2420 }
2421
2424 return I->getOpcode() == Op;
2425 return false;
2426 }
2427};
2428
2441 : public CastInstImplInstruction::Opcode::PtrToAddr {};
2446 : public CastInstImplInstruction::Opcode::AddrSpaceCast {
2447public:
2448
2450
2454
2456
2460
2464};
2465
2466class PHINode final : public SingleLLVMInstructionImplllvm::PHINode {
2467
2469 : SingleLLVMInstructionImpl(ClassID::PHI, Opcode::PHI, PHI, Ctx) {}
2470 friend Context;
2471
2472 struct LLVMBBToBB {
2473 Context &Ctx;
2474 LLVMBBToBB(Context &Ctx) : Ctx(Ctx) {}
2476 };
2477
2478public:
2479 LLVM_ABI static PHINode *create(Type *Ty, unsigned NumReservedValues,
2481 const Twine &Name = "");
2482
2484
2487
2489 LLVMBBToBB BBGetter(Ctx);
2491 BBGetter);
2492 }
2494 LLVMBBToBB BBGetter(Ctx);
2496 BBGetter);
2497 }
2501
2503
2505
2519
2521
2523
2526
2529
2531
2539
2540
2541
2542};
2543
2544
2545
2546#define WRAP_STATIC_PREDICATE(FunctionName) \
2547 static auto FunctionName(Predicate P) { return LLVMValType::FunctionName(P); }
2548
2549
2550#define WRAP_MEMBER(FunctionName) \
2551 auto FunctionName() const { return cast(Val)->FunctionName(); }
2552
2553#define WRAP_BOTH(FunctionName) \
2554 WRAP_STATIC_PREDICATE(FunctionName) \
2555 WRAP_MEMBER(FunctionName)
2556
2557class CmpInst : public SingleLLVMInstructionImplllvm::CmpInst {
2558protected:
2560
2562 : SingleLLVMInstructionImpl(Id, Opc, CI, Ctx) {}
2567
2568public:
2570
2573 const Twine &Name = "");
2578 const Twine &Name = "");
2581
2604
2605
2610
2611
2613
2614#ifndef NDEBUG
2617#endif
2618};
2619
2621
2623 : CmpInst(CI, Ctx, ClassID::ICmp, Opcode::ICmp) {}
2626
2627public:
2629
2640
2645
2651
2655};
2656
2658
2660 : CmpInst(CI, Ctx, ClassID::FCmp, Opcode::FCmp) {}
2663
2664public:
2666
2670
2676
2680};
2681
2682#undef WRAP_STATIC_PREDICATE
2683#undef WRAP_MEMBER
2684#undef WRAP_BOTH
2685
2686
2687
2688class OpaqueInst : public SingleLLVMInstructionImplllvm::Instruction {
2690 : SingleLLVMInstructionImpl(ClassID::Opaque, Opcode::Opaque, I, Ctx) {}
2692 : SingleLLVMInstructionImpl(SubclassID, Opcode::Opaque, I, Ctx) {}
2694
2695public:
2699};
2700
2701}
2702
2703#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
static bool isSigned(unsigned int Opcode)
Module.h This file contains the declarations for the Module class.
MachineInstr unsigned OpIdx
ppc ctr loops PowerPC CTR Loops Verify
const SmallVectorImpl< MachineOperand > & Cond
Class for arbitrary precision integers.
an instruction to allocate memory on the stack
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
An instruction that atomically checks whether a specified value is in a memory location,...
static bool isValidFailureOrdering(AtomicOrdering Ordering)
static bool isValidSuccessOrdering(AtomicOrdering Ordering)
an instruction that atomically reads a memory location, combines it with another value,...
static bool isFPOperation(BinOp Op)
BinOp
This enumeration lists the possible modifications atomicrmw can make.
static LLVM_ABI StringRef getOperationName(BinOp Op)
LLVM Basic Block Representation.
Conditional or Unconditional Branch instruction.
This is the base class for all instructions that perform data casts.
Instruction::CastOps getOpcode() const
Return the opcode of this CastInst.
This class is the base class for the comparison instructions.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
An abstraction over a floating-point predicate, and a pack of an integer predicate with samesign info...
This is the shared class of boolean and integer constants.
A parsed version of the target data layout string in and methods for querying it.
This instruction compares its operands according to the predicate given to the constructor.
static LLVM_ABI bool compare(const APFloat &LHS, const APFloat &RHS, FCmpInst::Predicate Pred)
Return result of LHS Pred RHS comparison.
static auto predicates()
Returns the sequence of all FCmp predicates.
Convenience struct for specifying and reasoning about fast-math flags.
An instruction for ordering other memory operations.
This class represents a freeze function that returns random concrete value if an operand is either a ...
Represents flags for the getelementptr instruction/expression.
static unsigned getPointerOperandIndex()
This instruction compares its operands according to the predicate given to the constructor.
static LLVM_ABI bool compare(const APInt &LHS, const APInt &RHS, ICmpInst::Predicate Pred)
Return result of LHS Pred RHS comparison.
static LLVM_ABI std::optional< bool > isImpliedByMatchingCmp(CmpPredicate Pred1, CmpPredicate Pred2)
Determine if Pred1 implies Pred2 is true, false, or if nothing can be inferred about the implication,...
static auto predicates()
Returns the sequence of all ICmp predicates.
This provides a uniform API for creating instructions and inserting them into a basic block: either a...
static LLVM_ABI bool isValidOperands(const Value *Vec, const Value *NewElt, const Value *Idx)
Return true if an insertelement instruction can be formed with the specified operands.
This instruction inserts a struct field of array element value into an aggregate value.
static unsigned getAggregateOperandIndex()
const unsigned * idx_iterator
static unsigned getInsertedValueOperandIndex()
The landingpad instruction holds all of the information necessary to generate correct exception handl...
An instruction for reading from memory.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
static unsigned getOperandNumForIncomingValue(unsigned i)
static unsigned getIncomingValueNumForOperand(unsigned i)
Resume the propagation of an exception.
This class represents the LLVM 'select' instruction.
static LLVM_ABI const char * areInvalidOperands(Value *Cond, Value *True, Value *False)
Return a string if the specified operands are invalid for a select operation, otherwise return null.
static LLVM_ABI bool isZeroEltSplatMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses all elements with the same value as the first element of exa...
ArrayRef< int > getShuffleMask() const
static LLVM_ABI bool isSpliceMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)
Return true if this shuffle mask is a splice mask, concatenating the two inputs together and then ext...
static LLVM_ABI bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
Return true if a shufflevector instruction can be formed with the specified operands.
static LLVM_ABI bool isSelectMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from its source vectors without lane crossings.
static LLVM_ABI bool isBitRotateMask(ArrayRef< int > Mask, unsigned EltSizeInBits, unsigned MinSubElts, unsigned MaxSubElts, unsigned &NumSubElts, unsigned &RotateAmt)
Checks if the shuffle is a bit rotation of the first operand across multiple subelements,...
static LLVM_ABI bool isOneUseSingleSourceMask(ArrayRef< int > Mask, int VF)
Return true if this shuffle mask represents "clustered" mask of size VF, i.e.
static LLVM_ABI bool isSingleSourceMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector.
static LLVM_ABI bool isDeInterleaveMaskOfFactor(ArrayRef< int > Mask, unsigned Factor, unsigned &Index)
Check if the mask is a DE-interleave mask of the given factor Factor like: <Index,...
static LLVM_ABI bool isIdentityMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
static LLVM_ABI bool isExtractSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)
Return true if this shuffle mask is an extract subvector mask.
static LLVM_ABI bool isReverseMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask swaps the order of elements from exactly one source vector.
static void commuteShuffleMask(MutableArrayRef< int > Mask, unsigned InVecNumElts)
Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have ...
static LLVM_ABI bool isTransposeMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask is a transpose mask.
static LLVM_ABI bool isInsertSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &NumSubElts, int &Index)
Return true if this shuffle mask is an insert subvector mask.
static LLVM_ABI bool isReplicationMask(ArrayRef< int > Mask, int &ReplicationFactor, int &VF)
Return true if this shuffle mask replicates each of the VF elements in a vector ReplicationFactor tim...
static LLVM_ABI bool isInterleaveMask(ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts, SmallVectorImpl< unsigned > &StartIndexes)
Return true if the mask interleaves one or more input vectors together.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
An instruction for storing to memory.
StringRef - Represent a constant reference to a string, i.e.
CaseIteratorImpl< ConstCaseHandle > ConstCaseIt
static const unsigned DefaultPseudoIndex
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
UnaryOps getOpcode() const
This function has undefined behavior.
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
static unsigned getPointerOperandIndex()
LLVM Value Representation.
An efficient, type-erasing, non-owning reference to a callable.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition Instruction.h:2446
unsigned getSrcAddressSpace() const
\Returns the address space of the pointer operand.
Definition Instruction.h:2457
Value * getPointerOperand()
\Returns the pointer operand.
Definition Instruction.h:2449
unsigned getDestAddressSpace() const
\Returns the address space of the result.
Definition Instruction.h:2461
const Value * getPointerOperand() const
\Returns the pointer operand.
Definition Instruction.h:2451
static unsigned getPointerOperandIndex()
\Returns the operand index of the pointer operand.
Definition Instruction.h:2455
bool isUsedWithInAlloca() const
Return true if this alloca is used as an inalloca argument to a call.
Definition Instruction.h:2326
LLVM_ABI Type * getAllocatedType() const
Return the type that is being allocated by the instruction.
bool isStaticAlloca() const
Return true if this alloca is in the entry block of the function and is a constant size.
Definition Instruction.h:2321
LLVM_ABI void setAllocatedType(Type *Ty)
for use only in special circumstances that need to generically transform a whole instruction (eg: IR ...
bool isArrayAllocation() const
Return true if there is an allocation size parameter to the allocation instruction that is not 1.
Definition Instruction.h:2284
std::optional< TypeSize > getAllocationSizeInBits(const DataLayout &DL) const
Get allocation size in bits.
Definition Instruction.h:2306
LLVM_ABI Value * getArraySize()
Get the number of elements allocated.
unsigned getAddressSpace() const
Return the address space for the allocation.
Definition Instruction.h:2296
Align getAlign() const
Return the alignment of the memory that is being allocated by the instruction.
Definition Instruction.h:2316
LLVM_ABI PointerType * getType() const
Overload to return most specific pointer type.
LLVM_ABI void setUsedWithInAlloca(bool V)
Specify whether this alloca is used to represent the arguments to a call.
friend class Context
Definition Instruction.h:2274
static bool classof(const Value *From)
Definition Instruction.h:2332
std::optional< TypeSize > getAllocationSize(const DataLayout &DL) const
Get allocation size in bytes.
Definition Instruction.h:2301
LLVM_ABI void setAlignment(Align Align)
const Value * getArraySize() const
Definition Instruction.h:2290
static LLVM_ABI AllocaInst * create(Type *Ty, unsigned AddrSpace, InsertPosition Pos, Context &Ctx, Value *ArraySize=nullptr, const Twine &Name="")
Definition Instruction.h:2192
LLVM_ABI Value * getPointerOperand()
const Value * getNewValOperand() const
Definition Instruction.h:2250
unsigned getPointerAddressSpace() const
Returns the address space of the pointer operand.
Definition Instruction.h:2255
AtomicOrdering getMergedOrdering() const
Definition Instruction.h:2232
LLVM_ABI void setSuccessOrdering(AtomicOrdering Ordering)
const Value * getCompareOperand() const
Definition Instruction.h:2245
LLVM_ABI void setWeak(bool IsWeak)
LLVM_ABI void setVolatile(bool V)
Specify whether this is a volatile cmpxchg.
const Value * getPointerOperand() const
Definition Instruction.h:2240
LLVM_ABI void setFailureOrdering(AtomicOrdering Ordering)
static bool classof(const Value *From)
Definition Instruction.h:2265
AtomicOrdering getFailureOrdering() const
Definition Instruction.h:2228
LLVM_ABI void setAlignment(Align Align)
LLVM_ABI Value * getCompareOperand()
static LLVM_ABI AtomicCmpXchgInst * create(Value *Ptr, Value *Cmp, Value *New, MaybeAlign Align, AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering, InsertPosition Pos, Context &Ctx, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
friend class Context
Definition Instruction.h:2197
static bool isValidFailureOrdering(AtomicOrdering Ordering)
Definition Instruction.h:2220
bool isVolatile() const
Return true if this is a cmpxchg from a volatile memory location.
Definition Instruction.h:2209
static bool isValidSuccessOrdering(AtomicOrdering Ordering)
Definition Instruction.h:2217
LLVM_ABI void setSyncScopeID(SyncScope::ID SSID)
AtomicOrdering getSuccessOrdering() const
Definition Instruction.h:2223
SyncScope::ID getSyncScopeID() const
Definition Instruction.h:2235
LLVM_ABI Value * getNewValOperand()
Align getAlign() const
Return the alignment of the memory that is being allocated by the instruction.
Definition Instruction.h:2202
bool isWeak() const
Return true if this cmpxchg may spuriously fail.
Definition Instruction.h:2215
Definition Instruction.h:2132
LLVM_ABI Value * getValOperand()
static LLVM_ABI AtomicRMWInst * create(BinOp Op, Value *Ptr, Value *Val, MaybeAlign Align, AtomicOrdering Ordering, InsertPosition Pos, Context &Ctx, SyncScope::ID SSID=SyncScope::System, const Twine &Name="")
BinOp getOperation() const
Definition Instruction.h:2141
const Value * getPointerOperand() const
Definition Instruction.h:2168
LLVM_ABI void setSyncScopeID(SyncScope::ID SSID)
unsigned getPointerAddressSpace() const
Definition Instruction.h:2175
llvm::AtomicRMWInst::BinOp BinOp
Definition Instruction.h:2140
LLVM_ABI void setOrdering(AtomicOrdering Ordering)
SyncScope::ID getSyncScopeID() const
Definition Instruction.h:2163
Align getAlign() const
Definition Instruction.h:2153
LLVM_ABI void setVolatile(bool V)
const Value * getValOperand() const
Definition Instruction.h:2172
static StringRef getOperationName(BinOp Op)
Definition Instruction.h:2144
AtomicOrdering getOrdering() const
Definition Instruction.h:2159
void setOperation(BinOp Op)
Definition Instruction.h:2150
LLVM_ABI Value * getPointerOperand()
static bool classof(const Value *From)
Definition Instruction.h:2181
friend class Context
Definition Instruction.h:2137
bool isVolatile() const
Definition Instruction.h:2155
bool isFloatingPointOperation() const
Definition Instruction.h:2178
static bool isFPOperation(BinOp Op)
Definition Instruction.h:2147
LLVM_ABI void setAlignment(Align Align)
void swapOperands()
Definition Instruction.h:2113
static LLVM_ABI Value * create(Instruction::Opcode Op, Value *LHS, Value *RHS, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static Opcode getBinOpOpcode(llvm::Instruction::BinaryOps BinOp)
Definition Instruction.h:2050
static bool classof(const Value *From)
For isa/dyn_cast.
Definition Instruction.h:2110
BinaryOperator(llvm::BinaryOperator *BinOp, Context &Ctx)
Definition Instruction.h:2093
static LLVM_ABI Value * createWithCopiedFlags(Instruction::Opcode Op, Value *LHS, Value *RHS, Value *CopyFrom, InsertPosition Pos, Context &Ctx, const Twine &Name="")
friend class Context
Definition Instruction.h:2097
Definition Instruction.h:2444
LLVM_ABI BasicBlock * getSuccessor(unsigned SuccIdx) const
LLVM_ABI Value * getCondition() const
mapped_iterator< llvm::BranchInst::const_succ_op_iterator, ConstLLVMBBToSBBB > const_sb_succ_op_iterator
Definition Instruction.h:1074
LLVM_ABI void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
unsigned getNumSuccessors() const
Definition Instruction.h:1044
iterator_range< sb_succ_op_iterator > successors()
Definition Instruction.h:1065
static LLVM_ABI BranchInst * create(BasicBlock *IfTrue, InsertPosition Pos, Context &Ctx)
static LLVM_ABI bool classof(const Value *From)
For isa/dyn_cast.
mapped_iterator< llvm::BranchInst::succ_op_iterator, LLVMBBToSBBB > sb_succ_op_iterator
Definition Instruction.h:1063
iterator_range< const_sb_succ_op_iterator > successors() const
Definition Instruction.h:1077
void setCondition(Value *V)
Definition Instruction.h:1043
bool isConditional() const
Definition Instruction.h:1039
void swapSuccessors()
Definition Instruction.h:1047
bool isUnconditional() const
Definition Instruction.h:1036
iterator_range< const_op_iterator > args() const
Definition Instruction.h:1367
CallingConv::ID getCallingConv() const
Definition Instruction.h:1422
bool isMustTailCall() const
Definition Instruction.h:1413
const Function * getCaller() const
Definition Instruction.h:1410
LLVM_ABI Function * getCalledFunction() const
LLVM_ABI Use getCalledOperandUse() const
LLVM_ABI FunctionType * getFunctionType() const
op_iterator arg_begin()
Definition Instruction.h:1356
const_op_iterator arg_end() const
Definition Instruction.h:1361
iterator_range< op_iterator > args()
Definition Instruction.h:1364
static bool classof(const Value *From)
Definition Instruction.h:1305
op_iterator arg_end()
Definition Instruction.h:1358
Value * getArgOperand(unsigned OpIdx) const
Definition Instruction.h:1373
bool isInlineAsm() const
Definition Instruction.h:1425
LLVM_ABI void setCalledFunction(Function *F)
Use getArgOperandUse(unsigned Idx)
Definition Instruction.h:1386
bool isDataOperand(Use U) const
Definition Instruction.h:1340
unsigned getArgOperandNo(Use U) const
Definition Instruction.h:1394
const_op_iterator data_operands_end() const
Definition Instruction.h:1323
op_iterator data_operands_end()
Definition Instruction.h:1318
LLVM_ABI Function * getCaller()
unsigned getDataOperandNo(Use U) const
Definition Instruction.h:1345
unsigned getNumTotalBundleOperands() const
Return the total number operands (not operand bundles) used by every operand bundle in this OperandBu...
Definition Instruction.h:1352
friend class InvokeInst
Definition Instruction.h:1301
bool arg_empty() const
Definition Instruction.h:1370
iterator_range< op_iterator > data_ops()
Definition Instruction.h:1328
const_op_iterator data_operands_begin() const
Definition Instruction.h:1315
bool isTailCall() const
Definition Instruction.h:1416
bool data_operands_empty() const
Definition Instruction.h:1334
bool hasArgument(const Value *V) const
Definition Instruction.h:1397
LLVM_ABI Value * getCalledOperand() const
void setCalledOperand(Value *V)
Definition Instruction.h:1420
unsigned arg_size() const
Definition Instruction.h:1371
unsigned data_operands_size() const
Definition Instruction.h:1337
const_op_iterator arg_begin() const
Definition Instruction.h:1357
Intrinsic::ID getIntrinsicID() const
Definition Instruction.h:1417
Use getArgOperandUse(unsigned Idx) const
Definition Instruction.h:1382
op_iterator data_operands_begin()
Definition Instruction.h:1314
bool isArgOperand(Use U) const
Definition Instruction.h:1391
void setArgOperand(unsigned OpIdx, Value *NewOp)
Definition Instruction.h:1377
iterator_range< const_op_iterator > data_ops() const
Definition Instruction.h:1331
friend class CallBrInst
Definition Instruction.h:1302
friend class CallInst
Definition Instruction.h:1300
bool isCallee(Use U) const
Definition Instruction.h:1406
bool isIndirectCall() const
Definition Instruction.h:1403
LLVM_ABI Value * getIndirectDestLabelUse(unsigned Idx) const
static LLVM_ABI CallBrInst * create(FunctionType *FTy, Value *Func, BasicBlock *DefaultDest, ArrayRef< BasicBlock * > IndirectDests, ArrayRef< Value * > Args, InsertPosition Pos, Context &Ctx, const Twine &NameStr="")
LLVM_ABI Value * getIndirectDestLabel(unsigned Idx) const
LLVM_ABI BasicBlock * getSuccessor(unsigned Idx) const
static bool classof(const Value *From)
Definition Instruction.h:1496
LLVM_ABI void setIndirectDest(unsigned Idx, BasicBlock *BB)
LLVM_ABI BasicBlock * getDefaultDest() const
unsigned getNumIndirectDests() const
Definition Instruction.h:1499
friend class Context
Definition Instruction.h:1487
LLVM_ABI BasicBlock * getIndirectDest(unsigned Idx) const
LLVM_ABI SmallVector< BasicBlock *, 16 > getIndirectDests() const
unsigned getNumSuccessors() const
Definition Instruction.h:1510
LLVM_ABI void setDefaultDest(BasicBlock *BB)
static LLVM_ABI CallInst * create(FunctionType *FTy, Value *Func, ArrayRef< Value * > Args, InsertPosition Pos, Context &Ctx, const Twine &NameStr="")
friend class IntrinsicInst
Definition Instruction.h:1434
friend class Context
Definition Instruction.h:1433
static bool classof(const Value *From)
Definition Instruction.h:1441
Definition Instruction.h:2415
static bool classof(const Value *From)
Definition Instruction.h:2422
static Value * create(Value *Src, Type *DestTy, InsertPosition Pos, Context &Ctx, const Twine &Name="")
Definition Instruction.h:2417
LLVM_ABI Type * getSrcTy() const
static LLVM_ABI Value * create(Type *DestTy, Opcode Op, Value *Operand, InsertPosition Pos, Context &Ctx, const Twine &Name="")
LLVM_ABI Type * getDestTy() const
static LLVM_ABI bool classof(const Value *From)
For isa/dyn_cast.
Definition Instruction.h:1590
static bool classof(const Value *From)
Definition Instruction.h:1603
static LLVM_ABI CatchPadInst * create(Value *ParentPad, ArrayRef< Value * > Args, InsertPosition Pos, Context &Ctx, const Twine &Name="")
LLVM_ABI CatchSwitchInst * getCatchSwitch() const
friend class Context
Definition Instruction.h:1593
LLVM_ABI CatchPadInst * getCatchPad() const
LLVM_ABI BasicBlock * getSuccessor() const
static bool classof(const Value *From)
Definition Instruction.h:1642
LLVM_ABI void setSuccessor(BasicBlock *NewSucc)
LLVM_ABI void setCatchPad(CatchPadInst *CatchPad)
friend class Context
Definition Instruction.h:1628
unsigned getNumSuccessors()
Definition Instruction.h:1638
LLVM_ABI Value * getCatchSwitchParentPad() const
static LLVM_ABI CatchReturnInst * create(CatchPadInst *CatchPad, BasicBlock *BB, InsertPosition Pos, Context &Ctx)
Definition Instruction.h:1756
LLVM_ABI void addHandler(BasicBlock *Dest)
const_handler_iterator handler_begin() const
Definition Instruction.h:1804
const_handler_iterator handler_end() const
Definition Instruction.h:1813
const BasicBlock *(*)(const Value *) ConstDerefFnTy
Definition Instruction.h:1793
iterator_range< const_handler_iterator > const_handler_range
Definition Instruction.h:1796
BasicBlock *(*)(Value *) DerefFnTy
Definition Instruction.h:1790
iterator_range< handler_iterator > handler_range
Definition Instruction.h:1792
unsigned getNumSuccessors() const
Definition Instruction.h:1829
LLVM_ABI void setParentPad(Value *ParentPad)
handler_range handlers()
Definition Instruction.h:1816
bool hasUnwindDest() const
Definition Instruction.h:1770
bool unwindsToCaller() const
Definition Instruction.h:1773
LLVM_ABI void setUnwindDest(BasicBlock *UnwindDest)
handler_iterator handler_begin()
Definition Instruction.h:1798
static LLVM_ABI CatchSwitchInst * create(Value *ParentPad, BasicBlock *UnwindBB, unsigned NumHandlers, InsertPosition Pos, Context &Ctx, const Twine &Name="")
mapped_iterator< const_op_iterator, ConstDerefFnTy > const_handler_iterator
Definition Instruction.h:1794
friend class Context
Definition Instruction.h:1760
mapped_iterator< op_iterator, DerefFnTy > handler_iterator
Definition Instruction.h:1791
static bool classof(const Value *From)
Definition Instruction.h:1841
handler_iterator handler_end()
Definition Instruction.h:1810
unsigned getNumHandlers() const
Definition Instruction.h:1779
void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
Definition Instruction.h:1835
LLVM_ABI BasicBlock * getUnwindDest() const
LLVM_ABI Value * getParentPad() const
BasicBlock * getSuccessor(unsigned Idx) const
Definition Instruction.h:1830
const_handler_range handlers() const
Definition Instruction.h:1819
Definition Instruction.h:1608
static LLVM_ABI CleanupPadInst * create(Value *ParentPad, ArrayRef< Value * > Args, InsertPosition Pos, Context &Ctx, const Twine &Name="")
friend class Context
Definition Instruction.h:1611
static bool classof(const Value *From)
Definition Instruction.h:1618
LLVM_ABI CleanupPadInst * getCleanupPad() const
bool hasUnwindDest() const
Definition Instruction.h:1658
LLVM_ABI void setUnwindDest(BasicBlock *NewDest)
bool unwindsToCaller() const
Definition Instruction.h:1661
static LLVM_ABI CleanupReturnInst * create(CleanupPadInst *CleanupPad, BasicBlock *UnwindBB, InsertPosition Pos, Context &Ctx)
unsigned getNumSuccessors() const
Definition Instruction.h:1666
LLVM_ABI BasicBlock * getUnwindDest() const
friend class Context
Definition Instruction.h:1652
LLVM_ABI void setCleanupPad(CleanupPadInst *CleanupPad)
static bool classof(const Value *From)
Definition Instruction.h:1672
llvm::CmpInst::Predicate Predicate
Definition Instruction.h:2569
WRAP_STATIC_PREDICATE(isUnordered)
llvm::CmpInst LLVMValType
Definition Instruction.h:2559
WRAP_BOTH(isTrueWhenEqual)
WRAP_BOTH(getInversePredicate)
static LLVM_ABI Value * createCommon(Value *Cond, Value *True, Value *False, const Twine &Name, IRBuilder<> &Builder, Context &Ctx)
void dumpOS(raw_ostream &OS) const override
LLVM_DUMP_METHOD void dump() const
WRAP_BOTH(getNonStrictPredicate)
static LLVM_ABI Value * createWithCopiedFlags(Predicate Pred, Value *S1, Value *S2, const Instruction *FlagsSource, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static LLVM_ABI Type * makeCmpResultType(Type *OpndType)
Create a result type for fcmp/icmp.
friend Context
Definition Instruction.h:2563
static LLVM_ABI Value * create(Predicate Pred, Value *S1, Value *S2, InsertPosition Pos, Context &Ctx, const Twine &Name="")
LLVM_ABI void setPredicate(Predicate P)
WRAP_BOTH(isIntPredicate)
WRAP_STATIC_PREDICATE(isOrdered)
WRAP_BOTH(isNonStrictPredicate)
WRAP_BOTH(getSwappedPredicate)
WRAP_BOTH(getStrictPredicate)
WRAP_BOTH(isStrictPredicate)
WRAP_STATIC_PREDICATE(getPredicateName)
CmpInst(llvm::CmpInst *CI, Context &Ctx, ClassID Id, Opcode Opc)
Use Context::createCmpInst(). Don't call the constructor directly.
Definition Instruction.h:2561
WRAP_BOTH(isFalseWhenEqual)
WRAP_MEMBER(getPredicate)
LLVM_ABI void swapOperands()
WRAP_BOTH(getUnorderedPredicate)
WRAP_BOTH(getFlippedStrictnessPredicate)
WRAP_BOTH(getOrderedPredicate)
WRAP_MEMBER(isCommutative)
static bool classof(const Value *From)
Method for support type inquiry through isa, cast, and dyn_cast:
Definition Instruction.h:2606
const Value * getVectorOperand() const
Definition Instruction.h:518
const Value * getIndexOperand() const
Definition Instruction.h:519
Value * getVectorOperand()
Definition Instruction.h:516
static LLVM_ABI Value * create(Value *Vec, Value *Idx, InsertPosition Pos, Context &Ctx, const Twine &Name="")
LLVM_ABI VectorType * getVectorOperandType() const
Value * getIndexOperand()
Definition Instruction.h:517
friend class Context
Definition Instruction.h:503
static bool classof(const Value *From)
Definition Instruction.h:509
static bool isValidOperands(const Value *Vec, const Value *Idx)
Definition Instruction.h:513
unsigned getNumIndices() const
Definition Instruction.h:1155
static LLVM_ABI Value * create(Value *Agg, ArrayRef< unsigned > Idxs, InsertPosition Pos, Context &Ctx, const Twine &Name="")
const Value * getAggregateOperand() const
Definition Instruction.h:1144
static unsigned getAggregateOperandIndex()
Definition Instruction.h:1147
idx_iterator idx_begin() const
Definition Instruction.h:1131
ArrayRef< unsigned > getIndices() const
Definition Instruction.h:1151
static LLVM_ABI Type * getIndexedType(Type *Agg, ArrayRef< unsigned > Idxs)
Returns the type of the element that would be extracted with an extractvalue instruction with the spe...
Value * getAggregateOperand()
Definition Instruction.h:1141
unsigned hasIndices() const
Definition Instruction.h:1159
llvm::ExtractValueInst::idx_iterator idx_iterator
Definition Instruction.h:1129
static bool classof(const Value *From)
Definition Instruction.h:1119
iterator_range< idx_iterator > indices() const
Definition Instruction.h:1137
idx_iterator idx_end() const
Definition Instruction.h:1134
WRAP_MEMBER(isRelational)
WRAP_MEMBER(isCommutative)
LLVM_ABI void swapOperands()
static bool compare(const APFloat &LHS, const APFloat &RHS, FCmpInst::Predicate Pred)
Definition Instruction.h:2672
static bool classof(const Value *From)
Definition Instruction.h:2677
static auto predicates()
Definition Instruction.h:2671
friend class Context
Definition Instruction.h:2661
Definition Instruction.h:2433
Definition Instruction.h:2437
Definition Instruction.h:2436
Definition Instruction.h:2432
AtomicOrdering getOrdering() const
Returns the ordering constraint of this fence instruction.
Definition Instruction.h:422
static LLVM_ABI FenceInst * create(AtomicOrdering Ordering, InsertPosition Pos, Context &Ctx, SyncScope::ID SSID=SyncScope::System)
LLVM_ABI void setOrdering(AtomicOrdering Ordering)
Sets the ordering constraint of this fence instruction.
SyncScope::ID getSyncScopeID() const
Returns the synchronization scope ID of this fence instruction.
Definition Instruction.h:429
static bool classof(const Value *From)
Definition Instruction.h:434
LLVM_ABI void setSyncScopeID(SyncScope::ID SSID)
Sets the synchronization scope ID of this fence instruction.
static LLVM_ABI FreezeInst * create(Value *V, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static bool classof(const Value *From)
Definition Instruction.h:1192
static bool classof(const Value *From)
Definition Instruction.h:1584
LLVM_ABI Value * getArgOperand(unsigned Idx) const
Return the Idx-th funcletpad argument.
LLVM_ABI Value * getParentPad() const
Return the outer EH-pad this funclet is nested within.
unsigned arg_size() const
Return the number of funcletpad arguments.
Definition Instruction.h:1569
LLVM_ABI void setParentPad(Value *ParentPad)
LLVM_ABI void setArgOperand(unsigned Idx, Value *V)
Set the Idx-th funcletpad argument.
friend class CatchPadInst
Definition Instruction.h:1564
friend class CleanupPadInst
Definition Instruction.h:1565
unsigned getAddressSpace() const
Definition Instruction.h:1700
bool hasAllConstantIndices() const
Definition Instruction.h:1733
bool hasNoUnsignedWrap() const
Definition Instruction.h:1745
op_iterator idx_begin()
Definition Instruction.h:1704
iterator_range< op_iterator > indices()
Definition Instruction.h:1712
const_op_iterator idx_begin() const
Definition Instruction.h:1705
unsigned getPointerAddressSpace() const
Definition Instruction.h:1724
op_iterator idx_end()
Definition Instruction.h:1708
GEPNoWrapFlags getNoWrapFlags() const
Definition Instruction.h:1736
bool hasIndices() const
Definition Instruction.h:1730
LLVM_ABI Type * getResultElementType() const
bool isInBounds() const
Definition Instruction.h:1739
unsigned getNumIndices() const
Definition Instruction.h:1727
LLVM_ABI Type * getPointerOperandType() const
static unsigned getPointerOperandIndex()
Definition Instruction.h:1720
friend class Context
Definition Instruction.h:1686
LLVM_ABI Type * getSourceElementType() const
bool hasNoUnsignedSignedWrap() const
Definition Instruction.h:1742
static bool classof(const Value *From)
Definition Instruction.h:1694
const_op_iterator idx_end() const
Definition Instruction.h:1709
LLVM_ABI Value * getPointerOperand() const
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
Definition Instruction.h:1748
iterator_range< const_op_iterator > indices() const
Definition Instruction.h:1715
static LLVM_ABI Value * create(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, InsertPosition Pos, Context &Ctx, const Twine &NameStr="")
static std::optional< bool > isImpliedByMatchingCmp(CmpPredicate Pred1, CmpPredicate Pred2)
Definition Instruction.h:2641
WRAP_BOTH(getSignedPredicate)
WRAP_STATIC_PREDICATE(isLE)
WRAP_STATIC_PREDICATE(isGE)
static bool compare(const APInt &LHS, const APInt &RHS, ICmpInst::Predicate Pred)
Definition Instruction.h:2647
WRAP_STATIC_PREDICATE(isGT)
LLVM_ABI void swapOperands()
WRAP_STATIC_PREDICATE(isLT)
WRAP_BOTH(getUnsignedPredicate)
friend class Context
Definition Instruction.h:2624
WRAP_MEMBER(isCommutative)
WRAP_MEMBER(isRelational)
WRAP_BOTH(getFlippedSignednessPredicate)
static auto predicates()
Definition Instruction.h:2646
static bool classof(const Value *From)
Definition Instruction.h:2652
static LLVM_ABI Value * create(Value *Vec, Value *NewElt, Value *Idx, InsertPosition Pos, Context &Ctx, const Twine &Name="")
friend class Context
Definition Instruction.h:481
static bool isValidOperands(const Value *Vec, const Value *NewElt, const Value *Idx)
Definition Instruction.h:490
static bool classof(const Value *From)
Definition Instruction.h:487
Definition Instruction.h:26
InsertPosition(BBIterator InsertAt)
Definition Instruction.h:34
InsertPosition(BasicBlock *InsertAtEnd)
Definition Instruction.h:30
const BBIterator & getIterator() const
Definition Instruction.h:36
Instruction & operator*()
Definition Instruction.h:37
BasicBlock * getBasicBlock() const
Definition Instruction.h:38
llvm::InsertValueInst::idx_iterator idx_iterator
Definition Instruction.h:978
Value * getAggregateOperand()
Definition Instruction.h:989
Value * getInsertedValueOperand()
Definition Instruction.h:999
idx_iterator idx_end() const
Definition Instruction.h:982
iterator_range< idx_iterator > indices() const
Definition Instruction.h:985
static bool classof(const Value *From)
Definition Instruction.h:974
const Value * getInsertedValueOperand() const
Definition Instruction.h:1002
unsigned hasIndices() const
Definition Instruction.h:1017
const Value * getAggregateOperand() const
Definition Instruction.h:992
static unsigned getInsertedValueOperandIndex()
Definition Instruction.h:1005
unsigned getNumIndices() const
Definition Instruction.h:1013
ArrayRef< unsigned > getIndices() const
Definition Instruction.h:1009
static LLVM_ABI Value * create(Value *Agg, Value *Val, ArrayRef< unsigned > Idxs, InsertPosition Pos, Context &Ctx, const Twine &Name="")
idx_iterator idx_begin() const
Definition Instruction.h:979
static unsigned getAggregateOperandIndex()
Definition Instruction.h:995
A sandboxir::User with operands, opcode and linked with previous/next instructions in an instruction ...
Definition Instruction.h:43
bool hasAtomicLoad() const
Definition Instruction.h:346
friend class InsertElementInst
Definition Instruction.h:67
bool hasNoUnsignedWrap() const
Determine whether the no signed wrap flag is set.
Definition Instruction.h:226
static IRBuilder & setInsertPos(InsertPosition Pos)
Helper function for create().
Definition Instruction.h:104
friend class CatchReturnInst
Definition Instruction.h:81
bool isAssociative() const
Definition Instruction.h:317
LLVM_ABI void setFastMathFlags(FastMathFlags FMF)
Convenience function for setting multiple fast-math flags on this instruction, which must be an opera...
bool isFenceLike() const
Definition Instruction.h:362
friend class UnreachableInst
Definition Instruction.h:94
friend class UnaryOperator
Definition Instruction.h:87
bool isSpecialTerminator() const
Definition Instruction.h:156
const DataLayout & getDataLayout() const
Definition Instruction.h:134
friend class SelectInst
Definition Instruction.h:65
friend class CastInst
Definition Instruction.h:92
bool hasAllowReassoc() const
Determine whether the allow-reassociation flag is set.
Definition Instruction.h:246
LLVM_ABI void setHasAllowReassoc(bool B)
Set or clear the reassociation flag on this instruction, which must be an operator which supports thi...
friend class FenceInst
Definition Instruction.h:64
bool mayWriteToMemory() const
Definition Instruction.h:333
friend class EraseFromParent
Definition Instruction.h:100
virtual unsigned getNumOfIRInstrs() const =0
This is used by BasicBlock::iterator.
bool hasNoSignedZeros() const
Determine whether the no-signed-zeros flag is set.
Definition Instruction.h:271
const char * getOpcodeName() const
Definition Instruction.h:132
bool isLogicalShift() const
Definition Instruction.h:162
LLVM_ABI void setHasNoSignedWrap(bool B=true)
Set or clear the nsw flag on this instruction, which must be an operator which supports this flag.
bool isShift() const
Definition Instruction.h:151
LLVM_ABI void insertAfter(Instruction *AfterI)
Insert this detached instruction after AfterI.
bool hasMetadata(unsigned KindID) const
Return true if this instruction has the given type of metadata attached.
Definition Instruction.h:182
friend class FreezeInst
Definition Instruction.h:63
bool hasMetadataOtherThanDebugLoc() const
Return true if this instruction has metadata attached to it other than a debug location.
Definition Instruction.h:177
friend class ExtractElementInst
Definition Instruction.h:66
void moveAfter(Instruction *After)
Move this instruction after After.
Definition Instruction.h:208
LLVM_ABI void moveBefore(BasicBlock &BB, const BBIterator &WhereIt)
Move this instruction to WhereIt.
bool hasAllowContract() const
Determine whether the allow-contract flag is set.
Definition Instruction.h:287
LLVM_ABI void setIsExact(bool B=true)
Set or clear the exact flag on this instruction, which must be an operator which supports this flag.
bool hasApproxFunc() const
Determine whether the approximate-math-functions flag is set.
Definition Instruction.h:295
bool hasNoSignedWrap() const
Determine whether the no signed wrap flag is set.
Definition Instruction.h:233
friend class StoreInst
Definition Instruction.h:73
friend class CmpInst
Definition Instruction.h:95
Opcode
Definition Instruction.h:45
friend class ShuffleVectorInst
Definition Instruction.h:68
bool isBinaryOp() const
Definition Instruction.h:147
friend class ExtractValueInst
Definition Instruction.h:69
LLVM_ABI void setHasNoUnsignedWrap(bool B=true)
Set or clear the nuw flag on this instruction, which must be an operator which supports this flag.
friend class ReturnInst
Definition Instruction.h:74
friend class BranchInst
Definition Instruction.h:71
Opcode getOpcode() const
\Returns this Instruction's opcode.
Definition Instruction.h:130
friend class SwitchInst
Definition Instruction.h:86
void dumpOS(raw_ostream &OS) const override
bool isFast() const
Determine whether all fast-math-flags are set.
Definition Instruction.h:240
LLVM_ABI BBIterator getIterator() const
\Returns a BasicBlock::iterator for this Instruction.
bool isCast() const
Definition Instruction.h:152
friend class VAArgInst
Definition Instruction.h:62
LLVM_ABI void setFast(bool B)
Set or clear all fast-math-flags on this instruction, which must be an operator which supports this f...
friend class InsertValueInst
Definition Instruction.h:70
friend class InvokeInst
Definition Instruction.h:76
LLVM_ABI void setHasApproxFunc(bool B)
Set or clear the approximate-math-functions flag on this instruction, which must be an operator which...
bool isIntDivRem() const
Definition Instruction.h:148
LLVM_ABI void setHasNoNaNs(bool B)
Set or clear the no-nans flag on this instruction, which must be an operator which supports this flag...
LLVM_ABI void copyFastMathFlags(FastMathFlags FMF)
Convenience function for transferring all fast-math flag values to this instruction,...
friend class CatchSwitchInst
Definition Instruction.h:85
friend class BinaryOperator
Definition Instruction.h:88
bool isFuncletPad() const
Definition Instruction.h:153
bool hasAtomicStore() const
Definition Instruction.h:350
friend class CatchPadInst
Definition Instruction.h:79
LLVM_ABI void setHasNoSignedZeros(bool B)
Set or clear the no-signed-zeros flag on this instruction, which must be an operator which supports t...
friend class ResumeInst
Definition Instruction.h:84
LLVM_ABI void insertInto(BasicBlock *BB, const BBIterator &WhereIt)
Insert this detached instruction into BB at WhereIt.
bool mayThrow(bool IncludePhaseOneUnwind=false) const
Definition Instruction.h:358
LLVM_ABI llvm::Instruction * getTopmostLLVMInstruction() const
A SandboxIR Instruction may map to multiple LLVM IR Instruction.
friend class LoadInst
Definition Instruction.h:72
friend class AtomicRMWInst
Definition Instruction.h:89
bool isUnaryOp() const
Definition Instruction.h:146
bool isIdempotent() const
Definition Instruction.h:325
bool hasMetadata() const
Return true if the instruction has any metadata attached to it.
Definition Instruction.h:171
LLVM_ABI void setHasAllowContract(bool B)
Set or clear the allow-contract flag on this instruction, which must be an operator which supports th...
bool isOnlyUserOfAnyOperand() const
Definition Instruction.h:159
virtual SmallVector< llvm::Instruction *, 1 > getLLVMInstrs() const =0
\Returns the LLVM IR Instructions that this SandboxIR maps to in program order.
Opcode Opc
Definition Instruction.h:57
void moveBefore(Instruction *Before)
Move this instruction before Before.
Definition Instruction.h:204
bool mayHaveSideEffects() const
Definition Instruction.h:366
LLVM_ABI Type * getAccessType() const
bool mayReadOrWriteMemory() const
Definition Instruction.h:340
bool isExact() const
Determine whether the exact flag is set.
Definition Instruction.h:254
bool mayReadFromMemory() const
Definition Instruction.h:337
Instruction(ClassID ID, Opcode Opc, llvm::Instruction *I, sandboxir::Context &SBCtx)
Definition Instruction.h:53
friend class GetElementPtrInst
Definition Instruction.h:83
FastMathFlags getFastMathFlags() const
Convenience function for getting all the fast-math flags, which must be an operator which supports th...
Definition Instruction.h:305
friend class PHINode
Definition Instruction.h:93
bool isAtomic() const
Definition Instruction.h:344
friend class CleanupPadInst
Definition Instruction.h:80
bool isVolatile() const
Definition Instruction.h:354
bool isCommutative() const
Definition Instruction.h:321
bool comesBefore(const Instruction *Other) const
Given an instruction Other in the same basic block as this instruction, return true if this instructi...
Definition Instruction.h:215
friend class AtomicCmpXchgInst
Definition Instruction.h:90
LLVM_ABI Instruction * getNextNode() const
\Returns the next sandboxir::Instruction in the block, or nullptr if at the end of the block.
bool hasNoInfs() const
Determine whether the no-infs flag is set.
Definition Instruction.h:265
friend class LandingPadInst
Definition Instruction.h:78
bool isNilpotent() const
Definition Instruction.h:329
friend class CallBrInst
Definition Instruction.h:77
LLVM_ABI void removeFromParent()
Detach this from its parent BasicBlock without deleting it.
LLVM_ABI Instruction * getPrevNode() const
\Returns the previous sandboxir::Instruction in the block, or nullptr if at the beginning of the bloc...
bool hasNoNaNs() const
Determine whether the no-NaNs flag is set.
Definition Instruction.h:259
friend class CleanupReturnInst
Definition Instruction.h:82
friend class AllocaInst
Definition Instruction.h:91
bool hasAllowReciprocal() const
Determine whether the allow-reciprocal flag is set.
Definition Instruction.h:279
LLVM_ABI void insertBefore(Instruction *BeforeI)
Insert this detached instruction before BeforeI.
friend class CallInst
Definition Instruction.h:75
LLVM_ABI void eraseFromParent()
Detach this Value from its parent and delete it.
LLVM_ABI void setHasAllowReciprocal(bool B)
Set or clear the allow-reciprocal flag on this instruction, which must be an operator which supports ...
LLVM_ABI void setHasNoInfs(bool B)
Set or clear the no-infs flag on this instruction, which must be an operator which supports this flag...
LLVM_ABI BasicBlock * getParent() const
\Returns the BasicBlock containing this Instruction, or null if it is detached.
static LLVM_ABI bool classof(const sandboxir::Value *From)
For isa/dyn_cast.
bool isTerminator() const
Definition Instruction.h:143
Definition Instruction.h:2438
LLVM_ABI BasicBlock * getUnwindDest() const
static LLVM_ABI InvokeInst * create(FunctionType *FTy, Value *Func, BasicBlock *IfNormal, BasicBlock *IfException, ArrayRef< Value * > Args, InsertPosition Pos, Context &Ctx, const Twine &NameStr="")
LLVM_ABI void setNormalDest(BasicBlock *BB)
unsigned getNumSuccessors() const
Definition Instruction.h:1477
LLVM_ABI void setUnwindDest(BasicBlock *BB)
friend class Context
Definition Instruction.h:1451
LLVM_ABI BasicBlock * getSuccessor(unsigned SuccIdx) const
static bool classof(const Value *From)
Definition Instruction.h:1461
LLVM_ABI BasicBlock * getNormalDest() const
void setSuccessor(unsigned SuccIdx, BasicBlock *NewSucc)
Definition Instruction.h:1470
LLVM_ABI LandingPadInst * getLandingPadInst() const
Definition Instruction.h:1515
bool isFilter(unsigned Idx) const
Return 'true' if the clause and index Idx is a filter clause.
Definition Instruction.h:1547
bool isCleanup() const
Return 'true' if this landingpad instruction is a cleanup.
Definition Instruction.h:1529
LLVM_ABI void setCleanup(bool V)
Indicate that this landingpad instruction is a cleanup.
unsigned getNumClauses() const
Get the number of clauses for this landing pad.
Definition Instruction.h:1551
bool isCatch(unsigned Idx) const
Return 'true' if the clause and index Idx is a catch clause.
Definition Instruction.h:1543
LLVM_ABI Constant * getClause(unsigned Idx) const
Get the value of the clause at index Idx.
friend class Context
Definition Instruction.h:1519
static bool classof(const Value *From)
Definition Instruction.h:1555
static LLVM_ABI LandingPadInst * create(Type *RetTy, unsigned NumReservedClauses, InsertPosition Pos, Context &Ctx, const Twine &Name="")
Definition Instruction.h:1197
bool isUnordered() const
Definition Instruction.h:1222
static LLVM_ABI LoadInst * create(Type *Ty, Value *Ptr, MaybeAlign Align, InsertPosition Pos, bool IsVolatile, Context &Ctx, const Twine &Name="")
static LoadInst * create(Type *Ty, Value *Ptr, MaybeAlign Align, InsertPosition Pos, Context &Ctx, const Twine &Name="")
Definition Instruction.h:1212
Align getAlign() const
Definition Instruction.h:1221
LLVM_ABI void setVolatile(bool V)
Specify whether this is a volatile load or not.
LLVM_ABI Value * getPointerOperand() const
bool isVolatile() const
Return true if this is a load from a volatile memory location.
Definition Instruction.h:1205
static LLVM_ABI bool classof(const Value *From)
For isa/dyn_cast.
bool isSimple() const
Definition Instruction.h:1223
friend class Context
Definition Instruction.h:2693
static bool classof(const sandboxir::Value *From)
Definition Instruction.h:2696
LLVM_ABI Value * hasConstantValue() const
iterator_range< const_block_iterator > blocks() const
Definition Instruction.h:2498
LLVM_ABI int getBasicBlockIndex(const BasicBlock *BB) const
const_block_iterator block_end() const
Definition Instruction.h:2493
const_op_range incoming_values() const
Definition Instruction.h:2504
bool hasConstantOrUndefValue() const
Definition Instruction.h:2532
unsigned getNumIncomingValues() const
Definition Instruction.h:2506
LLVM_ABI Value * getIncomingValue(unsigned Idx) const
LLVM_ABI void setIncomingBlock(unsigned Idx, BasicBlock *BB)
LLVM_ABI void removeIncomingValueIf(function_ref< bool(unsigned)> Predicate)
bool isComplete() const
Definition Instruction.h:2535
static LLVM_ABI bool classof(const Value *From)
For isa/dyn_cast.
const_block_iterator block_begin() const
Definition Instruction.h:2488
static LLVM_ABI PHINode * create(Type *Ty, unsigned NumReservedValues, InsertPosition Pos, Context &Ctx, const Twine &Name="")
mapped_iterator< llvm::PHINode::const_block_iterator, LLVMBBToBB > const_block_iterator
Definition Instruction.h:2485
LLVM_ABI Value * removeIncomingValue(unsigned Idx)
LLVM_ABI void setIncomingValue(unsigned Idx, Value *V)
LLVM_ABI BasicBlock * getIncomingBlock(unsigned Idx) const
op_range incoming_values()
Definition Instruction.h:2502
static unsigned getIncomingValueNumForOperand(unsigned Idx)
Definition Instruction.h:2514
LLVM_ABI void replaceIncomingBlockWith(const BasicBlock *Old, BasicBlock *New)
LLVM_ABI Value * getIncomingValueForBlock(const BasicBlock *BB) const
LLVM_ABI void addIncoming(Value *V, BasicBlock *BB)
static unsigned getOperandNumForIncomingValue(unsigned Idx)
Definition Instruction.h:2511
An or instruction, which can be marked as "disjoint", indicating that the inputs don't have a 1 in th...
Definition Instruction.h:2119
static bool classof(const Value *From)
For isa/dyn_cast.
Definition Instruction.h:2126
LLVM_ABI void setIsDisjoint(bool B)
bool isDisjoint() const
Definition Instruction.h:2122
Instruction that can have a nneg flag (zext/uitofp).
Definition Instruction.h:2393
bool hasNonNeg() const
Definition Instruction.h:2395
LLVM_ABI void setNonNeg(bool B)
static bool classof(const Value *From)
For isa/dyn_cast.
Definition Instruction.h:2400
Definition Instruction.h:2441
Definition Instruction.h:2442
static LLVM_ABI ResumeInst * create(Value *Exn, InsertPosition Pos, Context &Ctx)
unsigned getNumSuccessors() const
Definition Instruction.h:1855
static bool classof(const Value *From)
Definition Instruction.h:1858
friend class Context
Definition Instruction.h:1849
LLVM_ABI Value * getValue() const
static LLVM_ABI ReturnInst * create(Value *RetVal, InsertPosition Pos, Context &Ctx)
static bool classof(const Value *From)
Definition Instruction.h:1290
friend class Context
Definition Instruction.h:1283
LLVM_ABI Value * getReturnValue() const
\Returns null if there is no return value.
Definition Instruction.h:2431
Definition Instruction.h:2435
static const char * areInvalidOperands(Value *Cond, Value *True, Value *False)
Return a string if the specified operands are invalid for a select operation, otherwise return null.
Definition Instruction.h:465
static LLVM_ABI bool classof(const Value *From)
For isa/dyn_cast.
const Value * getFalseValue() const
Definition Instruction.h:453
Value * getCondition()
Definition Instruction.h:454
const Value * getTrueValue() const
Definition Instruction.h:452
LLVM_ABI void swapValues()
void setTrueValue(Value *New)
Definition Instruction.h:459
static LLVM_ABI Value * create(Value *Cond, Value *True, Value *False, InsertPosition Pos, Context &Ctx, const Twine &Name="")
void setCondition(Value *New)
Definition Instruction.h:458
const Value * getCondition() const
Definition Instruction.h:451
Value * getFalseValue()
Definition Instruction.h:456
void setFalseValue(Value *New)
Definition Instruction.h:460
Value * getTrueValue()
Definition Instruction.h:455
void getShuffleMask(SmallVectorImpl< int > &Result) const
Return the mask for this instruction as a vector of integers.
Definition Instruction.h:577
static bool isZeroEltSplatMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses all elements with the same value as the first element of exa...
Definition Instruction.h:720
bool isExtractSubvectorMask(int &Index) const
Return true if this shuffle mask is an extract subvector mask.
Definition Instruction.h:822
bool changesLength() const
Return true if this shuffle returns a vector with a different number of elements than its source vect...
Definition Instruction.h:597
bool isReverse() const
Return true if this shuffle swaps the order of elements from exactly one source vector.
Definition Instruction.h:711
LLVM_ABI VectorType * getType() const
Overload to return most specific vector type.
bool isIdentityWithPadding() const
Return true if this shuffle lengthens exactly one source vector with undefs in the high elements.
Definition Instruction.h:651
static bool isSingleSourceMask(const Constant *Mask, int NumSrcElts)
Definition Instruction.h:616
bool isIdentityWithExtract() const
Return true if this shuffle extracts the first N elements of exactly one source vector.
Definition Instruction.h:657
static bool isIdentityMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector without lane crossin...
Definition Instruction.h:633
ArrayRef< int > getShuffleMask() const
Definition Instruction.h:589
static bool isReverseMask(const Constant *Mask, int NumSrcElts)
Definition Instruction.h:703
LLVM_ABI Constant * getShuffleMaskForBitcode() const
Return the mask for this instruction, for use in bitcode.
static bool isExtractSubvectorMask(const Constant *Mask, int NumSrcElts, int &Index)
Definition Instruction.h:815
bool isInterleave(unsigned Factor) const
Return if this shuffle interleaves its two input vectors together.
Definition Instruction.h:895
static bool isInterleaveMask(ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts, SmallVectorImpl< unsigned > &StartIndexes)
Return true if the mask interleaves one or more input vectors together.
Definition Instruction.h:918
static bool isOneUseSingleSourceMask(ArrayRef< int > Mask, int VF)
Return true if this shuffle mask represents "clustered" mask of size VF, i.e.
Definition Instruction.h:877
static bool isTransposeMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask is a transpose mask.
Definition Instruction.h:768
static bool isTransposeMask(const Constant *Mask, int NumSrcElts)
Definition Instruction.h:771
static bool isInterleaveMask(ArrayRef< int > Mask, unsigned Factor, unsigned NumInputElts)
Definition Instruction.h:924
LLVM_ABI void commute()
Swap the operands and adjust the mask to preserve the semantics of the instruction.
static bool isReplicationMask(ArrayRef< int > Mask, int &ReplicationFactor, int &VF)
Return true if this shuffle mask replicates each of the VF elements in a vector ReplicationFactor tim...
Definition Instruction.h:851
static LLVM_ABI Value * create(Value *V1, Value *V2, Value *Mask, InsertPosition Pos, Context &Ctx, const Twine &Name="")
bool isIdentity() const
Return true if this shuffle chooses elements from exactly one source vector without lane crossings an...
Definition Instruction.h:645
static bool isReplicationMask(const Constant *Mask, int &ReplicationFactor, int &VF)
Definition Instruction.h:856
static bool isIdentityMask(const Constant *Mask, int NumSrcElts)
Definition Instruction.h:636
static bool isDeInterleaveMaskOfFactor(ArrayRef< int > Mask, unsigned Factor)
Definition Instruction.h:938
static LLVM_ABI Constant * convertShuffleMaskForBitcode(ArrayRef< int > Mask, Type *ResultTy)
bool isSingleSource() const
Return true if this shuffle chooses elements from exactly one source vector without changing the leng...
Definition Instruction.h:624
static bool isExtractSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)
Return true if this shuffle mask is an extract subvector mask.
Definition Instruction.h:810
bool isSplice(int &Index) const
Return true if this shuffle splices two inputs without changing the length of the vectors.
Definition Instruction.h:803
static bool isValidOperands(const Value *V1, const Value *V2, const Value *Mask)
Return true if a shufflevector instruction can be formed with the specified operands.
Definition Instruction.h:548
static bool isSelectMask(const Constant *Mask, int NumSrcElts)
Definition Instruction.h:679
static bool isSpliceMask(const Constant *Mask, int NumSrcElts, int &Index)
Definition Instruction.h:794
static bool isBitRotateMask(ArrayRef< int > Mask, unsigned EltSizeInBits, unsigned MinSubElts, unsigned MaxSubElts, unsigned &NumSubElts, unsigned &RotateAmt)
Checks if the shuffle is a bit rotation of the first operand across multiple subelements,...
Definition Instruction.h:953
bool isReplicationMask(int &ReplicationFactor, int &VF) const
Return true if this shuffle mask is a replication mask.
Definition Instruction.h:863
bool isConcat() const
Return true if this shuffle concatenates its 2 source vectors.
Definition Instruction.h:664
static bool isValidOperands(const Value *V1, const Value *V2, ArrayRef< int > Mask)
Definition Instruction.h:553
static bool isInsertSubvectorMask(const Constant *Mask, int NumSrcElts, int &NumSubElts, int &Index)
Definition Instruction.h:835
static bool isSpliceMask(ArrayRef< int > Mask, int NumSrcElts, int &Index)
Return true if this shuffle mask is a splice mask, concatenating the two inputs together and then ext...
Definition Instruction.h:791
static bool isSelectMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from its source vectors without lane crossings.
Definition Instruction.h:676
static void commuteShuffleMask(MutableArrayRef< int > Mask, unsigned InVecNumElts)
Change values in a shuffle permute mask assuming the two vector operands of length InVecNumElts have ...
Definition Instruction.h:889
bool increasesLength() const
Return true if this shuffle returns a vector with a greater number of elements than its source vector...
Definition Instruction.h:604
bool isZeroEltSplat() const
Return true if all elements of this shuffle are the same value as the first element of exactly one so...
Definition Instruction.h:732
static bool isInsertSubvectorMask(ArrayRef< int > Mask, int NumSrcElts, int &NumSubElts, int &Index)
Return true if this shuffle mask is an insert subvector mask.
Definition Instruction.h:830
static void getShuffleMask(const Constant *Mask, SmallVectorImpl< int > &Result)
Convert the input shuffle mask operand to a vector of integers.
Definition Instruction.h:569
static bool isZeroEltSplatMask(const Constant *Mask, int NumSrcElts)
Definition Instruction.h:723
LLVM_ABI void setShuffleMask(ArrayRef< int > Mask)
static bool isReverseMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask swaps the order of elements from exactly one source vector.
Definition Instruction.h:700
friend class Context
Definition Instruction.h:529
static bool isSingleSourceMask(ArrayRef< int > Mask, int NumSrcElts)
Return true if this shuffle mask chooses elements from exactly one source vector.
Definition Instruction.h:613
bool isOneUseSingleSourceMask(int VF) const
Return true if this shuffle mask is a one-use-single-source("clustered") mask.
Definition Instruction.h:883
static bool isDeInterleaveMaskOfFactor(ArrayRef< int > Mask, unsigned Factor, unsigned &Index)
Check if the mask is a DE-interleave mask of the given factor Factor like: <Index,...
Definition Instruction.h:933
int getMaskValue(unsigned Elt) const
Return the shuffle mask value of this instruction for the given element index.
Definition Instruction.h:563
bool isInsertSubvectorMask(int &NumSubElts, int &Index) const
Return true if this shuffle mask is an insert subvector mask.
Definition Instruction.h:842
bool isSelect() const
Return true if this shuffle chooses elements from its source vectors without lane crossings and all o...
Definition Instruction.h:691
bool isTranspose() const
Return true if this shuffle transposes the elements of its inputs without changing the length of the ...
Definition Instruction.h:781
static bool classof(const Value *From)
Definition Instruction.h:538
friend class CmpInst
Definition Instruction.h:389
void dumpOS(raw_ostream &OS) const override
Definition Instruction.h:405
friend class CallBase
Definition Instruction.h:387
void verify() const final
Should crash if there is something wrong with the instruction.
Definition Instruction.h:404
friend class FuncletPadInst
Definition Instruction.h:388
friend class UnaryInstruction
Definition Instruction.h:386
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
Definition Instruction.h:399
unsigned getNumOfIRInstrs() const final
This is used by BasicBlock::iterator.
Definition Instruction.h:402
Definition Instruction.h:1226
Align getAlign() const
Definition Instruction.h:1250
LLVM_ABI void setVolatile(bool V)
Specify whether this is a volatile store or not.
static LLVM_ABI bool classof(const Value *From)
For isa/dyn_cast.
bool isUnordered() const
Definition Instruction.h:1252
static StoreInst * create(Value *V, Value *Ptr, MaybeAlign Align, InsertPosition Pos, Context &Ctx)
Definition Instruction.h:1241
static LLVM_ABI StoreInst * create(Value *V, Value *Ptr, MaybeAlign Align, InsertPosition Pos, bool IsVolatile, Context &Ctx)
LLVM_ABI Value * getPointerOperand() const
bool isSimple() const
Definition Instruction.h:1251
bool isVolatile() const
Return true if this is a store from a volatile memory location.
Definition Instruction.h:1234
LLVM_ABI Value * getValueOperand() const
Definition Instruction.h:1893
unsigned getCaseIndex() const
Definition Instruction.h:1906
unsigned getSuccessorIndex() const
Definition Instruction.h:1910
BlockT * getCaseSuccessor() const
friend class CaseItImpl
Definition Instruction.h:1899
CaseHandleImpl(Context &Ctx, LLVMCaseItT LLVMCaseIt)
Definition Instruction.h:1902
ConstT * getCaseValue() const
Definition Instruction.h:1922
bool operator<(const CaseItImpl &Other) const
Definition Instruction.h:1944
CaseItImpl & operator+=(ptrdiff_t N)
Definition Instruction.h:1930
CaseItImpl & operator-=(ptrdiff_t N)
Definition Instruction.h:1934
CaseItImpl(SwitchInst *SI, ptrdiff_t CaseNum)
Definition Instruction.h:1927
bool operator==(const CaseItImpl &Other) const
Definition Instruction.h:1941
CaseItImpl(Context &Ctx, LLVMCaseItT It)
Definition Instruction.h:1926
const CaseHandleImpl< LLVMCaseItT, BlockT, ConstT > & operator*() const
Definition Instruction.h:1947
ptrdiff_t operator-(const CaseItImpl &Other) const
Definition Instruction.h:1938
CaseIt findCaseValue(const ConstantInt *C)
Definition Instruction.h:1990
iterator_range< ConstCaseIt > cases() const
Definition Instruction.h:1981
static LLVM_ABI SwitchInst * create(Value *V, BasicBlock *Dest, unsigned NumCases, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static constexpr unsigned DefaultPseudoIndex
Definition Instruction.h:1869
CaseItImpl< llvm::SwitchInst::ConstCaseIt, const BasicBlock, const ConstantInt > ConstCaseIt
Definition Instruction.h:1958
LLVM_ABI void addCase(ConstantInt *OnVal, BasicBlock *Dest)
LLVM_ABI BasicBlock * getSuccessor(unsigned Idx) const
CaseIt case_begin()
Returns a read/write iterator that points to the first case in the SwitchInst.
Definition Instruction.h:1963
CaseIt case_default()
Definition Instruction.h:1984
LLVM_ABI void setDefaultDest(BasicBlock *DefaultCase)
iterator_range< CaseIt > cases()
Iteration adapter for range-for loops.
Definition Instruction.h:1978
ConstCaseIt case_begin() const
Definition Instruction.h:1966
bool defaultDestUnreachable() const
Definition Instruction.h:1879
CaseHandleImpl< llvm::SwitchInst::ConstCaseIt, const BasicBlock, const ConstantInt > ConstCaseHandle
Definition Instruction.h:1956
LLVM_ABI BasicBlock * getDefaultDest() const
ConstCaseIt case_end() const
Definition Instruction.h:1974
CaseItImpl< llvm::SwitchInst::CaseIt, BasicBlock, ConstantInt > CaseIt
Definition Instruction.h:1954
ConstCaseIt case_default() const
Definition Instruction.h:1987
static bool classof(const Value *From)
Definition Instruction.h:2015
LLVM_ABI Value * getCondition() const
LLVM_ABI void setSuccessor(unsigned Idx, BasicBlock *NewSucc)
friend class Context
Definition Instruction.h:1866
unsigned getNumCases() const
Definition Instruction.h:1883
unsigned getNumSuccessors() const
Definition Instruction.h:2010
CaseIt case_end()
Returns a read/write iterator that points one past the last in the SwitchInst.
Definition Instruction.h:1971
LLVM_ABI void setCondition(Value *V)
CaseHandleImpl< llvm::SwitchInst::CaseIt, BasicBlock, ConstantInt > CaseHandle
Definition Instruction.h:1952
ConstCaseIt findCaseValue(const ConstantInt *C) const
Definition Instruction.h:1994
LLVM_ABI ConstantInt * findCaseDest(BasicBlock *BB)
LLVM_ABI CaseIt removeCase(CaseIt It)
This method removes the specified case and its successor from the switch instruction.
Definition Instruction.h:2429
Just like llvm::Type these are immutable, unique, never get freed and can only be created via static ...
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
Definition Instruction.h:2434
static bool classof(const Instruction *I)
Definition Instruction.h:1099
UnaryInstruction(ClassID ID, Opcode Opc, llvm::Instruction *LLVMI, Context &Ctx)
Definition Instruction.h:1094
static bool classof(const Value *V)
Definition Instruction.h:1102
static bool classof(const Value *From)
For isa/dyn_cast.
Definition Instruction.h:2043
static LLVM_ABI Value * createWithCopiedFlags(Instruction::Opcode Op, Value *OpV, Value *CopyFrom, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static LLVM_ABI Value * create(Instruction::Opcode Op, Value *OpV, InsertPosition Pos, Context &Ctx, const Twine &Name="")
static LLVM_ABI UnreachableInst * create(InsertPosition Pos, Context &Ctx)
unsigned getNumOfIRInstrs() const final
This is used by BasicBlock::iterator.
Definition Instruction.h:1274
unsigned getUseOperandNo(const Use &Use) const final
\Returns the operand index of Use.
Definition Instruction.h:1271
unsigned getNumSuccessors() const
Definition Instruction.h:1270
static LLVM_ABI bool classof(const Value *From)
Represents a Def-use/Use-def edge in SandboxIR.
LLVM_ABI void set(Value *V)
virtual op_iterator op_begin()
unsigned getUseOperandNoDefault(const Use &Use) const
The default implementation works only for single-LLVMIR-instruction Users and only if they match exac...
OperandUseIterator const_op_iterator
virtual void setOperand(unsigned OperandIdx, Value *Operand)
Use getOperandUseDefault(unsigned OpIdx, bool Verify) const
\Returns the Use edge that corresponds to OpIdx.
OperandUseIterator op_iterator
void swapOperandsInternal(unsigned OpIdxA, unsigned OpIdxB)
virtual unsigned getNumOperands() const
Use getOperandUse(unsigned OpIdx) const
\Returns the operand edge for OpIdx.
iterator_range< const_op_iterator > const_op_range
virtual op_iterator op_end()
iterator_range< op_iterator > op_range
User(ClassID ID, llvm::Value *V, Context &Ctx)
LLVM_ABI Value * getPointerOperand()
static LLVM_ABI VAArgInst * create(Value *List, Type *Ty, InsertPosition Pos, Context &Ctx, const Twine &Name="")
const Value * getPointerOperand() const
Definition Instruction.h:1173
static bool classof(const Value *From)
Definition Instruction.h:1179
static unsigned getPointerOperandIndex()
Definition Instruction.h:1176
A SandboxIR Value has users. This is the base class.
llvm::Value * Val
The LLVM Value that corresponds to this SandboxIR Value.
ClassID getSubclassID() const
void dumpCommonSuffix(raw_ostream &OS) const
Context & Ctx
All values point to the context.
ClassID SubclassID
For isa/dyn_cast.
LLVM_ABI Type * getType() const
void dumpCommonPrefix(raw_ostream &OS) const
Definition Instruction.h:2430
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ C
The default llvm calling convention, compatible with C.
@ System
Synchronized with respect to all concurrently executing threads.
static bool isOrdered(Instruction *I)
Context & getContext() const
BasicBlock(llvm::BasicBlock *BB, Context &SBCtx)
friend class Instruction
Iterator for Instructions in a `BasicBlock.
static SmallVector< Value *, 4 > getOperand(ArrayRef< Value * > Bndl, unsigned OpIdx)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast - Return the argument parameter cast to the specified type.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
mapped_iterator< ItTy, FuncTy > map_iterator(ItTy I, FuncTy F)
bool isa(const From &Val)
isa - Return true if the parameter to the template is an instance of one of the template type argu...
AtomicOrdering
Atomic ordering for LLVM's memory model.
DWARFExpression::Operation Op
decltype(auto) cast(const From &Val)
cast - Return the argument parameter cast to the specified type.
bool is_contained(R &&Range, const E &Element)
Returns true if Element is found in Range.
This struct is a compact representation of a valid (non-zero power of two) alignment.
The const version of succ_op_iterator.
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.