LLVM: include/llvm/CodeGen/MachineInstr.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#ifndef LLVM_CODEGEN_MACHINEINSTR_H
16#define LLVM_CODEGEN_MACHINEINSTR_H
17
36#include
37#include
38#include
39#include
40
41namespace llvm {
42
62
63
64
65
66
67
68
69
70class MachineInstr
72 ilist_sentinel_tracking> {
73public:
75
76
77
78
79
85
88 FrameSetup = 1 << 0,
89
90 FrameDestroy = 1 << 1,
91
92 BundledPred = 1 << 2,
93 BundledSucc = 1 << 3,
95
97
99
101
102 FmContract = 1 << 8,
103
105
107
109
111
113
114 NoFPExcept = 1 << 14,
115
117
118
119 Unpredictable = 1 << 16,
120 NoConvergent = 1 << 17,
124
127
128 };
129
130private:
132 MachineBasicBlock *Parent = nullptr;
133
134
135 MachineOperand *Operands = nullptr;
136
137#define LLVM_MI_NUMOPERANDS_BITS 24
138#define LLVM_MI_FLAGS_BITS 24
139#define LLVM_MI_ASMPRINTERFLAGS_BITS 8
140
141
143
144
145
146 using OperandCapacity = ArrayRecycler::Capacity;
147 OperandCapacity CapOperands;
148
149
151
152
153
154
156
157
158
159
160
161
162
163 class ExtraInfo final
164 : TrailingObjects<ExtraInfo, MachineMemOperand *, MCSymbol *, MDNode *,
165 uint32_t, Value *> {
166 public:
169 MCSymbol *PreInstrSymbol = nullptr,
170 MCSymbol *PostInstrSymbol = nullptr,
171 MDNode *HeapAllocMarker = nullptr,
172 MDNode *PCSections = nullptr, uint32_t CFIType = 0,
173 MDNode *MMRAs = nullptr, Value *DS = nullptr) {
174 bool HasPreInstrSymbol = PreInstrSymbol != nullptr;
175 bool HasPostInstrSymbol = PostInstrSymbol != nullptr;
176 bool HasHeapAllocMarker = HeapAllocMarker != nullptr;
177 bool HasMMRAs = MMRAs != nullptr;
178 bool HasCFIType = CFIType != 0;
179 bool HasPCSections = PCSections != nullptr;
180 bool HasDS = DS != nullptr;
181 auto *Result = new (Allocator.Allocate(
183 Value *>(
184 MMOs.size(), HasPreInstrSymbol + HasPostInstrSymbol,
185 HasHeapAllocMarker + HasPCSections + HasMMRAs, HasCFIType, HasDS),
186 alignof(ExtraInfo)))
187 ExtraInfo(MMOs.size(), HasPreInstrSymbol, HasPostInstrSymbol,
188 HasHeapAllocMarker, HasPCSections, HasCFIType, HasMMRAs,
189 HasDS);
190
191
192 llvm::copy(MMOs, Result->getTrailingObjects<MachineMemOperand *>());
193
194 unsigned MDNodeIdx = 0;
195
196 if (HasPreInstrSymbol)
197 Result->getTrailingObjects<MCSymbol *>()[0] = PreInstrSymbol;
198 if (HasPostInstrSymbol)
199 Result->getTrailingObjects<MCSymbol *>()[HasPreInstrSymbol] =
200 PostInstrSymbol;
201 if (HasHeapAllocMarker)
202 Result->getTrailingObjects<MDNode *>()[MDNodeIdx++] = HeapAllocMarker;
203 if (HasPCSections)
204 Result->getTrailingObjects<MDNode *>()[MDNodeIdx++] = PCSections;
205 if (HasCFIType)
206 Result->getTrailingObjects<uint32_t>()[0] = CFIType;
207 if (HasMMRAs)
208 Result->getTrailingObjects<MDNode *>()[MDNodeIdx++] = MMRAs;
209 if (HasDS)
210 Result->getTrailingObjects<Value *>()[0] = DS;
211
212 return Result;
213 }
214
217 }
218
221 }
222
224 return HasPostInstrSymbol
226 : nullptr;
227 }
228
231 }
232
234 return HasPCSections
236 : nullptr;
237 }
238
241 }
242
245 HasPCSections]
246 : nullptr;
247 }
248
251 }
252
253 private:
255
256
257
258
259
260
261 const int NumMMOs;
262 const bool HasPreInstrSymbol;
263 const bool HasPostInstrSymbol;
264 const bool HasHeapAllocMarker;
265 const bool HasPCSections;
266 const bool HasCFIType;
267 const bool HasMMRAs;
268 const bool HasDS;
269
270
271 size_t numTrailingObjects(OverloadToken<MachineMemOperand *>) const {
272 return NumMMOs;
273 }
274 size_t numTrailingObjects(OverloadToken<MCSymbol *>) const {
275 return HasPreInstrSymbol + HasPostInstrSymbol;
276 }
277 size_t numTrailingObjects(OverloadToken<MDNode *>) const {
278 return HasHeapAllocMarker + HasPCSections;
279 }
280 size_t numTrailingObjects(OverloadToken<uint32_t>) const {
281 return HasCFIType;
282 }
283 size_t numTrailingObjects(OverloadToken<Value *>) const { return HasDS; }
284
285
286
287 ExtraInfo(int NumMMOs, bool HasPreInstrSymbol, bool HasPostInstrSymbol,
288 bool HasHeapAllocMarker, bool HasPCSections, bool HasCFIType,
289 bool HasMMRAs, bool HasDS)
290 : NumMMOs(NumMMOs), HasPreInstrSymbol(HasPreInstrSymbol),
291 HasPostInstrSymbol(HasPostInstrSymbol),
292 HasHeapAllocMarker(HasHeapAllocMarker), HasPCSections(HasPCSections),
293 HasCFIType(HasCFIType), HasMMRAs(HasMMRAs), HasDS(HasDS) {}
294 };
295
296
297
298
299 enum ExtraInfoInlineKinds {
300 EIIK_MMO = 0,
301 EIIK_PreInstrSymbol,
302 EIIK_PostInstrSymbol,
303 EIIK_OutOfLine
304 };
305
306
307
308
309
310
311 PointerSumType<ExtraInfoInlineKinds,
312 PointerSumTypeMember<EIIK_MMO, MachineMemOperand *>,
313 PointerSumTypeMember<EIIK_PreInstrSymbol, MCSymbol *>,
314 PointerSumTypeMember<EIIK_PostInstrSymbol, MCSymbol *>,
315 PointerSumTypeMember<EIIK_OutOfLine, ExtraInfo *>>
316 Info;
317
318 DebugLoc DbgLoc;
319
320
321
322 unsigned DebugInstrNum;
323
324
326
327
331
332
333
335
336
337
338
340 bool NoImp = false);
341
342
344
345 void
348
350 return Op.isReg() && Op.isDef();
351 }
352
354 return Op.isReg() && Op.isUse();
355 }
356
358 return {Operands, NumOperands};
359 }
361 return {Operands, NumOperands};
362 }
363
364public:
366 MachineInstr &operator=(const MachineInstr &) = delete;
367
369
372
373
375
376
377
378
379
380
384 static_cast<const MachineInstr *>(this)->getMF());
385 }
386
387
389
390
392
393
396 "Flag is out of range for the AsmPrinterFlags field");
397 return AsmPrinterFlags & Flag;
398 }
399
400
403 "Flag is out of range for the AsmPrinterFlags field");
404 AsmPrinterFlags |= Flag;
405 }
406
407
410 "Flag is out of range for the AsmPrinterFlags field");
411 AsmPrinterFlags &= ~Flag;
412 }
413
414
418
419
422 "Flag is out of range for the Flags field");
423 return Flags & Flag;
424 }
425
426
429 "Flag is out of range for the Flags field");
431 }
432
435 "flags to be set are out of range for the Flags field");
436
438 Flags = (Flags & Mask) | (flags & ~Mask);
439 }
440
441
444 "Flag to clear is out of range for the Flags field");
446 }
447
450 "flags to be cleared are out of range for the Flags field");
451 Flags &= ~flags;
452 }
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
492
493
494
498
499
500
502
503
504
506
507
508
510
511
512
514
515
517
518
520
521
523
524
525
526
535
536
537
540
541
542
544
545
546
549
550
551
553
554
555
557
558
559
561
562
563
564
566
567
568
570
571
572
574
575
576
577
578
580
581
582
584
585
586
587
589
590
591
593
594
596
597
598 unsigned getOpcode() const { return Opcode; }
599
600
602
603
605
607 return operands_impl()[i];
608 }
610
619
620
621
624 return Op.isReg() && Op.getReg() == Reg;
625 });
626 }
627
628
629
637
641
646
647
651
652
655 if (MO.isDef())
656 return true;
657 return false;
658 }
659
660
664
665
669 return true;
671 return true;
673 return true;
675 return true;
676 return false;
677 }
678
679
681
682
684
685
686
687
688
689
690
691
694
697
700
703
706
719
720
721
725 : operands_impl().drop_front(2);
726 }
727
731 : operands_impl().drop_front(2);
732 }
733
734
736
740
741
743
748 return operands_impl()
751 }
753 return operands_impl()
756 }
757
762
763
764
768
772
773
774
778
782
783
787
788
789
790
792 if (!Info)
793 return {};
794
795 if (Info.is<EIIK_MMO>())
796 return ArrayRef(Info.getAddrOfZeroTagPointer(), 1);
797
798 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
799 return EI->getMMOs();
800
801 return {};
802 }
803
804
805
806
807
808
810
811
812
813
814
815
817
818
819
820
822
823
825
826
828
829
831 if (!Info)
832 return nullptr;
833 if (MCSymbol *S = Info.get<EIIK_PreInstrSymbol>())
834 return S;
835 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
836 return EI->getPreInstrSymbol();
837
838 return nullptr;
839 }
840
841
843 if (!Info)
844 return nullptr;
845 if (MCSymbol *S = Info.get<EIIK_PostInstrSymbol>())
846 return S;
847 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
848 return EI->getPostInstrSymbol();
849
850 return nullptr;
851 }
852
853
855 if (!Info)
856 return nullptr;
857 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
858 return EI->getHeapAllocMarker();
859
860 return nullptr;
861 }
862
863
865 if (!Info)
866 return nullptr;
867 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
868 return EI->getPCSections();
869
870 return nullptr;
871 }
872
873
875 if (!Info)
876 return nullptr;
877 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
878 return EI->getMMRAMetadata();
879 return nullptr;
880 }
881
883 if (!Info)
884 return nullptr;
885 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
886 return EI->getDeactivationSymbol();
887 return nullptr;
888 }
889
890
892 if (!Info)
893 return 0;
894 if (ExtraInfo *EI = Info.get<EIIK_OutOfLine>())
895 return EI->getCFIType();
896
897 return 0;
898 }
899
900
901
902
908
909
910
911
912
913
915 assert(MCFlag < 64 &&
916 "MCFlag out of range for bit mask in getFlags/hasPropertyInBundle.");
917
920
921
922 return hasPropertyInBundle(1ULL << MCFlag, Type);
923 }
924
925
926
930
931
932
933
934
938
939
940
944
945
946
950
951
952
956
960
961
962
966
970
971
972
975
976
977
978
980
981
982
983
987
988
989
990
991
992
996
997
998
999
1000
1004
1005
1006
1010
1011
1012
1013
1014
1018
1019
1020
1021
1022
1026
1027
1028
1029
1030
1036
1037
1041
1042
1043
1047
1048
1049
1053
1054
1058
1059
1063
1064
1065
1066
1072
1073
1074
1075
1080 return true;
1081 }
1083 return false;
1085 }
1086
1087
1088
1092
1093
1094
1095
1096
1097
1098
1099
1100
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1147
1148
1149
1150
1151
1152
1153
1154
1159 return true;
1160 }
1162 }
1163
1164
1165
1166
1167
1172 return true;
1173 }
1175 }
1176
1177
1181
1182
1183
1184
1185
1186
1187
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1228
1229
1230
1231
1232
1233
1234
1235
1236
1240
1241
1242
1243
1244
1248
1249
1250
1251
1252
1258
1259
1260
1261
1262
1263
1264
1269
1270
1271
1272
1273
1274
1275
1279
1280
1281
1282
1283
1284
1285
1289
1296
1297
1298
1299
1300
1301
1304
1305
1306
1307
1308
1309
1311
1312
1313
1314
1315
1316
1318
1319
1320
1321
1322
1323
1325
1326
1327
1328
1329
1330
1332
1333
1334
1335
1336
1338
1342 return getOpcode() == TargetOpcode::ANNOTATION_LABEL;
1343 }
1344
1346 return getOpcode() == TargetOpcode::LIFETIME_START ||
1347 getOpcode() == TargetOpcode::LIFETIME_END;
1348 }
1349
1350
1354
1356 return getOpcode() == TargetOpcode::CFI_INSTRUCTION;
1357 }
1358
1360 return getOpcode() == TargetOpcode::PSEUDO_PROBE;
1361 }
1362
1363
1365
1367 return getOpcode() == TargetOpcode::DBG_VALUE;
1368 }
1370 return getOpcode() == TargetOpcode::DBG_VALUE_LIST;
1371 }
1385
1389
1390
1391
1395
1396
1397
1399
1400
1401
1404 return false;
1405
1407 if (Op.isReg() && .getReg().isValid())
1408 return true;
1409 return false;
1410 }
1411
1413 return getOpcode() == TargetOpcode::JUMP_TABLE_DEBUG_INFO;
1414 }
1415
1417 return getOpcode() == TargetOpcode::PHI ||
1418 getOpcode() == TargetOpcode::G_PHI;
1419 }
1423 return getOpcode() == TargetOpcode::INLINEASM ||
1424 getOpcode() == TargetOpcode::INLINEASM_BR;
1425 }
1426
1427
1428
1430
1433
1435 return getOpcode() == TargetOpcode::INSERT_SUBREG;
1436 }
1437
1439 return getOpcode() == TargetOpcode::SUBREG_TO_REG;
1440 }
1441
1443 return getOpcode() == TargetOpcode::REG_SEQUENCE;
1444 }
1445
1447 return getOpcode() == TargetOpcode::BUNDLE;
1448 }
1449
1451 return getOpcode() == TargetOpcode::COPY;
1452 }
1453
1455 return getOpcode() == TargetOpcode::COPY_LANEMASK;
1456 }
1457
1461
1463 return getOpcode() == TargetOpcode::EXTRACT_SUBREG;
1464 }
1465
1467
1468
1469
1473
1474
1479
1480
1481
1482
1485 default:
1487
1488 case TargetOpcode::PHI:
1489 case TargetOpcode::G_PHI:
1490 case TargetOpcode::COPY:
1491 case TargetOpcode::COPY_LANEMASK:
1492 case TargetOpcode::INSERT_SUBREG:
1493 case TargetOpcode::SUBREG_TO_REG:
1494 case TargetOpcode::REG_SEQUENCE:
1495 return true;
1496 }
1497 }
1498
1499
1500
1501
1502
1503
1505
1506
1507
1508
1509
1510
1514
1515
1516
1517
1521
1522
1523
1524
1525 LLVM_ABI std::pair<bool, bool>
1528
1529
1530
1531
1535
1536
1537
1538
1539
1543
1544
1545
1546
1550
1551
1552
1553
1557
1558
1559
1561
1562
1563
1564
1567 bool isKill = false) const;
1568
1569
1570
1573 bool isKill = false) {
1575 return (Idx == -1) ? nullptr : &getOperand(Idx);
1576 }
1577
1580 bool isKill = false) const {
1583 }
1584
1585
1586
1587
1588
1589
1590
1593 bool isDead = false,
1594 bool Overlap = false) const;
1595
1596
1597
1600 bool isDead = false,
1601 bool Overlap = false) {
1603 return (Idx == -1) ? nullptr : &getOperand(Idx);
1604 }
1605
1608 bool isDead = false,
1609 bool Overlap = false) const {
1612 }
1613
1614
1615
1616
1618
1619
1620
1621
1622
1623
1624
1626 unsigned *GroupNo = nullptr) const;
1627
1628
1629
1630
1631
1632
1633
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1653 bool ExploreBundle = false) const;
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1668
1669
1670
1671
1672
1673
1674
1676
1677
1678
1679
1681
1682
1683
1684
1685
1687 unsigned *UseOpIdx = nullptr) const {
1690 return false;
1691 if (UseOpIdx)
1693 return true;
1694 }
1695
1696
1697
1698
1700 unsigned *DefOpIdx = nullptr) const {
1703 return false;
1704 if (DefOpIdx)
1706 return true;
1707 }
1708
1709
1711
1712
1713
1715 unsigned SubIdx,
1717
1718
1719
1720
1721
1724 bool AddIfNotFound = false);
1725
1726
1727
1730
1731
1732
1733
1734
1736 bool AddIfNotFound = false);
1737
1738
1740
1741
1742
1743
1745
1746
1747
1750
1751
1752
1753
1754
1755
1758
1759
1760
1761
1763
1764
1765
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1794
1795
1796
1797
1798
1800
1801
1802
1803
1804
1805
1806
1807
1809
1810
1811
1813
1814
1815
1816
1817
1818
1819
1820
1822
1823
1825
1826
1828
1829
1831
1832
1833 LLVM_ABI std::optional
1835
1836
1837 LLVM_ABI std::optional
1839
1840
1841 LLVM_ABI std::optional
1843
1844
1845 LLVM_ABI std::optional
1847
1848
1849
1851
1852
1853
1854
1857
1858
1859
1860
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1873 bool SkipOpers = false, bool SkipDebugLoc = false,
1874 bool AddNewLine = true,
1877 bool IsStandalone = true, bool SkipOpers = false,
1878 bool SkipDebugLoc = false, bool AddNewLine = true,
1881
1882
1884 unsigned MaxDepth = UINT_MAX) const;
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1901
1902
1903
1904
1905
1906
1908
1909
1911
1912
1913
1915
1916
1917
1919 DbgLoc = std::move(DL);
1920 assert(DbgLoc.hasTrivialDestructor() && "Expected trivial destructor");
1921 }
1922
1923
1924
1926
1927
1928
1929
1930
1932
1933
1934
1935
1936
1939
1940
1941
1942
1944
1945
1946
1947
1948
1949
1950
1951
1953
1954
1955
1956
1957
1958
1959
1960
1963
1964
1965
1966
1967
1968
1970
1971
1972
1973
1974
1975
1977
1978
1979
1981
1982
1983
1984
1985
1987
1988
1989
1991
1993
1994
1996
1998
1999
2000
2001
2003
2005
2006
2008
2009
2014 MO.TiedTo = 0;
2015 }
2016 }
2017
2018
2020
2021
2022
2024
2025
2026
2028
2029
2030
2031
2032
2033
2034
2035
2037
2038
2039
2043 if (MO.isReg()) {
2044 MO.setReg(0);
2045 MO.setSubReg(0);
2046 }
2047 }
2048 }
2049
2053
2058
2059 std::tuple<Register, Register, Register, Register> getFirst4Regs() const {
2062 }
2063
2064 std::tuple<Register, Register, Register, Register, Register>
2070
2075
2077 LLVM_ABI std::tuple<Register, LLT, Register, LLT, Register, LLT>
2080 std::tuple<Register, LLT, Register, LLT, Register, LLT, Register, LLT>
2085
2086private:
2087
2088
2089
2092
2093
2094
2095
2097
2098
2099
2100
2102
2103
2105
2106
2107
2108
2112
2113
2114
2117 MDNode *HeapAllocMarker, MDNode *PCSections,
2119};
2120
2121
2122
2123
2124
2127 return nullptr;
2128 }
2129
2133
2135
2143};
2144
2145
2146
2147
2149 MI.print(OS);
2150 return OS;
2151}
2152
2153}
2154
2155#endif
unsigned const MachineRegisterInfo * MRI
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
const TargetInstrInfo & TII
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
This file defines DenseMapInfo traits for DenseMap.
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
#define LLVM_MI_ASMPRINTERFLAGS_BITS
Definition MachineInstr.h:139
#define LLVM_MI_FLAGS_BITS
Definition MachineInstr.h:138
#define LLVM_MI_NUMOPERANDS_BITS
Definition MachineInstr.h:137
Register const TargetRegisterInfo * TRI
This file provides utility analysis objects describing memory locations.
static MCRegister getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo)
MachineInstr unsigned OpIdx
bool isDead(const MachineInstr &MI, const MachineRegisterInfo &MRI)
static cl::opt< bool > UseTBAA("use-tbaa-in-sched-mi", cl::Hidden, cl::init(true), cl::desc("Enable use of TBAA during MI DAG construction"))
This header defines support for implementing classes that have some trailing object (or arrays of obj...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
This class is a wrapper over an AAResults, and it is intended to be used only when there are no IR ch...
A set of physical registers with utility functions to track liveness when walking backward/forward th...
A set of register units used to track register liveness.
Describe properties that are true of each instruction in the target description file.
uint64_t getFlags() const
Return flags of this instruction.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Representation of each machine instruction.
Definition MachineInstr.h:72
mop_iterator operands_begin()
Definition MachineInstr.h:698
bool mayRaiseFPException() const
Return true if this instruction could possibly raise a floating-point exception.
Definition MachineInstr.h:1188
ArrayRef< MachineMemOperand * >::iterator mmo_iterator
Definition MachineInstr.h:74
std::tuple< Register, Register, Register, Register, Register > getFirst5Regs() const
Definition MachineInstr.h:2065
mop_range defs()
Returns all explicit operands that are register definitions.
Definition MachineInstr.h:735
unsigned getOpcode() const
Returns the opcode of this MachineInstr.
Definition MachineInstr.h:598
unsigned getNumImplicitOperands() const
Returns the implicit operands number.
Definition MachineInstr.h:661
bool isReturn(QueryType Type=AnyInBundle) const
Definition MachineInstr.h:957
LLVM_ABI void setRegisterDefReadUndef(Register Reg, bool IsUndef=true)
Mark all subregister defs of register Reg with the undef flag.
bool hasDebugOperandForReg(Register Reg) const
Returns whether this debug value has at least one debug operand with the register Reg.
Definition MachineInstr.h:622
bool isDebugValueList() const
Definition MachineInstr.h:1369
LLVM_ABI void bundleWithPred()
Bundle this instruction with its predecessor.
CommentFlag
Flags to specify different kinds of comments to output in assembly code.
Definition MachineInstr.h:80
@ TAsmComments
Definition MachineInstr.h:83
@ NoSchedComment
Definition MachineInstr.h:82
@ ReloadReuse
Definition MachineInstr.h:81
bool isPosition() const
Definition MachineInstr.h:1364
void setDebugValueUndef()
Sets all register debug operands in this debug value instruction to be undef.
Definition MachineInstr.h:2040
bool isTerminator(QueryType Type=AnyInBundle) const
Returns true if this instruction part of the terminator for a basic block.
Definition MachineInstr.h:993
iterator_range< filter_iterator< const_mop_iterator, bool(*)(const MachineOperand &)> > filtered_const_mop_range
Definition MachineInstr.h:760
bool hasExtraDefRegAllocReq(QueryType Type=AnyInBundle) const
Returns true if this instruction def operands have special register allocation requirements that are ...
Definition MachineInstr.h:1286
std::tuple< Register, Register, Register, Register > getFirst4Regs() const
Definition MachineInstr.h:2059
bool isImplicitDef() const
Definition MachineInstr.h:1421
LLVM_ABI std::tuple< Register, LLT, Register, LLT, Register, LLT, Register, LLT, Register, LLT > getFirst5RegLLTs() const
iterator_range< const_mop_iterator > const_mop_range
Definition MachineInstr.h:696
LLVM_ABI iterator_range< filter_iterator< const MachineOperand *, std::function< bool(const MachineOperand &Op)> > > getDebugOperandsForReg(Register Reg) const
Returns a range of all of the operands that correspond to a debug use of Reg.
mop_range debug_operands()
Returns all operands that are used to determine the variable location for this DBG_VALUE instruction.
Definition MachineInstr.h:722
bool mayLoadOrStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read or modify memory.
Definition MachineInstr.h:1178
LLVM_ABI void setCFIType(MachineFunction &MF, uint32_t Type)
Set the CFI type for the instruction.
bool isCopy() const
Definition MachineInstr.h:1450
const_mop_range debug_operands() const
Returns all operands that are used to determine the variable location for this DBG_VALUE instruction.
Definition MachineInstr.h:728
LLVM_ABI MachineInstr * removeFromParent()
Unlink 'this' from the containing basic block, and return it without deleting it.
filtered_const_mop_range all_uses() const
Returns an iterator range over all operands that are (explicit or implicit) register uses.
Definition MachineInstr.h:779
void clearAsmPrinterFlags()
Clear the AsmPrinter bitvector.
Definition MachineInstr.h:391
const MachineBasicBlock * getParent() const
Definition MachineInstr.h:370
bool isCopyLike() const
Return true if the instruction behaves like a copy.
Definition MachineInstr.h:1470
void dropDebugNumber()
Drop any variable location debugging information associated with this instruction.
Definition MachineInstr.h:579
MDNode * getMMRAMetadata() const
Helper to extract mmra.op metadata.
Definition MachineInstr.h:874
LLVM_ABI void bundleWithSucc()
Bundle this instruction with its successor.
uint32_t getCFIType() const
Helper to extract a CFI type hash if one has been added.
Definition MachineInstr.h:891
bool readsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr reads the specified register.
Definition MachineInstr.h:1511
bool isDebugLabel() const
Definition MachineInstr.h:1375
LLVM_ABI void setPreInstrSymbol(MachineFunction &MF, MCSymbol *Symbol)
Set a symbol that will be emitted just prior to the instruction itself.
bool isDebugOffsetImm() const
Definition MachineInstr.h:1386
bool hasProperty(unsigned MCFlag, QueryType Type=AnyInBundle) const
Return true if the instruction (or in the case of a bundle, the instructions inside the bundle) has t...
Definition MachineInstr.h:914
LLVM_ABI bool isDereferenceableInvariantLoad() const
Return true if this load instruction never traps and points to a memory location whose value doesn't ...
void setFlags(unsigned flags)
Definition MachineInstr.h:433
MachineFunction * getMF()
Definition MachineInstr.h:382
QueryType
API for querying MachineInstr properties.
Definition MachineInstr.h:903
@ AnyInBundle
Definition MachineInstr.h:905
@ AllInBundle
Definition MachineInstr.h:906
@ IgnoreBundle
Definition MachineInstr.h:904
bool isPredicable(QueryType Type=AllInBundle) const
Return true if this instruction has a predicate operand that controls execution.
Definition MachineInstr.h:1031
LLVM_ABI void addImplicitDefUseOperands(MachineFunction &MF)
Add all implicit def and use operands to this instruction.
bool isBarrier(QueryType Type=AnyInBundle) const
Returns true if the specified instruction stops control flow from executing the instruction immediate...
Definition MachineInstr.h:984
filtered_mop_range all_defs()
Returns an iterator range over all operands that are (explicit or implicit) register defs.
Definition MachineInstr.h:765
LLVM_ABI std::tuple< LLT, LLT, LLT, LLT, LLT > getFirst5LLTs() const
MachineBasicBlock * getParent()
Definition MachineInstr.h:371
bool isSelect(QueryType Type=IgnoreBundle) const
Return true if this instruction is a select instruction.
Definition MachineInstr.h:1060
bool isCall(QueryType Type=AnyInBundle) const
Definition MachineInstr.h:967
LLVM_ABI std::tuple< Register, LLT, Register, LLT, Register, LLT > getFirst3RegLLTs() const
bool usesCustomInsertionHook(QueryType Type=IgnoreBundle) const
Return true if this instruction requires custom insertion support when the DAG scheduler is inserting...
Definition MachineInstr.h:1237
bool getFlag(MIFlag Flag) const
Return whether an MI flag is set.
Definition MachineInstr.h:420
void clearAsmPrinterFlag(CommentFlag Flag)
Clear specific AsmPrinter flags.
Definition MachineInstr.h:408
LLVM_ABI uint32_t mergeFlagsWith(const MachineInstr &Other) const
Return the MIFlags which represent both MachineInstrs.
LLVM_ABI const MachineOperand & getDebugExpressionOp() const
Return the operand for the complex address expression referenced by this DBG_VALUE instruction.
LLVM_ABI std::pair< bool, bool > readsWritesVirtualRegister(Register Reg, SmallVectorImpl< unsigned > *Ops=nullptr) const
Return a pair of bools (reads, writes) indicating if this instruction reads or writes Reg.
const_mop_range implicit_operands() const
Definition MachineInstr.h:716
LLVM_ABI Register isConstantValuePHI() const
If the specified instruction is a PHI that always merges together the same virtual register,...
bool isRegTiedToDefOperand(unsigned UseOpIdx, unsigned *DefOpIdx=nullptr) const
Return true if the use operand of the specified index is tied to a def operand.
Definition MachineInstr.h:1699
LLVM_ABI bool allImplicitDefsAreDead() const
Return true if all the implicit defs of this instruction are dead.
LLVM_ABI void cloneMemRefs(MachineFunction &MF, const MachineInstr &MI)
Clone another MachineInstr's memory reference descriptor list and replace ours with it.
LLVM_ABI const TargetRegisterClass * getRegClassConstraintEffectForVReg(Register Reg, const TargetRegisterClass *CurRC, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI, bool ExploreBundle=false) const
Applies the constraints (def/use) implied by this MI on Reg to the given CurRC.
LLVM_ABI bool isSafeToMove(bool &SawStore) const
Return true if it is safe to move this instruction.
LLVM_ABI bool mayAlias(BatchAAResults *AA, const MachineInstr &Other, bool UseTBAA) const
Returns true if this instruction's memory access aliases the memory access of Other.
bool isBundle() const
Definition MachineInstr.h:1446
bool isDebugInstr() const
Definition MachineInstr.h:1379
unsigned getNumDebugOperands() const
Returns the total number of operands which are debug locations.
Definition MachineInstr.h:604
unsigned getNumOperands() const
Retuns the total number of operands.
Definition MachineInstr.h:601
void setDebugInstrNum(unsigned Num)
Set instruction number of this MachineInstr.
Definition MachineInstr.h:573
LLVM_ABI void addOperand(MachineFunction &MF, const MachineOperand &Op)
Add the specified operand to the instruction.
LLVM_ABI MachineInstr * removeFromBundle()
Unlink this instruction from its basic block and return it without deleting it.
const MachineOperand * const_mop_iterator
Definition MachineInstr.h:693
LLVM_ABI void dumpr(const MachineRegisterInfo &MRI, unsigned MaxDepth=UINT_MAX) const
Print on dbgs() the current instruction and the instructions defining its operands and so on until we...
bool getAsmPrinterFlag(CommentFlag Flag) const
Return whether an AsmPrinter flag is set.
Definition MachineInstr.h:394
LLVM_ABI void copyIRFlags(const Instruction &I)
Copy all flags to MachineInst MIFlags.
bool isDebugValueLike() const
Definition MachineInstr.h:1377
bool isInlineAsm() const
Definition MachineInstr.h:1422
bool memoperands_empty() const
Return true if we don't have any memory operands which described the memory access done by this instr...
Definition MachineInstr.h:821
const_mop_range uses() const
Returns all operands which may be register uses.
Definition MachineInstr.h:744
mmo_iterator memoperands_end() const
Access to memory operands of the instruction.
Definition MachineInstr.h:816
bool isDebugRef() const
Definition MachineInstr.h:1376
bool isAnnotationLabel() const
Definition MachineInstr.h:1341
LLVM_ABI void collectDebugValues(SmallVectorImpl< MachineInstr * > &DbgValues)
Scan instructions immediately following MI and collect any matching DBG_VALUEs.
MachineOperand & getDebugOffset()
Definition MachineInstr.h:531
unsigned peekDebugInstrNum() const
Examine the instruction number of this MachineInstr.
Definition MachineInstr.h:569
LLVM_ABI std::optional< LocationSize > getRestoreSize(const TargetInstrInfo *TII) const
Return a valid size if the instruction is a restore instruction.
unsigned getOperandNo(const_mop_iterator I) const
Returns the number of the operand iterator I points to.
Definition MachineInstr.h:784
LLVM_ABI unsigned getNumExplicitOperands() const
Returns the number of non-implicit operands.
mop_range implicit_operands()
Definition MachineInstr.h:713
bool isSubregToReg() const
Definition MachineInstr.h:1438
bool isCompare(QueryType Type=IgnoreBundle) const
Return true if this instruction is a comparison.
Definition MachineInstr.h:1038
bool hasImplicitDef() const
Returns true if the instruction has implicit definition.
Definition MachineInstr.h:653
bool isBranch(QueryType Type=AnyInBundle) const
Returns true if this is a conditional, unconditional, or indirect branch.
Definition MachineInstr.h:1001
LLVM_ABI void setMemRefs(MachineFunction &MF, ArrayRef< MachineMemOperand * > MemRefs)
Assign this MachineInstr's memory reference descriptor list.
LLVM_ABI bool wouldBeTriviallyDead() const
Return true if this instruction would be trivially dead if all of its defined registers were dead.
bool isBundledWithPred() const
Return true if this instruction is part of a bundle, and it is not the first instruction in the bundl...
Definition MachineInstr.h:501
bool isDebugPHI() const
Definition MachineInstr.h:1378
MachineOperand & getOperand(unsigned i)
Definition MachineInstr.h:609
LLVM_ABI std::tuple< LLT, LLT > getFirst2LLTs() const
LLVM_ABI std::optional< LocationSize > getFoldedSpillSize(const TargetInstrInfo *TII) const
Return a valid size if the instruction is a folded spill instruction.
const_mop_iterator operands_end() const
Definition MachineInstr.h:702
bool modifiesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr modifies (fully define or partially define) the specified register.
Definition MachineInstr.h:1547
bool isCopyLaneMask() const
Definition MachineInstr.h:1454
LLVM_ABI void unbundleFromPred()
Break bundle above this instruction.
LLVM_ABI void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI)
Copy implicit register operands from specified instruction to this instruction.
bool hasPostISelHook(QueryType Type=IgnoreBundle) const
Return true if this instruction requires adjustment after instruction selection by calling a target h...
Definition MachineInstr.h:1245
bool mayLoad(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly read memory.
Definition MachineInstr.h:1155
void setAsmPrinterFlag(uint8_t Flag)
Set a flag for the AsmPrinter.
Definition MachineInstr.h:401
bool isDebugOrPseudoInstr() const
Definition MachineInstr.h:1382
LLVM_ABI bool isStackAligningInlineAsm() const
bool isRegTiedToUseOperand(unsigned DefOpIdx, unsigned *UseOpIdx=nullptr) const
Given the index of a register def operand, check if the register def is tied to a source operand,...
Definition MachineInstr.h:1686
LLVM_ABI void dropMemRefs(MachineFunction &MF)
Clear this MachineInstr's memory reference descriptor list.
mop_iterator operands_end()
Definition MachineInstr.h:699
bool isFullCopy() const
Definition MachineInstr.h:1458
LLVM_ABI int findRegisterUseOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isKill=false) const
Returns the operand index that is a use of the specific register or -1 if it is not found.
MDNode * getPCSections() const
Helper to extract PCSections metadata target sections.
Definition MachineInstr.h:864
bool isCFIInstruction() const
Definition MachineInstr.h:1355
LLVM_ABI int findFirstPredOperandIdx() const
Find the index of the first operand in the operand list that is used to represent the predicate.
const MCInstrDesc & getDesc() const
Returns the target instruction descriptor of this MachineInstr.
Definition MachineInstr.h:595
LLVM_ABI unsigned getBundleSize() const
Return the number of instructions inside the MI bundle, excluding the bundle header.
void clearFlags(unsigned flags)
Definition MachineInstr.h:448
bool hasExtraSrcRegAllocReq(QueryType Type=AnyInBundle) const
Returns true if this instruction source operands have special register allocation requirements that a...
Definition MachineInstr.h:1276
bool isCommutable(QueryType Type=IgnoreBundle) const
Return true if this may be a 2- or 3-address instruction (of the form "X = op Y, Z,...
Definition MachineInstr.h:1207
MachineInstr & operator=(const MachineInstr &)=delete
LLVM_ABI void cloneMergedMemRefs(MachineFunction &MF, ArrayRef< const MachineInstr * > MIs)
Clone the merge of multiple MachineInstrs' memory reference descriptors list and replace ours with it...
mop_range operands()
Definition MachineInstr.h:704
bool isConditionalBranch(QueryType Type=AnyInBundle) const
Return true if this is a branch which may fall through to the next instruction or may transfer contro...
Definition MachineInstr.h:1015
bool isNotDuplicable(QueryType Type=AnyInBundle) const
Return true if this instruction cannot be safely duplicated.
Definition MachineInstr.h:1067
LLVM_ABI bool isCandidateForAdditionalCallInfo(QueryType Type=IgnoreBundle) const
Return true if this is a call instruction that may have an additional information associated with it.
LLVM_ABI std::tuple< Register, LLT, Register, LLT, Register, LLT, Register, LLT > getFirst4RegLLTs() const
bool killsRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr kills the specified register.
Definition MachineInstr.h:1532
LLVM_ABI std::tuple< Register, LLT, Register, LLT > getFirst2RegLLTs() const
unsigned getNumMemOperands() const
Return the number of memory operands.
Definition MachineInstr.h:827
mop_range explicit_uses()
Definition MachineInstr.h:747
void clearFlag(MIFlag Flag)
clearFlag - Clear a MI flag.
Definition MachineInstr.h:442
bool isGCLabel() const
Definition MachineInstr.h:1340
LLVM_ABI std::optional< LocationSize > getFoldedRestoreSize(const TargetInstrInfo *TII) const
Return a valid size if the instruction is a folded restore instruction.
uint8_t getAsmPrinterFlags() const
Return the asm printer flags bitvector.
Definition MachineInstr.h:388
LLVM_ABI const TargetRegisterClass * getRegClassConstraintEffect(unsigned OpIdx, const TargetRegisterClass *CurRC, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const
Applies the constraints (def/use) implied by the OpIdx operand to the given CurRC.
bool isOperandSubregIdx(unsigned OpIdx) const
Return true if operand OpIdx is a subregister index.
Definition MachineInstr.h:666
LLVM_ABI InlineAsm::AsmDialect getInlineAsmDialect() const
LLVM_ABI bool hasUnmodeledSideEffects() const
Return true if this instruction has side effects that are not modeled by mayLoad / mayStore,...
LLVM_ABI bool isEquivalentDbgInstr(const MachineInstr &Other) const
Returns true if this instruction is a debug instruction that represents an identical debug value to O...
bool isRegSequence() const
Definition MachineInstr.h:1442
bool isExtractSubregLike(QueryType Type=IgnoreBundle) const
Return true if this instruction behaves the same way as the generic EXTRACT_SUBREG instructions.
Definition MachineInstr.h:1130
LLVM_ABI const DILabel * getDebugLabel() const
Return the debug label referenced by this DBG_LABEL instruction.
void untieRegOperand(unsigned OpIdx)
Break any tie involving OpIdx.
Definition MachineInstr.h:2010
bool registerDefIsDead(Register Reg, const TargetRegisterInfo *TRI) const
Returns true if the register is dead in this machine instruction.
Definition MachineInstr.h:1554
const_mop_iterator operands_begin() const
Definition MachineInstr.h:701
static LLVM_ABI uint32_t copyFlagsFromInstruction(const Instruction &I)
bool definesRegister(Register Reg, const TargetRegisterInfo *TRI) const
Return true if the MachineInstr fully defines the specified register.
Definition MachineInstr.h:1540
LLVM_ABI unsigned removePHIIncomingValueFor(const MachineBasicBlock &MBB)
Remove all incoming values of Phi instruction for the given block.
LLVM_ABI void insert(mop_iterator InsertBefore, ArrayRef< MachineOperand > Ops)
Inserts Ops BEFORE It. Can untie/retie tied operands.
LLVM_ABI void setDesc(const MCInstrDesc &TID)
Replace the instruction descriptor (thus opcode) of the current instruction with a new one.
bool isUnconditionalBranch(QueryType Type=AnyInBundle) const
Return true if this is a branch which always transfers control flow to some other block.
Definition MachineInstr.h:1023
const MachineOperand * findRegisterUseOperand(Register Reg, const TargetRegisterInfo *TRI, bool isKill=false) const
Definition MachineInstr.h:1578
bool isJumpTableDebugInfo() const
Definition MachineInstr.h:1412
std::tuple< Register, Register, Register > getFirst3Regs() const
Definition MachineInstr.h:2054
LLVM_ABI unsigned getNumExplicitDefs() const
Returns the number of non-implicit definitions.
LLVM_ABI void eraseFromBundle()
Unlink 'this' from its basic block and delete it.
bool hasDelaySlot(QueryType Type=AnyInBundle) const
Returns true if the specified instruction has a delay slot which must be filled by the code generator...
Definition MachineInstr.h:1089
bool hasOneMemOperand() const
Return true if this instruction has exactly one MachineMemOperand.
Definition MachineInstr.h:824
LLVM_ABI void setHeapAllocMarker(MachineFunction &MF, MDNode *MD)
Set a marker on instructions that denotes where we should create and emit heap alloc site labels.
bool isMoveReg(QueryType Type=IgnoreBundle) const
Return true if this instruction is a register move.
Definition MachineInstr.h:1050
const_mop_range explicit_uses() const
Definition MachineInstr.h:752
LLVM_ABI const DILocalVariable * getDebugVariable() const
Return the debug variable referenced by this DBG_VALUE instruction.
LLVM_ABI bool hasComplexRegisterTies() const
Return true when an instruction has tied register that can't be determined by the instruction's descr...
LLVM_ABI LLT getTypeToPrint(unsigned OpIdx, SmallBitVector &PrintedTypes, const MachineRegisterInfo &MRI) const
Debugging supportDetermine the generic type to be printed (if needed) on uses and defs.
bool isInsertSubreg() const
Definition MachineInstr.h:1434
bool isLifetimeMarker() const
Definition MachineInstr.h:1345
LLVM_ABI void substituteRegister(Register FromReg, Register ToReg, unsigned SubIdx, const TargetRegisterInfo &RegInfo)
Replace all occurrences of FromReg with ToReg:SubIdx, properly composing subreg indices where necessa...
mop_range explicit_operands()
Definition MachineInstr.h:707
LLVM_ABI unsigned findTiedOperandIdx(unsigned OpIdx) const
Given the index of a tied register operand, find the operand it is tied to.
LLVM_ABI void tieOperands(unsigned DefIdx, unsigned UseIdx)
Add a tie between the register operands at DefIdx and UseIdx.
bool isConvertibleTo3Addr(QueryType Type=IgnoreBundle) const
Return true if this is a 2-address instruction which can be changed into a 3-address instruction if n...
Definition MachineInstr.h:1225
mmo_iterator memoperands_begin() const
Access to memory operands of the instruction.
Definition MachineInstr.h:809
LLVM_ABI void cloneInstrSymbols(MachineFunction &MF, const MachineInstr &MI)
Clone another MachineInstr's pre- and post- instruction symbols and replace ours with it.
bool isInsideBundle() const
Return true if MI is in a bundle (but not the first MI in a bundle).
Definition MachineInstr.h:489
LLVM_ABI void changeDebugValuesDefReg(Register Reg)
Find all DBG_VALUEs that point to the register def in this instruction and point them to Reg instead.
LLVM_ABI bool isIdenticalTo(const MachineInstr &Other, MICheckType Check=CheckDefs) const
Return true if this instruction is identical to Other.
LLVM_ABI bool hasOrderedMemoryRef() const
Return true if this instruction may have an ordered or volatile memory reference, or if the informati...
mop_range uses()
Returns all operands which may be register uses.
Definition MachineInstr.h:742
LLVM_ABI void emitGenericError(const Twine &ErrMsg) const
const_mop_range explicit_operands() const
Definition MachineInstr.h:710
bool isConvergent(QueryType Type=AnyInBundle) const
Return true if this instruction is convergent.
Definition MachineInstr.h:1076
MIFlag
Definition MachineInstr.h:86
@ NoConvergent
Definition MachineInstr.h:120
@ NoUWrap
Definition MachineInstr.h:108
@ IsExact
Definition MachineInstr.h:112
@ InBounds
Definition MachineInstr.h:126
@ NoFPExcept
Definition MachineInstr.h:114
@ NoUSWrap
Definition MachineInstr.h:123
@ NonNeg
Definition MachineInstr.h:121
@ FmArcp
Definition MachineInstr.h:100
@ FmNoInfs
Definition MachineInstr.h:96
@ FmAfn
Definition MachineInstr.h:104
@ NoMerge
Definition MachineInstr.h:116
@ FrameDestroy
Definition MachineInstr.h:90
@ NoFlags
Definition MachineInstr.h:87
@ FrameSetup
Definition MachineInstr.h:88
@ FmReassoc
Definition MachineInstr.h:106
@ Unpredictable
Definition MachineInstr.h:119
@ FmContract
Definition MachineInstr.h:102
@ BundledPred
Definition MachineInstr.h:92
@ Disjoint
Definition MachineInstr.h:122
@ FmNoNans
Definition MachineInstr.h:94
@ BundledSucc
Definition MachineInstr.h:93
@ FmNsz
Definition MachineInstr.h:98
@ SameSign
Definition MachineInstr.h:125
@ NoSWrap
Definition MachineInstr.h:110
LLVM_ABI const MachineFunction * getMF() const
Return the function that contains the basic block that this instruction belongs to.
const_mop_range defs() const
Returns all explicit operands that are register definitions.
Definition MachineInstr.h:737
LLVM_ABI const DIExpression * getDebugExpression() const
Return the complex address expression referenced by this DBG_VALUE instruction.
ArrayRef< MachineMemOperand * > memoperands() const
Access to memory operands of the instruction.
Definition MachineInstr.h:791
bool isLabel() const
Returns true if the MachineInstr represents a label.
Definition MachineInstr.h:1351
LLVM_ABI void print(raw_ostream &OS, bool IsStandalone=true, bool SkipOpers=false, bool SkipDebugLoc=false, bool AddNewLine=true, const TargetInstrInfo *TII=nullptr) const
Print this MI to OS.
bool isExtractSubreg() const
Definition MachineInstr.h:1462
bool isNonListDebugValue() const
Definition MachineInstr.h:1366
MachineOperand * mop_iterator
iterator/begin/end - Iterate over all operands of a machine instruction.
Definition MachineInstr.h:692
MachineOperand * findRegisterUseOperand(Register Reg, const TargetRegisterInfo *TRI, bool isKill=false)
Wrapper for findRegisterUseOperandIdx, it returns a pointer to the MachineOperand rather than an inde...
Definition MachineInstr.h:1571
MICheckType
Definition MachineInstr.h:1290
@ IgnoreDefs
Definition MachineInstr.h:1293
@ CheckDefs
Definition MachineInstr.h:1291
@ IgnoreVRegDefs
Definition MachineInstr.h:1294
@ CheckKillDead
Definition MachineInstr.h:1292
LLVM_ABI bool isLoadFoldBarrier() const
Returns true if it is illegal to fold a load across this instruction.
bool mayStore(QueryType Type=AnyInBundle) const
Return true if this instruction could possibly modify memory.
Definition MachineInstr.h:1168
void setFlag(MIFlag Flag)
Set a MI flag.
Definition MachineInstr.h:427
const DebugLoc & getDebugLoc() const
Returns the debug location id of this MachineInstr.
Definition MachineInstr.h:522
LLVM_ABI bool isDead(const MachineRegisterInfo &MRI, LiveRegUnits *LivePhysRegs=nullptr) const
Check whether an MI is dead.
LLVM_ABI std::tuple< LLT, LLT, LLT > getFirst3LLTs() const
bool isMoveImmediate(QueryType Type=IgnoreBundle) const
Return true if this instruction is a move immediate (including conditional moves) instruction.
Definition MachineInstr.h:1044
bool isPreISelOpcode(QueryType Type=IgnoreBundle) const
Return true if this is an instruction that should go through the usual legalization steps.
Definition MachineInstr.h:927
bool isEHScopeReturn(QueryType Type=AnyInBundle) const
Return true if this is an instruction that marks the end of an EH scope, i.e., a catchpad or a cleanu...
Definition MachineInstr.h:963
bool isPseudo(QueryType Type=IgnoreBundle) const
Return true if this is a pseudo instruction that doesn't correspond to a real machine instruction.
Definition MachineInstr.h:947
LLVM_ABI const MachineOperand & getDebugVariableOp() const
Return the operand for the debug variable referenced by this DBG_VALUE instruction.
LLVM_ABI void eraseFromParent()
Unlink 'this' from the containing basic block and delete it.
LLVM_ABI void setPhysRegsDeadExcept(ArrayRef< Register > UsedRegs, const TargetRegisterInfo &TRI)
Mark every physreg used by this instruction as dead except those in the UsedRegs list.
LLVM_ABI void removeOperand(unsigned OpNo)
Erase an operand from an instruction, leaving it with one fewer operand than it started with.
friend class MachineFunction
Definition MachineInstr.h:343
filtered_mop_range all_uses()
Returns an iterator range over all operands that are (explicit or implicit) register uses.
Definition MachineInstr.h:775
MCSymbol * getPreInstrSymbol() const
Helper to extract a pre-instruction symbol if one has been added.
Definition MachineInstr.h:830
LLVM_ABI bool addRegisterKilled(Register IncomingReg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI kills a register.
bool readsVirtualRegister(Register Reg) const
Return true if the MachineInstr reads the specified virtual register.
Definition MachineInstr.h:1518
LLVM_ABI void setPostInstrSymbol(MachineFunction &MF, MCSymbol *Symbol)
Set a symbol that will be emitted just after the instruction itself.
bool isBitcast(QueryType Type=IgnoreBundle) const
Return true if this instruction is a bitcast instruction.
Definition MachineInstr.h:1055
bool hasOptionalDef(QueryType Type=IgnoreBundle) const
Set if this instruction has an optional definition, e.g.
Definition MachineInstr.h:941
bool isTransient() const
Return true if this is a transient instruction that is either very likely to be eliminated during reg...
Definition MachineInstr.h:1483
bool isDebugValue() const
Definition MachineInstr.h:1372
LLVM_ABI void dump() const
unsigned getDebugOperandIndex(const MachineOperand *Op) const
Definition MachineInstr.h:642
const MachineOperand & getDebugOffset() const
Return the operand containing the offset to be used if this DBG_VALUE instruction is indirect; will b...
Definition MachineInstr.h:527
MachineOperand & getDebugOperand(unsigned Index)
Definition MachineInstr.h:611
LLVM_ABI std::optional< LocationSize > getSpillSize(const TargetInstrInfo *TII) const
Return a valid size if the instruction is a spill instruction.
bool isBundledWithSucc() const
Return true if this instruction is part of a bundle, and it is not the last instruction in the bundle...
Definition MachineInstr.h:505
LLVM_ABI void addRegisterDefined(Register Reg, const TargetRegisterInfo *RegInfo=nullptr)
We have determined MI defines a register.
MDNode * getHeapAllocMarker() const
Helper to extract a heap alloc marker if one has been added.
Definition MachineInstr.h:854
bool isInsertSubregLike(QueryType Type=IgnoreBundle) const
Return true if this instruction behaves the same way as the generic INSERT_SUBREG instructions.
Definition MachineInstr.h:1144
LLVM_ABI unsigned getDebugInstrNum()
Fetch the instruction number of this MachineInstr.
bool isDebugOperand(const MachineOperand *Op) const
Definition MachineInstr.h:638
LLVM_ABI std::tuple< LLT, LLT, LLT, LLT > getFirst4LLTs() const
bool isPHI() const
Definition MachineInstr.h:1416
LLVM_ABI void clearRegisterDeads(Register Reg)
Clear all dead flags on operands defining register Reg.
LLVM_ABI void clearRegisterKills(Register Reg, const TargetRegisterInfo *RegInfo)
Clear all kill flags affecting Reg.
const MachineOperand & getOperand(unsigned i) const
Definition MachineInstr.h:606
LLVM_ABI void emitInlineAsmError(const Twine &ErrMsg) const
Emit an error referring to the source location of this instruction.
uint32_t getFlags() const
Return the MI flags bitvector.
Definition MachineInstr.h:415
bool isEHLabel() const
Definition MachineInstr.h:1339
bool isPseudoProbe() const
Definition MachineInstr.h:1359
LLVM_ABI bool hasRegisterImplicitUseOperand(Register Reg) const
Returns true if the MachineInstr has an implicit-use operand of exactly the given register (not consi...
LLVM_ABI bool shouldUpdateAdditionalCallInfo() const
Return true if copying, moving, or erasing this instruction requires updating additional call info (s...
LLVM_ABI void setDeactivationSymbol(MachineFunction &MF, Value *DS)
bool isUndefDebugValue() const
Return true if the instruction is a debug value which describes a part of a variable as unavailable.
Definition MachineInstr.h:1402
Value * getDeactivationSymbol() const
Definition MachineInstr.h:882
bool isIdentityCopy() const
Return true is the instruction is an identity copy.
Definition MachineInstr.h:1475
MCSymbol * getPostInstrSymbol() const
Helper to extract a post-instruction symbol if one has been added.
Definition MachineInstr.h:842
LLVM_ABI void unbundleFromSucc()
Break bundle below this instruction.
const MachineOperand & getDebugOperand(unsigned Index) const
Definition MachineInstr.h:615
iterator_range< filter_iterator< mop_iterator, bool(*)(const MachineOperand &)> > filtered_mop_range
Definition MachineInstr.h:758
LLVM_ABI void clearKillInfo()
Clears kill flags on all operands.
LLVM_ABI bool isDebugEntryValue() const
A DBG_VALUE is an entry value iff its debug expression contains the DW_OP_LLVM_entry_value operation.
bool isIndirectDebugValue() const
A DBG_VALUE is indirect iff the location operand is a register and the offset operand is an immediate...
Definition MachineInstr.h:1392
unsigned getNumDefs() const
Returns the total number of definitions.
Definition MachineInstr.h:648
LLVM_ABI void setPCSections(MachineFunction &MF, MDNode *MD)
MachineInstr(const MachineInstr &)=delete
bool isKill() const
Definition MachineInstr.h:1420
LLVM_ABI const MDNode * getLocCookieMD() const
For inline asm, get the !srcloc metadata node if we have it, and decode the loc cookie from it.
const MachineOperand * findRegisterDefOperand(Register Reg, const TargetRegisterInfo *TRI, bool isDead=false, bool Overlap=false) const
Definition MachineInstr.h:1606
LLVM_ABI int findRegisterDefOperandIdx(Register Reg, const TargetRegisterInfo *TRI, bool isDead=false, bool Overlap=false) const
Returns the operand index that is a def of the specified register or -1 if it is not found.
iterator_range< mop_iterator > mop_range
Definition MachineInstr.h:695
bool isMetaInstruction(QueryType Type=IgnoreBundle) const
Return true if this instruction doesn't produce any output in the form of executable instructions.
Definition MachineInstr.h:953
bool canFoldAsLoad(QueryType Type=IgnoreBundle) const
Return true for instructions that can be folded as memory operands in other instructions.
Definition MachineInstr.h:1101
void setDebugLoc(DebugLoc DL)
Replace current source information with new such.
Definition MachineInstr.h:1918
bool isIndirectBranch(QueryType Type=AnyInBundle) const
Return true if this is an indirect branch, such as a branch through a register.
Definition MachineInstr.h:1007
bool isFakeUse() const
Definition MachineInstr.h:1466
filtered_const_mop_range all_defs() const
Returns an iterator range over all operands that are (explicit or implicit) register defs.
Definition MachineInstr.h:769
bool isVariadic(QueryType Type=IgnoreBundle) const
Return true if this instruction can have a variable number of operands.
Definition MachineInstr.h:935
LLVM_ABI int findInlineAsmFlagIdx(unsigned OpIdx, unsigned *GroupNo=nullptr) const
Find the index of the flag word operand that corresponds to operand OpIdx on an inline asm instructio...
LLVM_ABI bool allDefsAreDead() const
Return true if all the defs of this instruction are dead.
LLVM_ABI void setMMRAMetadata(MachineFunction &MF, MDNode *MMRAs)
bool isRegSequenceLike(QueryType Type=IgnoreBundle) const
Return true if this instruction behaves the same way as the generic REG_SEQUENCE instructions.
Definition MachineInstr.h:1115
LLVM_ABI const TargetRegisterClass * getRegClassConstraint(unsigned OpIdx, const TargetInstrInfo *TII, const TargetRegisterInfo *TRI) const
Compute the static register class constraint for operand OpIdx.
bool isAsCheapAsAMove(QueryType Type=AllInBundle) const
Returns true if this instruction has the same cost (or less) than a move instruction.
Definition MachineInstr.h:1265
const_mop_range operands() const
Definition MachineInstr.h:705
LLVM_ABI void moveBefore(MachineInstr *MovePos)
Move the instruction before MovePos.
MachineOperand * findRegisterDefOperand(Register Reg, const TargetRegisterInfo *TRI, bool isDead=false, bool Overlap=false)
Wrapper for findRegisterDefOperandIdx, it returns a pointer to the MachineOperand rather than an inde...
Definition MachineInstr.h:1598
LLVM_ABI void addMemOperand(MachineFunction &MF, MachineMemOperand *MO)
Add a MachineMemOperand to the machine instruction.
bool isBundled() const
Return true if this instruction part of a bundle.
Definition MachineInstr.h:495
bool isRematerializable(QueryType Type=AllInBundle) const
Returns true if this instruction is a candidate for remat.
Definition MachineInstr.h:1253
LLVM_ABI bool addRegisterDead(Register Reg, const TargetRegisterInfo *RegInfo, bool AddIfNotFound=false)
We have determined MI defined a register without a use.
LLVM_ABI bool mayFoldInlineAsmRegOp(unsigned OpId) const
Returns true if the register operand can be folded with a load or store into a frame index.
std::tuple< Register, Register > getFirst2Regs() const
Definition MachineInstr.h:2050
A description of a memory reference used in the backend.
MachineOperand class - Representation of each machine instruction operand.
unsigned getSubReg() const
bool isReg() const
isReg - Tests if this is a MO_Register operand.
bool isImm() const
isImm - Tests if this is a MO_Immediate operand.
Register getReg() const
getReg - Returns the register number.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Manage lifetime of a slot tracker for printing IR.
Wrapper class representing virtual and physical registers.
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
TargetInstrInfo - Interface to description of machine instruction set.
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
static constexpr std::enable_if_t< std::is_same_v< Foo< TrailingTys... >, Foo< Tys... > >, size_t > totalSizeToAlloc(typename trailing_objects_internal::ExtractSecondType< TrailingTys, size_t >::type... Counts)
const T * getTrailingObjects() const
TrailingObjects()=default
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM Value Representation.
ilist_node_with_parent()=default
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
This file defines classes to implement an intrusive doubly linked list class (i.e.
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
Abstract Attribute helper functions.
This is an optimization pass for GlobalISel generic memory operations.
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
constexpr auto adl_begin(RangeT &&range) -> decltype(adl_detail::begin_impl(std::forward< RangeT >(range)))
Returns the begin iterator to range using std::begin and function found through Argument-Dependent Lo...
constexpr auto adl_end(RangeT &&range) -> decltype(adl_detail::end_impl(std::forward< RangeT >(range)))
Returns the end iterator to range using std::end and functions found through Argument-Dependent Looku...
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
constexpr bool isUInt(uint64_t x)
Checks if an unsigned integer fits into the given bit width.
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
MutableArrayRef(T &OneElt) -> MutableArrayRef< T >
DWARFExpression::Operation Op
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
ArrayRef(const T &OneElt) -> ArrayRef< T >
OutputIt copy(R &&Range, OutputIt Out)
filter_iterator_impl< WrappedIteratorT, PredicateT, detail::fwd_or_bidi_tag< WrappedIteratorT > > filter_iterator
Defines filter_iterator to a suitable specialization of filter_iterator_impl, based on the underlying...
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
An information struct used to provide DenseMap with the various necessary components for a given valu...
Special DenseMapInfo traits to compare MachineInstr* by value of the instruction rather than by point...
Definition MachineInstr.h:2125
static MachineInstr * getEmptyKey()
Definition MachineInstr.h:2126
static LLVM_ABI unsigned getHashValue(const MachineInstr *const &MI)
static MachineInstr * getTombstoneKey()
Definition MachineInstr.h:2130
static bool isEqual(const MachineInstr *const &LHS, const MachineInstr *const &RHS)
Definition MachineInstr.h:2136
Callbacks do nothing by default in iplist and ilist.
Template traits for intrusive list.