@@ -33,15 +33,26 @@ namespace llvm {
33
33
// / An individual mapping from virtual register number to SUnit.
34
34
struct VReg2SUnit {
35
35
unsigned VirtReg;
36
+ LaneBitmask LaneMask;
36
37
SUnit *SU;
37
38
38
- VReg2SUnit (unsigned reg, SUnit *su): VirtReg(reg), SU(su) {}
39
+ VReg2SUnit (unsigned VReg, LaneBitmask LaneMask, SUnit *SU)
40
+ : VirtReg(VReg), LaneMask(LaneMask), SU(SU) {}
39
41
40
42
unsigned getSparseSetIndex () const {
41
43
return TargetRegisterInfo::virtReg2Index (VirtReg);
42
44
}
43
45
};
44
46
47
+ // / Mapping from virtual register to SUnit including an operand index.
48
+ struct VReg2SUnitOperIdx : public VReg2SUnit {
49
+ unsigned OperandIndex;
50
+
51
+ VReg2SUnitOperIdx (unsigned VReg, LaneBitmask LaneMask,
52
+ unsigned OperandIndex, SUnit *SU)
53
+ : VReg2SUnit(VReg, LaneMask, SU), OperandIndex(OperandIndex) {}
54
+ };
55
+
45
56
// / Record a physical register access.
46
57
// / For non-data-dependent uses, OpIdx == -1.
47
58
struct PhysRegSUOper {
@@ -69,7 +80,10 @@ namespace llvm {
69
80
// / Track local uses of virtual registers. These uses are gathered by the DAG
70
81
// / builder and may be consulted by the scheduler to avoid iterating an entire
71
82
// / vreg use list.
72
- typedef SparseMultiSet<VReg2SUnit, VirtReg2IndexFunctor> VReg2UseMap;
83
+ typedef SparseMultiSet<VReg2SUnit, VirtReg2IndexFunctor> VReg2SUnitMultiMap;
84
+
85
+ typedef SparseMultiSet<VReg2SUnitOperIdx, VirtReg2IndexFunctor>
86
+ VReg2SUnitOperIdxMultiMap;
73
87
74
88
// / ScheduleDAGInstrs - A ScheduleDAG subclass for scheduling lists of
75
89
// / MachineInstrs.
@@ -95,6 +109,9 @@ namespace llvm {
95
109
// / it has taken responsibility for scheduling the terminator correctly.
96
110
bool CanHandleTerminators;
97
111
112
+ // / Whether lane masks should get tracked.
113
+ bool TrackLaneMasks;
114
+
98
115
// / State specific to the current scheduling region.
99
116
// / ------------------------------------------------
100
117
@@ -117,7 +134,7 @@ namespace llvm {
117
134
// / After calling BuildSchedGraph, each vreg used in the scheduling region
118
135
// / is mapped to a set of SUnits. These include all local vreg uses, not
119
136
// / just the uses for a singly defined vreg.
120
- VReg2UseMap VRegUses;
137
+ VReg2SUnitMultiMap VRegUses;
121
138
122
139
// / State internal to DAG building.
123
140
// / -------------------------------
@@ -129,8 +146,12 @@ namespace llvm {
129
146
Reg2SUnitsMap Defs;
130
147
Reg2SUnitsMap Uses;
131
148
132
- // / Track the last instruction in this region defining each virtual register.
133
- VReg2SUnitMap VRegDefs;
149
+ // / Tracks the last instruction(s) in this region defining each virtual
150
+ // / register. There may be multiple current definitions for a register with
151
+ // / disjunct lanemasks.
152
+ VReg2SUnitMultiMap CurrentVRegDefs;
153
+ // / Tracks the last instructions in this region using each virtual register.
154
+ VReg2SUnitOperIdxMultiMap CurrentVRegUses;
134
155
135
156
// / PendingLoads - Remember where unknown loads are after the most recent
136
157
// / unknown store, as we iterate. As with Defs and Uses, this is here
@@ -200,7 +221,8 @@ namespace llvm {
200
221
// / input.
201
222
void buildSchedGraph (AliasAnalysis *AA,
202
223
RegPressureTracker *RPTracker = nullptr ,
203
- PressureDiffs *PDiffs = nullptr );
224
+ PressureDiffs *PDiffs = nullptr ,
225
+ bool TrackLaneMasks = false );
204
226
205
227
// / addSchedBarrierDeps - Add dependencies from instructions in the current
206
228
// / list of instructions being scheduled to scheduling barrier. We want to
@@ -247,6 +269,12 @@ namespace llvm {
247
269
// / Other adjustments may be made to the instruction if necessary. Return
248
270
// / true if the operand has been deleted, false if not.
249
271
bool toggleKillFlag (MachineInstr *MI, MachineOperand &MO);
272
+
273
+ // / Returns a mask for which lanes get read/written by the given (register)
274
+ // / machine operand.
275
+ LaneBitmask getLaneMaskForMO (const MachineOperand &MO) const ;
276
+
277
+ void collectVRegUses (SUnit *SU);
250
278
};
251
279
252
280
// / newSUnit - Creates a new SUnit and return a ptr to it.
0 commit comments