@@ -76,6 +76,97 @@ using namespace llvm;
76
76
77
77
STATISTIC (NumClustered, " Number of load/store pairs clustered" );
78
78
79
+ STATISTIC (NumTopPreRA,
80
+ " Number of scheduling units chosen from top queue pre-RA" );
81
+ STATISTIC (NumBotPreRA,
82
+ " Number of scheduling units chosen from bottom queue pre-RA" );
83
+ STATISTIC (NumNoCandPreRA,
84
+ " Number of scheduling units chosen for NoCand heuristic pre-RA" );
85
+ STATISTIC (NumOnly1PreRA,
86
+ " Number of scheduling units chosen for Only1 heuristic pre-RA" );
87
+ STATISTIC (NumPhysRegPreRA,
88
+ " Number of scheduling units chosen for PhysReg heuristic pre-RA" );
89
+ STATISTIC (NumRegExcessPreRA,
90
+ " Number of scheduling units chosen for RegExcess heuristic pre-RA" );
91
+ STATISTIC (NumRegCriticalPreRA,
92
+ " Number of scheduling units chosen for RegCritical heuristic pre-RA" );
93
+ STATISTIC (NumStallPreRA,
94
+ " Number of scheduling units chosen for Stall heuristic pre-RA" );
95
+ STATISTIC (NumClusterPreRA,
96
+ " Number of scheduling units chosen for Cluster heuristic pre-RA" );
97
+ STATISTIC (NumWeakPreRA,
98
+ " Number of scheduling units chosen for Weak heuristic pre-RA" );
99
+ STATISTIC (NumRegMaxPreRA,
100
+ " Number of scheduling units chosen for RegMax heuristic pre-RA" );
101
+ STATISTIC (
102
+ NumResourceReducePreRA,
103
+ " Number of scheduling units chosen for ResourceReduce heuristic pre-RA" );
104
+ STATISTIC (
105
+ NumResourceDemandPreRA,
106
+ " Number of scheduling units chosen for ResourceDemand heuristic pre-RA" );
107
+ STATISTIC (
108
+ NumTopDepthReducePreRA,
109
+ " Number of scheduling units chosen for TopDepthReduce heuristic pre-RA" );
110
+ STATISTIC (
111
+ NumTopPathReducePreRA,
112
+ " Number of scheduling units chosen for TopPathReduce heuristic pre-RA" );
113
+ STATISTIC (
114
+ NumBotHeightReducePreRA,
115
+ " Number of scheduling units chosen for BotHeightReduce heuristic pre-RA" );
116
+ STATISTIC (
117
+ NumBotPathReducePreRA,
118
+ " Number of scheduling units chosen for BotPathReduce heuristic pre-RA" );
119
+ STATISTIC (NumNodeOrderPreRA,
120
+ " Number of scheduling units chosen for NodeOrder heuristic pre-RA" );
121
+ STATISTIC (NumFirstValidPreRA,
122
+ " Number of scheduling units chosen for FirstValid heuristic pre-RA" );
123
+
124
+ STATISTIC (NumTopPostRA,
125
+ " Number of scheduling units chosen from top queue post-RA" );
126
+ STATISTIC (NumBotPostRA,
127
+ " Number of scheduling units chosen from bottom queue post-RA" );
128
+ STATISTIC (NumNoCandPostRA,
129
+ " Number of scheduling units chosen for NoCand heuristic post-RA" );
130
+ STATISTIC (NumOnly1PostRA,
131
+ " Number of scheduling units chosen for Only1 heuristic post-RA" );
132
+ STATISTIC (NumPhysRegPostRA,
133
+ " Number of scheduling units chosen for PhysReg heuristic post-RA" );
134
+ STATISTIC (NumRegExcessPostRA,
135
+ " Number of scheduling units chosen for RegExcess heuristic post-RA" );
136
+ STATISTIC (
137
+ NumRegCriticalPostRA,
138
+ " Number of scheduling units chosen for RegCritical heuristic post-RA" );
139
+ STATISTIC (NumStallPostRA,
140
+ " Number of scheduling units chosen for Stall heuristic post-RA" );
141
+ STATISTIC (NumClusterPostRA,
142
+ " Number of scheduling units chosen for Cluster heuristic post-RA" );
143
+ STATISTIC (NumWeakPostRA,
144
+ " Number of scheduling units chosen for Weak heuristic post-RA" );
145
+ STATISTIC (NumRegMaxPostRA,
146
+ " Number of scheduling units chosen for RegMax heuristic post-RA" );
147
+ STATISTIC (
148
+ NumResourceReducePostRA,
149
+ " Number of scheduling units chosen for ResourceReduce heuristic post-RA" );
150
+ STATISTIC (
151
+ NumResourceDemandPostRA,
152
+ " Number of scheduling units chosen for ResourceDemand heuristic post-RA" );
153
+ STATISTIC (
154
+ NumTopDepthReducePostRA,
155
+ " Number of scheduling units chosen for TopDepthReduce heuristic post-RA" );
156
+ STATISTIC (
157
+ NumTopPathReducePostRA,
158
+ " Number of scheduling units chosen for TopPathReduce heuristic post-RA" );
159
+ STATISTIC (
160
+ NumBotHeightReducePostRA,
161
+ " Number of scheduling units chosen for BotHeightReduce heuristic post-RA" );
162
+ STATISTIC (
163
+ NumBotPathReducePostRA,
164
+ " Number of scheduling units chosen for BotPathReduce heuristic post-RA" );
165
+ STATISTIC (NumNodeOrderPostRA,
166
+ " Number of scheduling units chosen for NodeOrder heuristic post-RA" );
167
+ STATISTIC (NumFirstValidPostRA,
168
+ " Number of scheduling units chosen for FirstValid heuristic post-RA" );
169
+
79
170
namespace llvm {
80
171
81
172
cl::opt<MISched::Direction> PreRADirection (
@@ -3420,13 +3511,137 @@ bool tryLatency(GenericSchedulerBase::SchedCandidate &TryCand,
3420
3511
}
3421
3512
} // end namespace llvm
3422
3513
3423
- static void tracePick (GenericSchedulerBase::CandReason Reason, bool IsTop) {
3514
+ static void tracePick (GenericSchedulerBase::CandReason Reason, bool IsTop,
3515
+ bool IsPostRA = false ) {
3424
3516
LLVM_DEBUG (dbgs () << " Pick " << (IsTop ? " Top " : " Bot " )
3425
- << GenericSchedulerBase::getReasonStr (Reason) << ' \n ' );
3517
+ << GenericSchedulerBase::getReasonStr (Reason) << " ["
3518
+ << (IsPostRA ? " post-RA" : " pre-RA" ) << " ]\n " );
3519
+
3520
+ if (IsPostRA) {
3521
+ if (IsTop)
3522
+ NumTopPostRA++;
3523
+ else
3524
+ NumBotPostRA++;
3525
+
3526
+ switch (Reason) {
3527
+ case GenericScheduler::NoCand:
3528
+ NumNoCandPostRA++;
3529
+ return ;
3530
+ case GenericScheduler::Only1:
3531
+ NumOnly1PostRA++;
3532
+ return ;
3533
+ case GenericScheduler::PhysReg:
3534
+ NumPhysRegPostRA++;
3535
+ return ;
3536
+ case GenericScheduler::RegExcess:
3537
+ NumRegExcessPostRA++;
3538
+ return ;
3539
+ case GenericScheduler::RegCritical:
3540
+ NumRegCriticalPostRA++;
3541
+ return ;
3542
+ case GenericScheduler::Stall:
3543
+ NumStallPostRA++;
3544
+ return ;
3545
+ case GenericScheduler::Cluster:
3546
+ NumClusterPostRA++;
3547
+ return ;
3548
+ case GenericScheduler::Weak:
3549
+ NumWeakPostRA++;
3550
+ return ;
3551
+ case GenericScheduler::RegMax:
3552
+ NumRegMaxPostRA++;
3553
+ return ;
3554
+ case GenericScheduler::ResourceReduce:
3555
+ NumResourceReducePostRA++;
3556
+ return ;
3557
+ case GenericScheduler::ResourceDemand:
3558
+ NumResourceDemandPostRA++;
3559
+ return ;
3560
+ case GenericScheduler::TopDepthReduce:
3561
+ NumTopDepthReducePostRA++;
3562
+ return ;
3563
+ case GenericScheduler::TopPathReduce:
3564
+ NumTopPathReducePostRA++;
3565
+ return ;
3566
+ case GenericScheduler::BotHeightReduce:
3567
+ NumBotHeightReducePostRA++;
3568
+ return ;
3569
+ case GenericScheduler::BotPathReduce:
3570
+ NumBotPathReducePostRA++;
3571
+ return ;
3572
+ case GenericScheduler::NodeOrder:
3573
+ NumNodeOrderPostRA++;
3574
+ return ;
3575
+ case GenericScheduler::FirstValid:
3576
+ NumFirstValidPostRA++;
3577
+ return ;
3578
+ };
3579
+ } else {
3580
+ if (IsTop)
3581
+ NumTopPreRA++;
3582
+ else
3583
+ NumBotPreRA++;
3584
+
3585
+ switch (Reason) {
3586
+ case GenericScheduler::NoCand:
3587
+ NumNoCandPreRA++;
3588
+ return ;
3589
+ case GenericScheduler::Only1:
3590
+ NumOnly1PreRA++;
3591
+ return ;
3592
+ case GenericScheduler::PhysReg:
3593
+ NumPhysRegPreRA++;
3594
+ return ;
3595
+ case GenericScheduler::RegExcess:
3596
+ NumRegExcessPreRA++;
3597
+ return ;
3598
+ case GenericScheduler::RegCritical:
3599
+ NumRegCriticalPreRA++;
3600
+ return ;
3601
+ case GenericScheduler::Stall:
3602
+ NumStallPreRA++;
3603
+ return ;
3604
+ case GenericScheduler::Cluster:
3605
+ NumClusterPreRA++;
3606
+ return ;
3607
+ case GenericScheduler::Weak:
3608
+ NumWeakPreRA++;
3609
+ return ;
3610
+ case GenericScheduler::RegMax:
3611
+ NumRegMaxPreRA++;
3612
+ return ;
3613
+ case GenericScheduler::ResourceReduce:
3614
+ NumResourceReducePreRA++;
3615
+ return ;
3616
+ case GenericScheduler::ResourceDemand:
3617
+ NumResourceDemandPreRA++;
3618
+ return ;
3619
+ case GenericScheduler::TopDepthReduce:
3620
+ NumTopDepthReducePreRA++;
3621
+ return ;
3622
+ case GenericScheduler::TopPathReduce:
3623
+ NumTopPathReducePreRA++;
3624
+ return ;
3625
+ case GenericScheduler::BotHeightReduce:
3626
+ NumBotHeightReducePreRA++;
3627
+ return ;
3628
+ case GenericScheduler::BotPathReduce:
3629
+ NumBotPathReducePreRA++;
3630
+ return ;
3631
+ case GenericScheduler::NodeOrder:
3632
+ NumNodeOrderPreRA++;
3633
+ return ;
3634
+ case GenericScheduler::FirstValid:
3635
+ NumFirstValidPreRA++;
3636
+ return ;
3637
+ };
3638
+ }
3639
+ llvm_unreachable (" Unknown reason!" );
3426
3640
}
3427
3641
3428
- static void tracePick (const GenericSchedulerBase::SchedCandidate &Cand) {
3429
- tracePick (Cand.Reason , Cand.AtTop );
3642
+ static void tracePick (const GenericSchedulerBase::SchedCandidate &Cand,
3643
+ bool IsPostRA = false ) {
3644
+ tracePick (Cand.Reason , Cand.AtTop , IsPostRA);
3430
3645
}
3431
3646
3432
3647
void GenericScheduler::initialize (ScheduleDAGMI *dag) {
@@ -3849,12 +4064,12 @@ SUnit *GenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
3849
4064
// efficient, but also provides the best heuristics for CriticalPSets.
3850
4065
if (SUnit *SU = Bot.pickOnlyChoice ()) {
3851
4066
IsTopNode = false ;
3852
- tracePick (Only1, false );
4067
+ tracePick (Only1, /* IsTopNode= */ false );
3853
4068
return SU;
3854
4069
}
3855
4070
if (SUnit *SU = Top.pickOnlyChoice ()) {
3856
4071
IsTopNode = true ;
3857
- tracePick (Only1, true );
4072
+ tracePick (Only1, /* IsTopNode= */ true );
3858
4073
return SU;
3859
4074
}
3860
4075
// Set the bottom-up policy based on the state of the current bottom zone and
@@ -4196,12 +4411,12 @@ SUnit *PostGenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
4196
4411
// efficient, but also provides the best heuristics for CriticalPSets.
4197
4412
if (SUnit *SU = Bot.pickOnlyChoice ()) {
4198
4413
IsTopNode = false ;
4199
- tracePick (Only1, false );
4414
+ tracePick (Only1, /* IsTopNode= */ false , /* IsPostRA= */ true );
4200
4415
return SU;
4201
4416
}
4202
4417
if (SUnit *SU = Top.pickOnlyChoice ()) {
4203
4418
IsTopNode = true ;
4204
- tracePick (Only1, true );
4419
+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
4205
4420
return SU;
4206
4421
}
4207
4422
// Set the bottom-up policy based on the state of the current bottom zone and
@@ -4264,7 +4479,7 @@ SUnit *PostGenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
4264
4479
}
4265
4480
4266
4481
IsTopNode = Cand.AtTop ;
4267
- tracePick (Cand);
4482
+ tracePick (Cand, /* IsPostRA= */ true );
4268
4483
return Cand.SU ;
4269
4484
}
4270
4485
@@ -4280,7 +4495,7 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
4280
4495
if (RegionPolicy.OnlyBottomUp ) {
4281
4496
SU = Bot.pickOnlyChoice ();
4282
4497
if (SU) {
4283
- tracePick (Only1, true );
4498
+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
4284
4499
} else {
4285
4500
CandPolicy NoPolicy;
4286
4501
BotCand.reset (NoPolicy);
@@ -4289,14 +4504,14 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
4289
4504
setPolicy (BotCand.Policy , /* IsPostRA=*/ true , Bot, nullptr );
4290
4505
pickNodeFromQueue (Bot, BotCand);
4291
4506
assert (BotCand.Reason != NoCand && " failed to find a candidate" );
4292
- tracePick (BotCand);
4507
+ tracePick (BotCand, /* IsPostRA= */ true );
4293
4508
SU = BotCand.SU ;
4294
4509
}
4295
4510
IsTopNode = false ;
4296
4511
} else if (RegionPolicy.OnlyTopDown ) {
4297
4512
SU = Top.pickOnlyChoice ();
4298
4513
if (SU) {
4299
- tracePick (Only1, true );
4514
+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
4300
4515
} else {
4301
4516
CandPolicy NoPolicy;
4302
4517
TopCand.reset (NoPolicy);
@@ -4305,7 +4520,7 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
4305
4520
setPolicy (TopCand.Policy , /* IsPostRA=*/ true , Top, nullptr );
4306
4521
pickNodeFromQueue (Top, TopCand);
4307
4522
assert (TopCand.Reason != NoCand && " failed to find a candidate" );
4308
- tracePick (TopCand);
4523
+ tracePick (TopCand, /* IsPostRA= */ true );
4309
4524
SU = TopCand.SU ;
4310
4525
}
4311
4526
IsTopNode = true ;
0 commit comments