@@ -243,8 +243,10 @@ class TargetRegisterInfo;
243
243
private:
244
244
enum : unsigned { BoundaryID = ~0u };
245
245
246
- SDNode *Node = nullptr ; // /< Representative node.
247
- MachineInstr *Instr = nullptr ; // /< Alternatively, a MachineInstr.
246
+ union {
247
+ SDNode *Node; // /< Representative node.
248
+ MachineInstr *Instr; // /< Alternatively, a MachineInstr.
249
+ };
248
250
249
251
public:
250
252
SUnit *OrigNode = nullptr ; // /< If not this, the node from which this node
@@ -253,6 +255,10 @@ class TargetRegisterInfo;
253
255
const MCSchedClassDesc *SchedClass =
254
256
nullptr ; // /< nullptr or resolved SchedClass.
255
257
258
+ const TargetRegisterClass *CopyDstRC =
259
+ nullptr ; // /< Is a special copy node if != nullptr.
260
+ const TargetRegisterClass *CopySrcRC = nullptr ;
261
+
256
262
SmallVector<SDep, 4 > Preds; // /< All sunit predecessors.
257
263
SmallVector<SDep, 4 > Succs; // /< All sunit successors.
258
264
@@ -269,8 +275,14 @@ class TargetRegisterInfo;
269
275
unsigned NumSuccsLeft = 0 ; // /< # of succs not scheduled.
270
276
unsigned WeakPredsLeft = 0 ; // /< # of weak preds not scheduled.
271
277
unsigned WeakSuccsLeft = 0 ; // /< # of weak succs not scheduled.
272
- unsigned short NumRegDefsLeft = 0 ; // /< # of reg defs with no scheduled use.
273
- unsigned short Latency = 0 ; // /< Node latency.
278
+ unsigned TopReadyCycle = 0 ; // /< Cycle relative to start when node is ready.
279
+ unsigned BotReadyCycle = 0 ; // /< Cycle relative to end when node is ready.
280
+
281
+ private:
282
+ unsigned Depth = 0 ; // /< Node depth.
283
+ unsigned Height = 0 ; // /< Node height.
284
+
285
+ public:
274
286
bool isVRegCycle : 1 ; // /< May use and def the same vreg.
275
287
bool isCall : 1 ; // /< Is a function call.
276
288
bool isCallOp : 1 ; // /< Is a function call operand.
@@ -287,52 +299,54 @@ class TargetRegisterInfo;
287
299
bool isCloned : 1 ; // /< True if this node has been cloned.
288
300
bool isUnbuffered : 1 ; // /< Uses an unbuffered resource.
289
301
bool hasReservedResource : 1 ; // /< Uses a reserved resource.
290
- Sched::Preference SchedulingPref = Sched::None; // /< Scheduling preference.
302
+ unsigned short NumRegDefsLeft = 0 ; // /< # of reg defs with no scheduled use.
303
+ unsigned short Latency = 0 ; // /< Node latency.
291
304
292
305
private:
293
306
bool isDepthCurrent : 1 ; // /< True if Depth is current.
294
307
bool isHeightCurrent : 1 ; // /< True if Height is current.
295
- unsigned Depth = 0 ; // /< Node depth.
296
- unsigned Height = 0 ; // /< Node height.
308
+ bool isNode : 1 ; // /< True if the representative is an SDNode
309
+ bool isInst : 1 ; // /< True if the representative is a MachineInstr
297
310
298
311
public:
299
- unsigned TopReadyCycle = 0 ; // /< Cycle relative to start when node is ready.
300
- unsigned BotReadyCycle = 0 ; // /< Cycle relative to end when node is ready.
301
-
302
- const TargetRegisterClass *CopyDstRC =
303
- nullptr ; // /< Is a special copy node if != nullptr.
304
- const TargetRegisterClass *CopySrcRC = nullptr ;
312
+ Sched::Preference SchedulingPref : 4 ; // /< Scheduling preference.
313
+ static_assert (Sched::Preference::Last <= (1 << 4 ),
314
+ " not enough bits in bitfield" );
305
315
306
316
// / Constructs an SUnit for pre-regalloc scheduling to represent an
307
317
// / SDNode and any nodes flagged to it.
308
318
SUnit (SDNode *node, unsigned nodenum)
309
- : Node(node), NodeNum(nodenum), isVRegCycle(false ), isCall(false ),
310
- isCallOp (false ), isTwoAddress(false ), isCommutable(false ),
311
- hasPhysRegUses(false ), hasPhysRegDefs(false ), hasPhysRegClobbers(false ),
312
- isPending(false ), isAvailable(false ), isScheduled(false ),
313
- isScheduleHigh(false ), isScheduleLow(false ), isCloned(false ),
314
- isUnbuffered(false ), hasReservedResource(false ), isDepthCurrent(false ),
315
- isHeightCurrent(false ) {}
319
+ : Node(node), NodeNum(nodenum), isVRegCycle(false ), isCall(false ),
320
+ isCallOp (false ), isTwoAddress(false ), isCommutable(false ),
321
+ hasPhysRegUses(false ), hasPhysRegDefs(false ),
322
+ hasPhysRegClobbers(false ), isPending(false ), isAvailable(false ),
323
+ isScheduled(false ), isScheduleHigh(false ), isScheduleLow(false ),
324
+ isCloned(false ), isUnbuffered(false ), hasReservedResource(false ),
325
+ isDepthCurrent(false ), isHeightCurrent(false ), isNode(true ),
326
+ isInst(false ), SchedulingPref(Sched::None) {}
316
327
317
328
// / Constructs an SUnit for post-regalloc scheduling to represent a
318
329
// / MachineInstr.
319
330
SUnit (MachineInstr *instr, unsigned nodenum)
320
- : Instr(instr), NodeNum(nodenum), isVRegCycle(false ), isCall(false ),
321
- isCallOp(false ), isTwoAddress(false ), isCommutable(false ),
322
- hasPhysRegUses(false ), hasPhysRegDefs(false ), hasPhysRegClobbers(false ),
323
- isPending(false ), isAvailable(false ), isScheduled(false ),
324
- isScheduleHigh(false ), isScheduleLow(false ), isCloned(false ),
325
- isUnbuffered(false ), hasReservedResource(false ), isDepthCurrent(false ),
326
- isHeightCurrent(false ) {}
331
+ : Instr(instr), NodeNum(nodenum), isVRegCycle(false ), isCall(false ),
332
+ isCallOp(false ), isTwoAddress(false ), isCommutable(false ),
333
+ hasPhysRegUses(false ), hasPhysRegDefs(false ),
334
+ hasPhysRegClobbers(false ), isPending(false ), isAvailable(false ),
335
+ isScheduled(false ), isScheduleHigh(false ), isScheduleLow(false ),
336
+ isCloned(false ), isUnbuffered(false ), hasReservedResource(false ),
337
+ isDepthCurrent(false ), isHeightCurrent(false ), isNode(false ),
338
+ isInst(true ), SchedulingPref(Sched::None) {}
327
339
328
340
// / Constructs a placeholder SUnit.
329
341
SUnit ()
330
- : isVRegCycle(false ), isCall(false ), isCallOp(false ), isTwoAddress(false ),
331
- isCommutable(false ), hasPhysRegUses(false ), hasPhysRegDefs(false ),
332
- hasPhysRegClobbers(false ), isPending(false ), isAvailable(false ),
333
- isScheduled(false ), isScheduleHigh(false ), isScheduleLow(false ),
334
- isCloned(false ), isUnbuffered(false ), hasReservedResource(false ),
335
- isDepthCurrent(false ), isHeightCurrent(false ) {}
342
+ : Node(nullptr ), isVRegCycle(false ), isCall(false ), isCallOp(false ),
343
+ isTwoAddress(false ), isCommutable(false ), hasPhysRegUses(false ),
344
+ hasPhysRegDefs(false ), hasPhysRegClobbers(false ), isPending(false ),
345
+ isAvailable(false ), isScheduled(false ), isScheduleHigh(false ),
346
+ isScheduleLow(false ), isCloned(false ), isUnbuffered(false ),
347
+ hasReservedResource(false ), isDepthCurrent(false ),
348
+ isHeightCurrent(false ), isNode(false ), isInst(false ),
349
+ SchedulingPref(Sched::None) {}
336
350
337
351
// / Boundary nodes are placeholders for the boundary of the
338
352
// / scheduling region.
@@ -346,32 +360,36 @@ class TargetRegisterInfo;
346
360
// / Assigns the representative SDNode for this SUnit. This may be used
347
361
// / during pre-regalloc scheduling.
348
362
void setNode (SDNode *N) {
349
- assert (!Instr && " Setting SDNode of SUnit with MachineInstr!" );
363
+ assert (!isInst && " Setting SDNode of SUnit with MachineInstr!" );
350
364
Node = N;
365
+ isNode = true ;
351
366
}
352
367
353
368
// / Returns the representative SDNode for this SUnit. This may be used
354
369
// / during pre-regalloc scheduling.
355
370
SDNode *getNode () const {
356
- assert (!Instr && " Reading SDNode of SUnit with MachineInstr!" );
371
+ assert (!isInst && (isNode || !Instr) &&
372
+ " Reading SDNode of SUnit without SDNode!" );
357
373
return Node;
358
374
}
359
375
360
376
// / Returns true if this SUnit refers to a machine instruction as
361
377
// / opposed to an SDNode.
362
- bool isInstr () const { return Instr; }
378
+ bool isInstr () const { return isInst && Instr; }
363
379
364
380
// / Assigns the instruction for the SUnit. This may be used during
365
381
// / post-regalloc scheduling.
366
382
void setInstr (MachineInstr *MI) {
367
- assert (!Node && " Setting MachineInstr of SUnit with SDNode!" );
383
+ assert (!isNode && " Setting MachineInstr of SUnit with SDNode!" );
368
384
Instr = MI;
385
+ isInst = true ;
369
386
}
370
387
371
388
// / Returns the representative MachineInstr for this SUnit. This may be used
372
389
// / during post-regalloc scheduling.
373
390
MachineInstr *getInstr () const {
374
- assert (!Node && " Reading MachineInstr of SUnit with SDNode!" );
391
+ assert (!isNode && (isInst || !Node) &&
392
+ " Reading MachineInstr of SUnit without MachineInstr!" );
375
393
return Instr;
376
394
}
377
395
0 commit comments