19
19
#include " llvm/CodeGen/MachineInstr.h"
20
20
#include " llvm/CodeGen/TargetRegisterInfo.h"
21
21
#include " llvm/IR/DebugInfoMetadata.h"
22
+ #include " llvm/Support/Compiler.h"
22
23
#include < optional>
23
24
24
25
#include " LiveDebugValues.h"
@@ -204,8 +205,8 @@ class ValueIDNum {
204
205
.str ();
205
206
}
206
207
207
- static ValueIDNum EmptyValue;
208
- static ValueIDNum TombstoneValue;
208
+ LLVM_ABI_FOR_TEST static ValueIDNum EmptyValue;
209
+ LLVM_ABI_FOR_TEST static ValueIDNum TombstoneValue;
209
210
};
210
211
211
212
} // End namespace LiveDebugValues
@@ -425,7 +426,7 @@ struct DbgOpID {
425
426
DbgOpID (uint32_t RawID) : RawID(RawID) {}
426
427
DbgOpID (bool IsConst, uint32_t Index) : ID({IsConst, Index}) {}
427
428
428
- static DbgOpID UndefID;
429
+ LLVM_ABI_FOR_TEST static DbgOpID UndefID;
429
430
430
431
bool operator ==(const DbgOpID &Other) const { return RawID == Other.RawID ; }
431
432
bool operator !=(const DbgOpID &Other) const { return !(*this == Other); }
@@ -788,8 +789,9 @@ class MLocTracker {
788
789
value_type operator *() { return value_type (Idx, ValueMap[LocIdx (Idx)]); }
789
790
};
790
791
791
- MLocTracker (MachineFunction &MF, const TargetInstrInfo &TII,
792
- const TargetRegisterInfo &TRI, const TargetLowering &TLI);
792
+ LLVM_ABI_FOR_TEST MLocTracker (MachineFunction &MF, const TargetInstrInfo &TII,
793
+ const TargetRegisterInfo &TRI,
794
+ const TargetLowering &TLI);
793
795
794
796
// / Produce location ID number for a Register. Provides some small amount of
795
797
// / type safety.
@@ -903,7 +905,7 @@ class MLocTracker {
903
905
904
906
// / Create a LocIdx for an untracked register ID. Initialize it to either an
905
907
// / mphi value representing a live-in, or a recent register mask clobber.
906
- LocIdx trackRegister (unsigned ID);
908
+ LLVM_ABI_FOR_TEST LocIdx trackRegister (unsigned ID);
907
909
908
910
LocIdx lookupOrTrackRegister (unsigned ID) {
909
911
LocIdx &Index = LocIDToLocIdx[ID];
@@ -968,7 +970,8 @@ class MLocTracker {
968
970
// / Find LocIdx for SpillLoc \p L, creating a new one if it's not tracked.
969
971
// / Returns std::nullopt when in scenarios where a spill slot could be
970
972
// / tracked, but we would likely run into resource limitations.
971
- std::optional<SpillLocationNo> getOrTrackSpillLoc (SpillLoc L);
973
+ LLVM_ABI_FOR_TEST std::optional<SpillLocationNo>
974
+ getOrTrackSpillLoc (SpillLoc L);
972
975
973
976
// Get LocIdx of a spill ID.
974
977
LocIdx getSpillMLoc (unsigned SpillID) {
@@ -1342,7 +1345,7 @@ class InstrRefBasedLDV : public LDVImpl {
1342
1345
// / in an MLocTracker. Convert the observations into a per-block transfer
1343
1346
// / function in \p MLocTransfer, suitable for using with the machine value
1344
1347
// / location dataflow problem.
1345
- void
1348
+ LLVM_ABI_FOR_TEST void
1346
1349
produceMLocTransferFunction (MachineFunction &MF,
1347
1350
SmallVectorImpl<MLocTransferMap> &MLocTransfer,
1348
1351
unsigned MaxNumBlocks);
@@ -1352,20 +1355,20 @@ class InstrRefBasedLDV : public LDVImpl {
1352
1355
// / live-out arrays to the (initialized to zero) multidimensional arrays in
1353
1356
// / \p MInLocs and \p MOutLocs. The outer dimension is indexed by block
1354
1357
// / number, the inner by LocIdx.
1355
- void buildMLocValueMap (MachineFunction &MF, FuncValueTable &MInLocs,
1356
- FuncValueTable &MOutLocs,
1357
- SmallVectorImpl<MLocTransferMap> &MLocTransfer);
1358
+ LLVM_ABI_FOR_TEST void
1359
+ buildMLocValueMap (MachineFunction &MF, FuncValueTable &MInLocs,
1360
+ FuncValueTable &MOutLocs,
1361
+ SmallVectorImpl<MLocTransferMap> &MLocTransfer);
1358
1362
1359
1363
// / Examine the stack indexes (i.e. offsets within the stack) to find the
1360
1364
// / basic units of interference -- like reg units, but for the stack.
1361
1365
void findStackIndexInterference (SmallVectorImpl<unsigned > &Slots);
1362
1366
1363
1367
// / Install PHI values into the live-in array for each block, according to
1364
1368
// / the IDF of each register.
1365
- void placeMLocPHIs (MachineFunction &MF,
1366
- SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
1367
- FuncValueTable &MInLocs,
1368
- SmallVectorImpl<MLocTransferMap> &MLocTransfer);
1369
+ LLVM_ABI_FOR_TEST void placeMLocPHIs (
1370
+ MachineFunction &MF, SmallPtrSetImpl<MachineBasicBlock *> &AllBlocks,
1371
+ FuncValueTable &MInLocs, SmallVectorImpl<MLocTransferMap> &MLocTransfer);
1369
1372
1370
1373
// / Propagate variable values to blocks in the common case where there's
1371
1374
// / only one value assigned to the variable. This function has better
@@ -1422,12 +1425,13 @@ class InstrRefBasedLDV : public LDVImpl {
1422
1425
// / \p AssignBlocks contains the set of blocks that aren't in \p DILoc's
1423
1426
// / scope, but which do contain DBG_VALUEs, which VarLocBasedImpl tracks
1424
1427
// / locations through.
1425
- void buildVLocValueMap (const DILocation *DILoc,
1426
- const SmallSet<DebugVariableID, 4 > &VarsWeCareAbout,
1427
- SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
1428
- LiveInsT &Output, FuncValueTable &MOutLocs,
1429
- FuncValueTable &MInLocs,
1430
- SmallVectorImpl<VLocTracker> &AllTheVLocs);
1428
+ LLVM_ABI_FOR_TEST void
1429
+ buildVLocValueMap (const DILocation *DILoc,
1430
+ const SmallSet<DebugVariableID, 4 > &VarsWeCareAbout,
1431
+ SmallPtrSetImpl<MachineBasicBlock *> &AssignBlocks,
1432
+ LiveInsT &Output, FuncValueTable &MOutLocs,
1433
+ FuncValueTable &MInLocs,
1434
+ SmallVectorImpl<VLocTracker> &AllTheVLocs);
1431
1435
1432
1436
// / Attempt to eliminate un-necessary PHIs on entry to a block. Examines the
1433
1437
// / live-in values coming from predecessors live-outs, and replaces any PHIs
@@ -1436,16 +1440,17 @@ class InstrRefBasedLDV : public LDVImpl {
1436
1440
// / \p LiveIn Old live-in value, overwritten with new one if live-in changes.
1437
1441
// / \returns true if any live-ins change value, either from value propagation
1438
1442
// / or PHI elimination.
1439
- bool vlocJoin (MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
1440
- SmallPtrSet<const MachineBasicBlock *, 8 > &BlocksToExplore,
1441
- DbgValue &LiveIn);
1443
+ LLVM_ABI_FOR_TEST bool
1444
+ vlocJoin (MachineBasicBlock &MBB, LiveIdxT &VLOCOutLocs,
1445
+ SmallPtrSet<const MachineBasicBlock *, 8 > &BlocksToExplore,
1446
+ DbgValue &LiveIn);
1442
1447
1443
1448
// / For the given block and live-outs feeding into it, try to find
1444
1449
// / machine locations for each debug operand where all the values feeding
1445
1450
// / into that operand join together.
1446
1451
// / \returns true if a joined location was found for every value that needed
1447
1452
// / to be joined.
1448
- bool
1453
+ LLVM_ABI_FOR_TEST bool
1449
1454
pickVPHILoc (SmallVectorImpl<DbgOpID> &OutValues, const MachineBasicBlock &MBB,
1450
1455
const LiveIdxT &LiveOuts, FuncValueTable &MOutLocs,
1451
1456
const SmallVectorImpl<const MachineBasicBlock *> &BlockOrders);
@@ -1461,7 +1466,7 @@ class InstrRefBasedLDV : public LDVImpl {
1461
1466
1462
1467
// / Boilerplate computation of some initial sets, artifical blocks and
1463
1468
// / RPOT block ordering.
1464
- void initialSetup (MachineFunction &MF);
1469
+ LLVM_ABI_FOR_TEST void initialSetup (MachineFunction &MF);
1465
1470
1466
1471
// / Produce a map of the last lexical scope that uses a block, using the
1467
1472
// / scopes DFSOut number. Mapping is block-number to DFSOut.
@@ -1490,7 +1495,7 @@ class InstrRefBasedLDV : public LDVImpl {
1490
1495
1491
1496
public:
1492
1497
// / Default construct and initialize the pass.
1493
- InstrRefBasedLDV ();
1498
+ LLVM_ABI_FOR_TEST InstrRefBasedLDV ();
1494
1499
1495
1500
LLVM_DUMP_METHOD
1496
1501
void dump_mloc_transfer (const MLocTransferMap &mloc_transfer) const ;
0 commit comments