LLVM: include/llvm/CodeGen/MachineFunction.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17#ifndef LLVM_CODEGEN_MACHINEFUNCTION_H
18#define LLVM_CODEGEN_MACHINEFUNCTION_H
19
36#include
37#include
38#include
39#include
40#include
41#include
42#include
43
44namespace llvm {
45
76
80
84
85 template
87 assert(this == &OldList && "never transfer MBBs between functions");
88 }
89};
90
91
92
93
99
100
101
102
103
106
107
108
109
110
111 template <typename FuncInfoTy, typename SubtargetTy = TargetSubtargetInfo>
113 const SubtargetTy *STI) {
114 return new (Allocator.Allocate()) FuncInfoTy(F, STI);
115 }
116
117 template
119 return new (Allocator.Allocate()) Ty(MFI);
120 }
121
122
123
124
125
129 const {
130 return nullptr;
131 }
132};
133
134
135
136
138
139
140
141
142
143public:
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
202
204 return Properties[static_cast<unsigned>(P)];
205 }
206
208 Properties.set(static_cast<unsigned>(P));
209 return *this;
210 }
211
213 Properties.reset(static_cast<unsigned>(P));
214 return *this;
215 }
216
217
218#define PPACCESSORS(X) \
219 bool has##X() const { return hasProperty(Property::X); } \
220 MachineFunctionProperties &set##X(void) { return set(Property::X); } \
221 MachineFunctionProperties &reset##X(void) { return reset(Property::X); }
222
235
236
238 Properties.reset();
239 return *this;
240 }
241
243 Properties |= MFP.Properties;
244 return *this;
245 }
246
248 Properties &= ~MFP.Properties;
249 return *this;
250 }
251
252
253
255 return (Properties | ~V.Properties).all();
256 }
257
258
260
261private:
263};
264
272
273
285
291
292
294
295
296
298
299
301
302
304
305
307
308
310
311
312
313
315
316
317
319
320
321
322
323 std::vector<MachineBasicBlock*> MBBNumbering;
324
325
326
327 unsigned MBBNumberingEpoch = 0;
328
329
331
332
334
335
337
338
340
341
343 BasicBlockListType BasicBlocks;
344
345
346
347
348 unsigned FunctionNumber;
349
350
352
353
354
355
356
357
358 bool ExposesReturnsTwice = false;
359
360
361 bool HasInlineAsm = false;
362
363
364 bool HasWinCFI = false;
365
366
367
369
370
371 std::unique_ptr PSVManager;
372
373
374
375 std::vector FrameInstructions;
376
377
378
379 std::vector<MCSymbol *> LongjmpTargets;
380
381
382
383 std::vector<MCSymbol *> EHContTargets;
384
385
386
387
388
389 std::vector LandingPads;
390
391
393
394
396
397
399
400
401 std::vector<std::pair<MCSymbol *, MDNode *>> CodeViewAnnotations;
402
403 bool CallsEHReturn = false;
404 bool CallsUnwindInit = false;
405 bool HasEHContTarget = false;
406 bool HasEHScopes = false;
407 bool HasEHFunclets = false;
408 bool HasFakeUses = false;
409 bool IsOutlined = false;
410
411
412 unsigned NextBBID = 0;
413
414
416
417
418 std::vector<const GlobalValue *> TypeInfos;
419
420
421 std::vector FilterIds;
422
423
424 std::vector FilterEnds;
425
427
428
429
430
431
432
433
434
435 void clear();
436
437
438
439 void init();
440
441public:
442
443
444
445
447 std::variant<int, MCRegister> Address;
448
449 public:
453
457
461
462
463 bool inStackSlot() const { return std::holds_alternative(Address); }
464
465
467 return std::holds_alternative(Address);
468 }
469
470
471
472 int getStackSlot() const { return std::get(Address); }
473
474
475
477 return std::get(Address);
478 }
479
480
481
484 Address = NewSlot;
485 }
486 };
487
489 virtual void anchor();
490
491 public:
493
495
497
498
501 };
502
503
504
505
506
511 assert(Arg < (1 << 16) && "Arg out of range");
512 }
513 };
514
516
518
520
522
523
524
525
527 };
528
533
535
536private:
537 Delegate *TheDelegate = nullptr;
539
540
542
543
544
546
548
549
550 CalledGlobalsMap CalledGlobalsInfo;
551
552
556
557public:
558
560
563
564
565
566
568
569
570
572
573
575
576
577
578
579
580
581
582
583
584
586 public:
590
594
595
596
600 };
601
602
603
604
605
607
608
609
610
611
612
621
622
623
625
626
627
629
630
631
633 unsigned SubReg = 0);
634
635
636
637
638
639
640
641
642
644 unsigned MaxOperand = UINT_MAX);
645
646
647
648
649
650
651
652
653
654
655
656
660
662
663
664
665
666
667
669
670
671
673
674
675
677
678
680
681
682
684
687 unsigned FunctionNum);
691
692
694 clear();
695 init();
696 }
697
698
700 assert(TheDelegate == delegate &&
701 "Only the current delegate can perform reset!");
702 TheDelegate = nullptr;
703 }
704
705
706
708 assert(delegate && !TheDelegate &&
709 "Attempted to set delegate to null, or to change it without "
710 "first resetting it!");
711
712 TheDelegate = delegate;
713 }
714
716
718
720
721
723
724
726
728
729
730 const DataLayout &getDataLayout() const;
731
732
734
735
737
738
740
741
743
744
750
752
753
754
755 void assignBeginEndSections();
756
757
759
760
761
763
764
765
766
768 return static_cast<const STC &>(STI);
769 }
770
771
774
775
776
777
780
781
782
783
784
787
788
789
791
792
793
796
797
798
799
802
803
804
805
808
809
811
812
814
815
817 if (Alignment < A)
818 Alignment = A;
819 }
820
821
822
823
825 return ExposesReturnsTwice;
826 }
827
828
829
831 ExposesReturnsTwice = B;
832 }
833
834
836 return HasInlineAsm;
837 }
838
839
841 HasInlineAsm = B;
842 }
843
845 return HasWinCFI;
846 }
848
849
850 bool needsFrameMoves() const;
851
852
855
856
857
858
859 template
861 return static_cast<Ty*>(MFInfo);
862 }
863
864 template
866 return static_cast<const Ty *>(MFInfo);
867 }
868
869 template Ty *cloneInfo(const Ty &Old) {
871 MFInfo = Ty::template create(Allocator, Old);
872 return static_cast<Ty *>(MFInfo);
873 }
874
875
877
881 assert(!MFInfo && "new function already has MachineFunctionInfo");
882 if (!OrigMF.MFInfo)
883 return nullptr;
884 return OrigMF.MFInfo->clone(Allocator, *this, Src2DstMBB);
885 }
886
887
888
890
891
892
893
894
896 assert(N < MBBNumbering.size() && "Illegal block number");
897 assert(MBBNumbering[N] && "Block was removed from the machine function!");
898 return MBBNumbering[N];
899 }
900
901
902 bool shouldSplitStack() const;
903
904
905 unsigned getNumBlockIDs() const { return (unsigned)MBBNumbering.size(); }
906
907
908
909
911
912
913
914
915
916
918
919
920
922
923
924
926
927
928
929
930
931
933
934
935
936
937
938
939 void viewCFGOnly() const;
940
941
942 void dump() const;
943
944
945
946
947 bool verify(Pass *p = nullptr, const char *Banner = nullptr,
948 raw_ostream *OS = nullptr, bool AbortOnError = true) const;
949
950
951
952
954 const char *Banner = nullptr, raw_ostream *OS = nullptr,
955 bool AbortOnError = true) const;
956
957
958
959
960
962 const char *Banner = nullptr, raw_ostream *OS = nullptr,
963 bool AbortOnError = true) const;
964
965
970
971
974 return &MachineFunction::BasicBlocks;
975 }
976
977
978
980
981
982
983
988
993
994 unsigned size() const { return (unsigned)BasicBlocks.size();}
995 bool empty() const { return BasicBlocks.empty(); }
1000
1004 BasicBlocks.insert(MBBI, MBB);
1005 }
1007 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI);
1008 }
1010 BasicBlocks.splice(InsertPt, BasicBlocks, MBB);
1011 }
1013 BasicBlocks.splice(InsertPt, BasicBlocks, MBBI, MBBE);
1014 }
1015
1020
1021 template
1023 BasicBlocks.sort(comp);
1024 }
1025
1026
1033
1034
1035
1036
1037
1038
1040 MBBNumbering.push_back(MBB);
1041 return (unsigned)MBBNumbering.size()-1;
1042 }
1043
1044
1045
1046
1048 assert(N < MBBNumbering.size() && "Illegal basic block #");
1049 MBBNumbering[N] = nullptr;
1050 }
1051
1052
1053
1055 bool NoImplicit = false);
1056
1057
1058
1059
1060
1061
1062
1063
1065
1066
1067
1068
1069
1070
1075
1076
1078
1079
1080
1081
1083 CreateMachineBasicBlock(const BasicBlock *BB = nullptr,
1084 std::optional BBID = std::nullopt);
1085
1086
1088
1089
1090
1091
1111 BaseAlignment, AAInfo, Ranges, SSID, Ordering,
1112 FailureOrdering);
1113 }
1121 BaseAlignment, AAInfo, Ranges, SSID, Ordering,
1122 FailureOrdering);
1123 }
1124
1125
1126
1127
1128
1135 .hasValue() ? LLT()
1136 : Size.isScalable()
1139 }
1148
1149
1150
1151
1152
1158 LLT Ty);
1169
1170
1171
1172
1175
1176
1177
1178
1181
1183
1184
1185
1187 return OperandRecycler.allocate(Cap, Allocator);
1188 }
1189
1190
1191
1192
1194 OperandRecycler.deallocate(Cap, Array);
1195 }
1196
1197
1198 uint32_t *allocateRegMask();
1199
1201
1202
1203
1204
1205
1206 MachineInstr::ExtraInfo *createMIExtraInfo(
1208 MCSymbol *PostInstrSymbol = nullptr, MDNode *HeapAllocMarker = nullptr,
1210 MDNode *MMRAs = nullptr, Value *DS = nullptr);
1211
1212
1213 const char *createExternalSymbolName(StringRef Name);
1214
1215
1216
1217
1218
1219
1220
1222 bool isLinkerPrivate = false) const;
1223
1224
1225
1226 MCSymbol *getPICBaseSymbol() const;
1227
1228
1229
1230
1232 return FrameInstructions;
1233 }
1234
1235 [[nodiscard]] unsigned addFrameInst(const MCCFIInstruction &Inst);
1236
1237
1238
1239
1241 return LongjmpTargets;
1242 }
1243
1244
1245
1247
1248
1249
1251 return EHContTargets;
1252 }
1253
1254
1255
1257
1258
1259
1261 return CalledGlobalsInfo.lookup(MI);
1262 }
1263
1264
1266 assert(MI && "MI must not be null");
1267 assert(Details.Callee && "Global must not be null");
1268 CalledGlobalsInfo.insert({MI, Details});
1269 }
1270
1271
1273 return llvm::make_range(CalledGlobalsInfo.begin(), CalledGlobalsInfo.end());
1274 }
1275
1276
1277
1278
1281
1284
1287
1290
1293
1296
1299
1300
1302
1303
1305 return LandingPads;
1306 }
1307
1308
1309
1312
1313
1314
1315
1317
1318
1319 unsigned getTypeIDFor(const GlobalValue *TI);
1320
1321
1323
1324
1326
1327
1329 return !WasmLPadToIndexMap.empty();
1330 }
1331
1332
1334 WasmLPadToIndexMap[LPad] = Index;
1335 }
1336
1337
1339 return WasmLPadToIndexMap.count(LPad);
1340 }
1341
1342
1345 return WasmLPadToIndexMap.lookup(LPad);
1346 }
1347
1349 return !LPadToCallSiteMap.empty();
1350 }
1351
1352
1355 "missing call site number for landing pad!");
1356 return LPadToCallSiteMap[Sym];
1357 }
1358
1359
1361 return !LPadToCallSiteMap[Sym].empty();
1362 }
1363
1365 return !CallSiteMap.empty();
1366 }
1367
1368
1370 CallSiteMap[BeginLabel] = Site;
1371 }
1372
1373
1376 "Missing call site number for EH_LABEL!");
1377 return CallSiteMap.lookup(BeginLabel);
1378 }
1379
1380
1382 return CallSiteMap.count(BeginLabel);
1383 }
1384
1385
1387 CodeViewAnnotations.push_back({Label, MD});
1388 }
1389
1391 return CodeViewAnnotations;
1392 }
1393
1394
1395 const std::vector<const GlobalValue *> &getTypeInfos() const {
1396 return TypeInfos;
1397 }
1398
1399
1400
1402 return FilterIds;
1403 }
1404
1405
1406
1407
1408
1413
1414
1415
1420
1425
1426
1427
1430 return VarInfo.inStackSlot();
1431 });
1432 }
1433
1434
1435
1438 return VarInfo.inStackSlot();
1439 });
1440 }
1441
1442
1443
1446 return VarInfo.inEntryValueRegister();
1447 });
1448 }
1449
1450
1453 bool Inserted =
1454 CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second;
1455 (void)Inserted;
1456 assert(Inserted && "Call site info not unique");
1457 }
1458
1460 return CallSitesInfo;
1461 }
1462
1463
1464
1465
1466
1467
1468 void eraseAdditionalCallInfo(const MachineInstr *MI);
1469
1470
1471
1473
1474
1475
1476
1478
1482};
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1496
1497
1499
1503
1507
1509
1511 return F->getNumBlockIDs();
1512 }
1514 return F->getBlockNumberEpoch();
1515 }
1516};
1520
1521
1523
1527
1531
1533 return F->size();
1534 }
1535
1537 return F->getNumBlockIDs();
1538 }
1540 return F->getBlockNumberEpoch();
1541 }
1542};
1543
1544
1545
1546
1547
1548
1552 return &G.Graph->front();
1553 }
1554
1556 return F->getNumBlockIDs();
1557 }
1559 return F->getBlockNumberEpoch();
1560 }
1561};
1565 return &G.Graph->front();
1566 }
1567
1569 return F->getNumBlockIDs();
1570 }
1572 return F->getBlockNumberEpoch();
1573 }
1574};
1575
1577 const MachineFunction &MF);
1578
1579}
1580
1581#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
MachineBasicBlock MachineBasicBlock::iterator MBBI
This file defines the BumpPtrAllocator interface.
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Atomic ordering constants.
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static void viewCFG(Function &F, const BlockFrequencyInfo *BFI, const BranchProbabilityInfo *BPI, uint64_t MaxFreq, bool CFGOnly=false)
static unsigned InstrCount
This file defines the DenseMap class.
This file defines the little GraphTraits template class that should be specialized by classes that...
static uint64_t estimateFunctionSizeInBytes(const LoongArchInstrInfo *TII, const MachineFunction &MF)
#define PPACCESSORS(X)
Definition MachineFunction.h:218
static unsigned addLiveIn(MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
static StringRef getName(Value *V)
This file defines the SmallVector class.
static MachineMemOperand * getMachineMemOperand(MachineFunction &MF, FrameIndexSDNode &FI)
The size of an allocated array is represented by a Capacity instance.
Recycle small arrays allocated from a BumpPtrAllocator.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
LLVM Basic Block Representation.
The address of a basic block.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
A parsed version of the target data layout string in and methods for querying it.
DenseMapIterator< KeyT, ValueT, KeyInfoT, BucketT > iterator
Abstract class that contains various methods for clients to notify about changes.
static constexpr LLT scalable_vector(unsigned MinNumElements, unsigned ScalarSizeInBits)
Get a low-level scalable vector of some number of elements and element width.
static constexpr LLT scalar(unsigned SizeInBits)
Get a low-level scalar or aggregate "bag of bits".
static LocationSize precise(uint64_t Value)
Context object for machine code objects.
Describe properties that are true of each instruction in the target description file.
Wrapper class representing physical registers. Should be passed by value.
Instances of this class represent a uniqued identifier for a section in the current translation unit.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
MachineInstrBundleIterator< MachineInstr > iterator
The MachineConstantPool class keeps track of constants referenced by a function which must be spilled...
The MachineFrameInfo class represents an abstract stack frame until prolog/epilog code is inserted.
Properties which a MachineFunction may have at a given point in time.
Definition MachineFunction.h:137
MachineFunctionProperties & set(const MachineFunctionProperties &MFP)
Definition MachineFunction.h:242
LLVM_ABI void print(raw_ostream &OS) const
Print the MachineFunctionProperties in human-readable form.
bool verifyRequiredProperties(const MachineFunctionProperties &V) const
Definition MachineFunction.h:254
MachineFunctionProperties & reset(const MachineFunctionProperties &MFP)
Definition MachineFunction.h:247
MachineFunctionProperties & set(Property P)
Definition MachineFunction.h:207
bool hasProperty(Property P) const
Definition MachineFunction.h:203
Property
Definition MachineFunction.h:187
@ TracksLiveness
Definition MachineFunction.h:190
@ FailsVerification
Definition MachineFunction.h:197
@ RegBankSelected
Definition MachineFunction.h:194
@ TiedOpsRewritten
Definition MachineFunction.h:196
@ IsSSA
Definition MachineFunction.h:188
@ NoVRegs
Definition MachineFunction.h:191
@ TracksDebugUserValues
Definition MachineFunction.h:199
@ NoPHIs
Definition MachineFunction.h:189
@ FailedISel
Definition MachineFunction.h:192
@ FailedRegAlloc
Definition MachineFunction.h:198
@ Selected
Definition MachineFunction.h:195
@ LastProperty
Definition MachineFunction.h:200
@ Legalized
Definition MachineFunction.h:193
MachineFunctionProperties & reset(Property P)
Definition MachineFunction.h:212
DebugPHIRegallocPos(MachineBasicBlock *MBB, Register Reg, unsigned SubReg)
Definition MachineFunction.h:618
Register Reg
VReg where the control-flow-merge happens.
Definition MachineFunction.h:616
unsigned SubReg
Optional subreg qualifier within Reg.
Definition MachineFunction.h:617
MachineBasicBlock * MBB
Block where this PHI was originally located.
Definition MachineFunction.h:615
bool operator<(const DebugSubstitution &Other) const
Order only by source instruction / operand pair: there should never be duplicate entries for the same...
Definition MachineFunction.h:597
DebugInstrOperandPair Dest
Replacement instruction / operand pair.
Definition MachineFunction.h:588
DebugInstrOperandPair Src
Source instruction / operand pair.
Definition MachineFunction.h:587
DebugSubstitution(const DebugInstrOperandPair &Src, const DebugInstrOperandPair &Dest, unsigned Subreg)
Definition MachineFunction.h:591
unsigned Subreg
Qualifier for which part of Dest is read.
Definition MachineFunction.h:589
Definition MachineFunction.h:488
virtual void MF_HandleChangeDesc(MachineInstr &MI, const MCInstrDesc &TID)
Callback before changing MCInstrDesc.
Definition MachineFunction.h:499
virtual void MF_HandleRemoval(MachineInstr &MI)=0
Callback before a removal. This should not modify the MI directly.
virtual void MF_HandleInsertion(MachineInstr &MI)=0
Callback after an insertion. This should not modify the MI directly.
virtual ~Delegate()=default
bool inStackSlot() const
Return true if this variable is in a stack slot.
Definition MachineFunction.h:463
const DILocation * Loc
Definition MachineFunction.h:452
void updateStackSlot(int NewSlot)
Updates the stack slot of this variable, assuming inStackSlot() is true.
Definition MachineFunction.h:482
MCRegister getEntryValueRegister() const
Returns the MCRegister of this variable, assuming inEntryValueRegister() is true.
Definition MachineFunction.h:476
bool inEntryValueRegister() const
Return true if this variable is in the entry value of a register.
Definition MachineFunction.h:466
const DILocalVariable * Var
Definition MachineFunction.h:450
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Definition MachineFunction.h:454
int getStackSlot() const
Returns the stack slot of this variable, assuming inStackSlot() is true.
Definition MachineFunction.h:472
const DIExpression * Expr
Definition MachineFunction.h:451
VariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, MCRegister EntryValReg, const DILocation *Loc)
Definition MachineFunction.h:458
Definition MachineFunction.h:286
unsigned getInstructionCount() const
Return the number of MachineInstrs in this MachineFunction.
Definition MachineFunction.h:1027
auto getEntryValueVariableDbgInfo() const
Returns the collection of variables for which we have debug info and that have been assigned an entry...
Definition MachineFunction.h:1444
void setBBSectionsType(BasicBlockSection V)
Definition MachineFunction.h:751
MachineJumpTableInfo * getJumpTableInfo()
Definition MachineFunction.h:786
const WinEHFuncInfo * getWinEHFuncInfo() const
getWinEHFuncInfo - Return information about how the current function uses Windows exception handling.
Definition MachineFunction.h:806
void setCallsUnwindInit(bool b)
Definition MachineFunction.h:1283
unsigned addToMBBNumbering(MachineBasicBlock *MBB)
Adds the MBB to the internal numbering.
Definition MachineFunction.h:1039
void addLongjmpTarget(MCSymbol *Target)
Add the specified symbol to the list of valid longjmp targets for Windows Control Flow Guard.
Definition MachineFunction.h:1246
const MachineConstantPool * getConstantPool() const
Definition MachineFunction.h:795
const MachineFrameInfo & getFrameInfo() const
Definition MachineFunction.h:779
void setHasEHFunclets(bool V)
Definition MachineFunction.h:1292
bool UseDebugInstrRef
Flag for whether this function contains DBG_VALUEs (false) or DBG_INSTR_REF (true).
Definition MachineFunction.h:628
std::pair< unsigned, unsigned > DebugInstrOperandPair
Pair of instruction number and operand number.
Definition MachineFunction.h:574
ArrayRecycler< MachineOperand >::Capacity OperandCapacity
Definition MachineFunction.h:1182
void addEHContTarget(MCSymbol *Target)
Add the specified symbol to the list of targets for Windows EH Continuation Guard.
Definition MachineFunction.h:1256
bool useDebugInstrRef() const
Returns true if the function's variable locations are tracked with instruction referencing.
void setExposesReturnsTwice(bool B)
setCallsSetJmp - Set a flag that indicates if there's a call to a "returns twice" function.
Definition MachineFunction.h:830
void removeFromMBBNumbering(unsigned N)
removeFromMBBNumbering - Remove the specific machine basic block from our tracker,...
Definition MachineFunction.h:1047
SmallVector< DebugSubstitution, 8 > DebugValueSubstitutions
Debug value substitutions: a collection of DebugSubstitution objects, recording changes in where a va...
Definition MachineFunction.h:606
unsigned getFunctionNumber() const
getFunctionNumber - Return a unique ID for the current function.
Definition MachineFunction.h:742
void setHasInlineAsm(bool B)
Set a flag that indicates that the function contains inline assembly.
Definition MachineFunction.h:840
bool hasAnyCallSiteLabel() const
Definition MachineFunction.h:1364
CalledGlobalInfo tryGetCalledGlobal(const MachineInstr *MI) const
Tries to get the global and target flags for a call site, if the instruction is a call to a global.
Definition MachineFunction.h:1260
PseudoSourceValueManager & getPSVManager() const
Definition MachineFunction.h:727
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New, unsigned MaxOperand=UINT_MAX)
Create substitutions for any tracked values in Old, to point at New.
void setCallSiteBeginLabel(MCSymbol *BeginLabel, unsigned Site)
Map the begin label for a call site.
Definition MachineFunction.h:1369
void setHasWinCFI(bool v)
Definition MachineFunction.h:847
void setWasmLandingPadIndex(const MachineBasicBlock *LPad, unsigned Index)
Map the landing pad to its index. Used for Wasm exception handling.
Definition MachineFunction.h:1333
const TargetSubtargetInfo & getSubtarget() const
getSubtarget - Return the subtarget for which this machine code is being compiled.
Definition MachineFunction.h:762
const std::vector< MCCFIInstruction > & getFrameInstructions() const
Returns a reference to a list of cfi instructions in the function's prologue.
Definition MachineFunction.h:1231
unsigned getNewDebugInstrNum()
Definition MachineFunction.h:1479
DenseMap< const MachineInstr *, CallSiteInfo > CallSiteInfoMap
Definition MachineFunction.h:534
MachineFunction & operator=(const MachineFunction &)=delete
bool hasInlineAsm() const
Returns true if the function contains any inline assembly.
Definition MachineFunction.h:835
void setCallsEHReturn(bool b)
Definition MachineFunction.h:1280
void makeDebugValueSubstitution(DebugInstrOperandPair, DebugInstrOperandPair, unsigned SubReg=0)
Create a substitution between one <instr,operand> value to a different, new value.
MachineFunction(Function &F, const TargetMachine &Target, const TargetSubtargetInfo &STI, MCContext &Ctx, unsigned FunctionNum)
BasicBlockListType::reverse_iterator reverse_iterator
Definition MachineFunction.h:969
bool hasWinCFI() const
Definition MachineFunction.h:844
void setAlignment(Align A)
setAlignment - Set the alignment of the function.
Definition MachineFunction.h:813
WinEHFuncInfo * getWinEHFuncInfo()
Definition MachineFunction.h:807
bool exposesReturnsTwice() const
exposesReturnsTwice - Returns true if the function calls setjmp or any other similar functions with a...
Definition MachineFunction.h:824
MachineFunctionProperties & getProperties()
Definition MachineFunction.h:854
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, TypeSize Size, Align BaseAlignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
Definition MachineFunction.h:1114
GISelChangeObserver * getObserver() const
Definition MachineFunction.h:717
MachineFrameInfo & getFrameInfo()
getFrameInfo - Return the frame info object for the current function.
Definition MachineFunction.h:778
const std::vector< MCSymbol * > & getEHContTargets() const
Returns a reference to a list of symbols that are targets for Windows EH Continuation Guard.
Definition MachineFunction.h:1250
void finalizeDebugInstrRefs()
Finalise any partially emitted debug instructions.
void deallocateOperandArray(OperandCapacity Cap, MachineOperand *Array)
Dellocate an array of MachineOperands and recycle the memory.
Definition MachineFunction.h:1193
void setSection(MCSection *S)
Indicates the Section this function belongs to.
Definition MachineFunction.h:725
bool callsUnwindInit() const
Definition MachineFunction.h:1282
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, uint64_t Size)
Definition MachineFunction.h:1140
void push_front(MachineBasicBlock *MBB)
Definition MachineFunction.h:1002
const std::vector< unsigned > & getFilterIds() const
Return a reference to the typeids encoding filters used in the current function.
Definition MachineFunction.h:1401
const std::vector< const GlobalValue * > & getTypeInfos() const
Return a reference to the C++ typeinfo for the current function.
Definition MachineFunction.h:1395
auto getInStackSlotVariableDbgInfo() const
Returns the collection of variables for which we have debug info and that have been assigned a stack ...
Definition MachineFunction.h:1436
bool hasAnyWasmLandingPadIndex() const
Return if there is any wasm exception handling.
Definition MachineFunction.h:1328
const CallSiteInfoMap & getCallSitesInfo() const
Definition MachineFunction.h:1459
void ensureAlignment(Align A)
ensureAlignment - Make sure the function is at least A bytes aligned.
Definition MachineFunction.h:816
void push_back(MachineBasicBlock *MBB)
Definition MachineFunction.h:1001
reverse_iterator rbegin()
Definition MachineFunction.h:989
void setHasFakeUses(bool V)
Definition MachineFunction.h:1295
void setUseDebugInstrRef(bool UseInstrRef)
Set whether this function will use instruction referencing or not.
bool hasBBSections() const
Returns true if this function has basic block sections enabled.
Definition MachineFunction.h:745
MCContext & getContext() const
Definition MachineFunction.h:719
bool callsEHReturn() const
Definition MachineFunction.h:1279
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, MCRegister Reg, const DILocation *Loc)
Collect information used to emit debugging information of a variable in the entry value of a register...
Definition MachineFunction.h:1416
const Function & getFunction() const
Return the LLVM function that this machine code represents.
Definition MachineFunction.h:736
MachineOperand * allocateOperandArray(OperandCapacity Cap)
Allocate an array of MachineOperands.
Definition MachineFunction.h:1186
unsigned size() const
Definition MachineFunction.h:994
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, TypeSize Size)
Definition MachineFunction.h:1164
MachineRegisterInfo & getRegInfo()
getRegInfo - Return information about the registers currently in use.
Definition MachineFunction.h:772
MachineBasicBlock * getBlockNumbered(unsigned N) const
getBlockNumbered - MachineBasicBlocks are automatically numbered when they are inserted into the mach...
Definition MachineFunction.h:895
reverse_iterator rend()
Definition MachineFunction.h:991
unsigned DebugInstrNumberingCount
A count of how many instructions in the function have had numbers assigned to them.
Definition MachineFunction.h:567
auto getInStackSlotVariableDbgInfo()
Returns the collection of variables for which we have debug info and that have been assigned a stack ...
Definition MachineFunction.h:1428
Align getAlignment() const
getAlignment - Return the alignment of the function.
Definition MachineFunction.h:810
void splice(iterator InsertPt, iterator MBBI, iterator MBBE)
Definition MachineFunction.h:1012
void handleChangeDesc(MachineInstr &MI, const MCInstrDesc &TID)
unsigned getWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Get the index in wasm EH for a given landing pad.
Definition MachineFunction.h:1343
const_iterator end() const
Definition MachineFunction.h:987
static const unsigned int DebugOperandMemNumber
A reserved operand number representing the instructions memory operand, for instructions that have a ...
Definition MachineFunction.h:683
void setObserver(GISelChangeObserver *O)
Definition MachineFunction.h:715
unsigned getBlockNumberEpoch() const
Return the numbering "epoch" of block numbers, incremented after each numbering.
Definition MachineFunction.h:910
void resetDelegate(Delegate *delegate)
Reset the currently registered delegate - otherwise assert.
Definition MachineFunction.h:699
void addCodeViewAnnotation(MCSymbol *Label, MDNode *MD)
Record annotations associated with a particular label.
Definition MachineFunction.h:1386
Function & getFunction()
Return the LLVM function that this machine code represents.
Definition MachineFunction.h:733
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, const MachinePointerInfo &PtrInfo, uint64_t Size)
Definition MachineFunction.h:1159
iterator end()
Definition MachineFunction.h:986
void erase(MachineBasicBlock *MBBI)
Definition MachineFunction.h:1019
unsigned getNumBlockIDs() const
getNumBlockIDs - Return the number of MBB ID's allocated.
Definition MachineFunction.h:905
const_iterator begin() const
Definition MachineFunction.h:985
void remove(MachineBasicBlock *MBBI)
Definition MachineFunction.h:1017
void setIsOutlined(bool V)
Definition MachineFunction.h:1298
const std::vector< MCSymbol * > & getLongjmpTargets() const
Returns a reference to a list of symbols immediately following calls to _setjmp in the function.
Definition MachineFunction.h:1240
DebugInstrOperandPair salvageCopySSAImpl(MachineInstr &MI)
const std::vector< LandingPadInfo > & getLandingPads() const
Return a reference to the landing pad info for the current function.
Definition MachineFunction.h:1304
MCSection * getSection() const
Returns the Section this function belongs to.
Definition MachineFunction.h:722
const VariableDbgInfoMapTy & getVariableDbgInfo() const
Definition MachineFunction.h:1422
bool isOutlined() const
Definition MachineFunction.h:1297
const MachineBasicBlock & back() const
Definition MachineFunction.h:998
BasicBlockListType::iterator iterator
Definition MachineFunction.h:966
void setDebugInstrNumberingCount(unsigned Num)
Set value of DebugInstrNumberingCount field.
const_reverse_iterator rbegin() const
Definition MachineFunction.h:990
const STC & getSubtarget() const
getSubtarget - This method returns a pointer to the specified type of TargetSubtargetInfo.
Definition MachineFunction.h:767
iterator begin()
Definition MachineFunction.h:984
BasicBlockListType::const_reverse_iterator const_reverse_iterator
Definition MachineFunction.h:968
unsigned getCallSiteBeginLabel(MCSymbol *BeginLabel) const
Get the call site number for a begin label.
Definition MachineFunction.h:1374
void remove(iterator MBBI)
Definition MachineFunction.h:1016
VariableDbgInfoMapTy & getVariableDbgInfo()
Definition MachineFunction.h:1421
Ty * getInfo()
getInfo - Keep track of various per-function pieces of information for backends that would like to do...
Definition MachineFunction.h:860
MachineConstantPool * getConstantPool()
getConstantPool - Return the constant pool object for the current function.
Definition MachineFunction.h:794
const MachineRegisterInfo & getRegInfo() const
Definition MachineFunction.h:773
const WasmEHFuncInfo * getWasmEHFuncInfo() const
getWasmEHFuncInfo - Return information about how the current function uses Wasm exception handling.
Definition MachineFunction.h:800
bool hasCallSiteBeginLabel(MCSymbol *BeginLabel) const
Return true if the begin label has a call site number associated with it.
Definition MachineFunction.h:1381
void splice(iterator InsertPt, MachineBasicBlock *MBB)
Definition MachineFunction.h:1009
void addCallSiteInfo(const MachineInstr *CallI, CallSiteInfo &&CallInfo)
Start tracking the arguments passed to the call CallI.
Definition MachineFunction.h:1451
static BasicBlockListType MachineFunction::* getSublistAccess(MachineBasicBlock *)
Support for MachineBasicBlock::getNextNode().
Definition MachineFunction.h:973
void sort(Comp comp)
Definition MachineFunction.h:1022
bool hasWasmLandingPadIndex(const MachineBasicBlock *LPad) const
Returns true if the landing pad has an associate index in wasm EH.
Definition MachineFunction.h:1338
bool shouldUseDebugInstrRef() const
Determine whether, in the current machine configuration, we should use instruction referencing or not...
const MachineFunctionProperties & getProperties() const
Get the function properties.
Definition MachineFunction.h:853
Ty * cloneInfo(const Ty &Old)
Definition MachineFunction.h:869
bool hasCallSiteLandingPad(MCSymbol *Sym)
Return true if the landing pad Eh symbol has an associated call site.
Definition MachineFunction.h:1360
void setVariableDbgInfo(const DILocalVariable *Var, const DIExpression *Expr, int Slot, const DILocation *Loc)
Collect information used to emit debugging information of a variable in a stack slot.
Definition MachineFunction.h:1409
void setDelegate(Delegate *delegate)
Set the delegate.
Definition MachineFunction.h:707
void reset()
Reset the instance as if it was just created.
Definition MachineFunction.h:693
DenseMap< unsigned, DebugPHIRegallocPos > DebugPHIPositions
Map of debug instruction numbers to the position of their PHI instructions during register allocation...
Definition MachineFunction.h:624
const MachineBasicBlock & front() const
Definition MachineFunction.h:996
void setHasEHScopes(bool V)
Definition MachineFunction.h:1289
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, LocationSize Size)
Definition MachineFunction.h:1131
bool empty() const
Definition MachineFunction.h:995
MachineMemOperand * getMachineMemOperand(MachinePointerInfo PtrInfo, MachineMemOperand::Flags F, uint64_t Size, Align BaseAlignment, const AAMDNodes &AAInfo=AAMDNodes(), const MDNode *Ranges=nullptr, SyncScope::ID SSID=SyncScope::System, AtomicOrdering Ordering=AtomicOrdering::NotAtomic, AtomicOrdering FailureOrdering=AtomicOrdering::NotAtomic)
Definition MachineFunction.h:1104
const Ty * getInfo() const
Definition MachineFunction.h:865
bool hasEHFunclets() const
Definition MachineFunction.h:1291
MachineMemOperand * getMachineMemOperand(const MachineMemOperand *MMO, int64_t Offset, TypeSize Size)
Definition MachineFunction.h:1144
const MachineJumpTableInfo * getJumpTableInfo() const
getJumpTableInfo - Return the jump table info object for the current function.
Definition MachineFunction.h:785
const_reverse_iterator rend() const
Definition MachineFunction.h:992
void setHasEHContTarget(bool V)
Definition MachineFunction.h:1286
bool hasAnyCallSiteLandingPad() const
Definition MachineFunction.h:1348
bool hasFakeUses() const
Definition MachineFunction.h:1294
WasmEHFuncInfo * getWasmEHFuncInfo()
Definition MachineFunction.h:801
void splice(iterator InsertPt, iterator MBBI)
Definition MachineFunction.h:1006
SmallVector< VariableDbgInfo, 4 > VariableDbgInfoMapTy
Definition MachineFunction.h:561
auto getCalledGlobals() const
Iterates over the full set of call sites and their associated globals.
Definition MachineFunction.h:1272
bool hasEHContTarget() const
Definition MachineFunction.h:1285
void addCalledGlobal(const MachineInstr *MI, CalledGlobalInfo Details)
Notes the global and target flags for a call site.
Definition MachineFunction.h:1265
void erase(iterator MBBI)
Definition MachineFunction.h:1018
bool hasEHScopes() const
Definition MachineFunction.h:1288
ArrayRef< std::pair< MCSymbol *, MDNode * > > getCodeViewAnnotations() const
Definition MachineFunction.h:1390
VariableDbgInfoMapTy VariableDbgInfos
Definition MachineFunction.h:562
MachineFunction(const MachineFunction &)=delete
void insert(iterator MBBI, MachineBasicBlock *MBB)
Definition MachineFunction.h:1003
MachineBasicBlock & back()
Definition MachineFunction.h:999
const TargetMachine & getTarget() const
getTarget - Return the target machine this machine code is compiled with
Definition MachineFunction.h:758
DebugInstrOperandPair salvageCopySSA(MachineInstr &MI, DenseMap< Register, DebugInstrOperandPair > &DbgPHICache)
Find the underlying defining instruction / operand for a COPY instruction while in SSA form.
BasicBlockListType::const_iterator const_iterator
Definition MachineFunction.h:967
MachineFunctionInfo * cloneInfoFrom(const MachineFunction &OrigMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB)
Definition MachineFunction.h:878
MachineBasicBlock & front()
Definition MachineFunction.h:997
SmallVectorImpl< unsigned > & getCallSiteLandingPad(MCSymbol *Sym)
Get the call site indexes for a landing pad EH symbol.
Definition MachineFunction.h:1353
Representation of each machine instruction.
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.
A description of a memory reference used in the backend.
Flags
Flags values. These may be or'd together.
MachineOperand class - Representation of each machine instruction operand.
MachineRegisterInfo - Keep track of information for virtual and physical registers,...
Pass interface - Implemented by all 'passes'.
Manages creation of pseudo source values.
Recycler - This class manages a linked-list of deallocated nodes and facilitates reusing deallocated ...
Wrapper class representing virtual and physical registers.
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.
StringRef - Represent a constant reference to a string, i.e.
Primary interface to the complete machine description for the target machine.
TargetSubtargetInfo - Generic base class for all target subtargets.
LLVM Value Representation.
typename base_list_type::const_reverse_iterator const_reverse_iterator
typename base_list_type::reverse_iterator reverse_iterator
typename base_list_type::iterator iterator
typename base_list_type::const_iterator const_iterator
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.
@ Cold
Attempts to make code in the caller as efficient as possible under the assumption that the call is no...
@ System
Synchronized with respect to all concurrently executing threads.
This is an optimization pass for GlobalISel generic memory operations.
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
AnalysisManager< MachineFunction > MachineFunctionAnalysisManager
MachineFunctionDataHotness
Definition MachineFunction.h:94
@ Hot
Definition MachineFunction.h:97
iplist< T, Options... > ilist
LLVM_ABI void verifyMachineFunction(const std::string &Banner, const MachineFunction &MF)
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...
AtomicOrdering
Atomic ordering for LLVM's memory model.
BumpPtrAllocatorImpl<> BumpPtrAllocator
The standard BumpPtrAllocator which just uses the default template parameters.
A collection of metadata nodes that might be associated with a memory access used by the alias-analys...
This struct is a compact representation of a valid (non-zero power of two) alignment.
Represent subnormal handling kind for floating point instruction inputs and outputs.
static unsigned getNumberEpoch(MachineFunction *F)
Definition MachineFunction.h:1558
static unsigned getMaxNumber(MachineFunction *F)
Definition MachineFunction.h:1555
static NodeRef getEntryNode(Inverse< MachineFunction * > G)
Definition MachineFunction.h:1551
static unsigned getNumberEpoch(const MachineFunction *F)
Definition MachineFunction.h:1571
static unsigned getMaxNumber(const MachineFunction *F)
Definition MachineFunction.h:1568
static NodeRef getEntryNode(Inverse< const MachineFunction * > G)
Definition MachineFunction.h:1564
static unsigned getNumberEpoch(MachineFunction *F)
Definition MachineFunction.h:1513
pointer_iterator< MachineFunction::iterator > nodes_iterator
Definition MachineFunction.h:1498
static unsigned size(MachineFunction *F)
Definition MachineFunction.h:1508
static nodes_iterator nodes_begin(MachineFunction *F)
Definition MachineFunction.h:1500
static unsigned getMaxNumber(MachineFunction *F)
Definition MachineFunction.h:1510
static nodes_iterator nodes_end(MachineFunction *F)
Definition MachineFunction.h:1504
static NodeRef getEntryNode(MachineFunction *F)
Definition MachineFunction.h:1495
static nodes_iterator nodes_begin(const MachineFunction *F)
Definition MachineFunction.h:1524
pointer_iterator< MachineFunction::const_iterator > nodes_iterator
Definition MachineFunction.h:1522
static nodes_iterator nodes_end(const MachineFunction *F)
Definition MachineFunction.h:1528
static unsigned size(const MachineFunction *F)
Definition MachineFunction.h:1532
static unsigned getMaxNumber(const MachineFunction *F)
Definition MachineFunction.h:1536
static NodeRef getEntryNode(const MachineFunction *F)
Definition MachineFunction.h:1519
static unsigned getNumberEpoch(const MachineFunction *F)
Definition MachineFunction.h:1539
typename MachineFunction *::UnknownGraphTypeError NodeRef
This structure is used to retain landing pad info for the current function.
Definition MachineFunction.h:274
SmallVector< MCSymbol *, 1 > EndLabels
Definition MachineFunction.h:277
MCSymbol * LandingPadLabel
Definition MachineFunction.h:279
SmallVector< SEHHandler, 1 > SEHHandlers
Definition MachineFunction.h:278
LandingPadInfo(MachineBasicBlock *MBB)
Definition MachineFunction.h:282
MachineBasicBlock * LandingPadBlock
Definition MachineFunction.h:275
SmallVector< MCSymbol *, 1 > BeginLabels
Definition MachineFunction.h:276
std::vector< int > TypeIds
Definition MachineFunction.h:280
MachineFunctionInfo - This class can be derived from and used by targets to hold private target-speci...
Definition MachineFunction.h:104
static FuncInfoTy * create(BumpPtrAllocator &Allocator, const Function &F, const SubtargetTy *STI)
Factory function: default behavior is to call new using the supplied allocator.
Definition MachineFunction.h:112
virtual ~MachineFunctionInfo()
virtual MachineFunctionInfo * clone(BumpPtrAllocator &Allocator, MachineFunction &DestMF, const DenseMap< MachineBasicBlock *, MachineBasicBlock * > &Src2DstMBB) const
Make a functionally equivalent copy of this MachineFunctionInfo in MF.
Definition MachineFunction.h:127
static Ty * create(BumpPtrAllocator &Allocator, const Ty &MFI)
Definition MachineFunction.h:118
Register Reg
Definition MachineFunction.h:508
uint16_t ArgNo
Definition MachineFunction.h:509
ArgRegPair(Register R, unsigned Arg)
Definition MachineFunction.h:510
Definition MachineFunction.h:515
SmallVector< ConstantInt *, 4 > CalleeTypeIds
Callee type ids.
Definition MachineFunction.h:519
SmallVector< ArgRegPair, 1 > ArgRegPairs
Vector of call argument and its forwarding register.
Definition MachineFunction.h:517
Definition MachineFunction.h:529
const GlobalValue * Callee
Definition MachineFunction.h:530
unsigned TargetFlags
Definition MachineFunction.h:531
This class contains a discriminated union of information about pointers in memory operands,...
Definition MachineFunction.h:265
const BlockAddress * RecoverBA
Address of block to recover at. Null for a finally handler.
Definition MachineFunction.h:270
const Function * FilterOrFinally
Filter or finally function. Null indicates a catch-all.
Definition MachineFunction.h:267
LLVM_ABI void deleteNode(MachineBasicBlock *MBB)
Use delete by default for iplist and ilist.
void transferNodesFromList(ilist_callback_traits &OldList, Iterator, Iterator)
Definition MachineFunction.h:86
LLVM_ABI void removeNodeFromList(MachineBasicBlock *N)
LLVM_ABI void addNodeToList(MachineBasicBlock *N)
Callbacks do nothing by default in iplist and ilist.
Template traits for intrusive list.