@@ -84,6 +84,97 @@ STATISTIC(NumInstrsScheduledPostRA,
84
84
" Number of instructions scheduled by post-RA scheduler" );
85
85
STATISTIC (NumClustered, " Number of load/store pairs clustered" );
86
86
87
+ STATISTIC (NumTopPreRA,
88
+ " Number of scheduling units chosen from top queue pre-RA" );
89
+ STATISTIC (NumBotPreRA,
90
+ " Number of scheduling units chosen from bottom queue pre-RA" );
91
+ STATISTIC (NumNoCandPreRA,
92
+ " Number of scheduling units chosen for NoCand heuristic pre-RA" );
93
+ STATISTIC (NumOnly1PreRA,
94
+ " Number of scheduling units chosen for Only1 heuristic pre-RA" );
95
+ STATISTIC (NumPhysRegPreRA,
96
+ " Number of scheduling units chosen for PhysReg heuristic pre-RA" );
97
+ STATISTIC (NumRegExcessPreRA,
98
+ " Number of scheduling units chosen for RegExcess heuristic pre-RA" );
99
+ STATISTIC (NumRegCriticalPreRA,
100
+ " Number of scheduling units chosen for RegCritical heuristic pre-RA" );
101
+ STATISTIC (NumStallPreRA,
102
+ " Number of scheduling units chosen for Stall heuristic pre-RA" );
103
+ STATISTIC (NumClusterPreRA,
104
+ " Number of scheduling units chosen for Cluster heuristic pre-RA" );
105
+ STATISTIC (NumWeakPreRA,
106
+ " Number of scheduling units chosen for Weak heuristic pre-RA" );
107
+ STATISTIC (NumRegMaxPreRA,
108
+ " Number of scheduling units chosen for RegMax heuristic pre-RA" );
109
+ STATISTIC (
110
+ NumResourceReducePreRA,
111
+ " Number of scheduling units chosen for ResourceReduce heuristic pre-RA" );
112
+ STATISTIC (
113
+ NumResourceDemandPreRA,
114
+ " Number of scheduling units chosen for ResourceDemand heuristic pre-RA" );
115
+ STATISTIC (
116
+ NumTopDepthReducePreRA,
117
+ " Number of scheduling units chosen for TopDepthReduce heuristic pre-RA" );
118
+ STATISTIC (
119
+ NumTopPathReducePreRA,
120
+ " Number of scheduling units chosen for TopPathReduce heuristic pre-RA" );
121
+ STATISTIC (
122
+ NumBotHeightReducePreRA,
123
+ " Number of scheduling units chosen for BotHeightReduce heuristic pre-RA" );
124
+ STATISTIC (
125
+ NumBotPathReducePreRA,
126
+ " Number of scheduling units chosen for BotPathReduce heuristic pre-RA" );
127
+ STATISTIC (NumNodeOrderPreRA,
128
+ " Number of scheduling units chosen for NodeOrder heuristic pre-RA" );
129
+ STATISTIC (NumFirstValidPreRA,
130
+ " Number of scheduling units chosen for FirstValid heuristic pre-RA" );
131
+
132
+ STATISTIC (NumTopPostRA,
133
+ " Number of scheduling units chosen from top queue post-RA" );
134
+ STATISTIC (NumBotPostRA,
135
+ " Number of scheduling units chosen from bottom queue post-RA" );
136
+ STATISTIC (NumNoCandPostRA,
137
+ " Number of scheduling units chosen for NoCand heuristic post-RA" );
138
+ STATISTIC (NumOnly1PostRA,
139
+ " Number of scheduling units chosen for Only1 heuristic post-RA" );
140
+ STATISTIC (NumPhysRegPostRA,
141
+ " Number of scheduling units chosen for PhysReg heuristic post-RA" );
142
+ STATISTIC (NumRegExcessPostRA,
143
+ " Number of scheduling units chosen for RegExcess heuristic post-RA" );
144
+ STATISTIC (
145
+ NumRegCriticalPostRA,
146
+ " Number of scheduling units chosen for RegCritical heuristic post-RA" );
147
+ STATISTIC (NumStallPostRA,
148
+ " Number of scheduling units chosen for Stall heuristic post-RA" );
149
+ STATISTIC (NumClusterPostRA,
150
+ " Number of scheduling units chosen for Cluster heuristic post-RA" );
151
+ STATISTIC (NumWeakPostRA,
152
+ " Number of scheduling units chosen for Weak heuristic post-RA" );
153
+ STATISTIC (NumRegMaxPostRA,
154
+ " Number of scheduling units chosen for RegMax heuristic post-RA" );
155
+ STATISTIC (
156
+ NumResourceReducePostRA,
157
+ " Number of scheduling units chosen for ResourceReduce heuristic post-RA" );
158
+ STATISTIC (
159
+ NumResourceDemandPostRA,
160
+ " Number of scheduling units chosen for ResourceDemand heuristic post-RA" );
161
+ STATISTIC (
162
+ NumTopDepthReducePostRA,
163
+ " Number of scheduling units chosen for TopDepthReduce heuristic post-RA" );
164
+ STATISTIC (
165
+ NumTopPathReducePostRA,
166
+ " Number of scheduling units chosen for TopPathReduce heuristic post-RA" );
167
+ STATISTIC (
168
+ NumBotHeightReducePostRA,
169
+ " Number of scheduling units chosen for BotHeightReduce heuristic post-RA" );
170
+ STATISTIC (
171
+ NumBotPathReducePostRA,
172
+ " Number of scheduling units chosen for BotPathReduce heuristic post-RA" );
173
+ STATISTIC (NumNodeOrderPostRA,
174
+ " Number of scheduling units chosen for NodeOrder heuristic post-RA" );
175
+ STATISTIC (NumFirstValidPostRA,
176
+ " Number of scheduling units chosen for FirstValid heuristic post-RA" );
177
+
87
178
namespace llvm {
88
179
89
180
cl::opt<MISched::Direction> PreRADirection (
@@ -3430,13 +3521,137 @@ bool tryLatency(GenericSchedulerBase::SchedCandidate &TryCand,
3430
3521
}
3431
3522
} // end namespace llvm
3432
3523
3433
- static void tracePick (GenericSchedulerBase::CandReason Reason, bool IsTop) {
3524
+ static void tracePick (GenericSchedulerBase::CandReason Reason, bool IsTop,
3525
+ bool IsPostRA = false ) {
3434
3526
LLVM_DEBUG (dbgs () << " Pick " << (IsTop ? " Top " : " Bot " )
3435
- << GenericSchedulerBase::getReasonStr (Reason) << ' \n ' );
3527
+ << GenericSchedulerBase::getReasonStr (Reason) << " ["
3528
+ << (IsPostRA ? " post-RA" : " pre-RA" ) << " ]\n " );
3529
+
3530
+ if (IsPostRA) {
3531
+ if (IsTop)
3532
+ NumTopPostRA++;
3533
+ else
3534
+ NumBotPostRA++;
3535
+
3536
+ switch (Reason) {
3537
+ case GenericScheduler::NoCand:
3538
+ NumNoCandPostRA++;
3539
+ return ;
3540
+ case GenericScheduler::Only1:
3541
+ NumOnly1PostRA++;
3542
+ return ;
3543
+ case GenericScheduler::PhysReg:
3544
+ NumPhysRegPostRA++;
3545
+ return ;
3546
+ case GenericScheduler::RegExcess:
3547
+ NumRegExcessPostRA++;
3548
+ return ;
3549
+ case GenericScheduler::RegCritical:
3550
+ NumRegCriticalPostRA++;
3551
+ return ;
3552
+ case GenericScheduler::Stall:
3553
+ NumStallPostRA++;
3554
+ return ;
3555
+ case GenericScheduler::Cluster:
3556
+ NumClusterPostRA++;
3557
+ return ;
3558
+ case GenericScheduler::Weak:
3559
+ NumWeakPostRA++;
3560
+ return ;
3561
+ case GenericScheduler::RegMax:
3562
+ NumRegMaxPostRA++;
3563
+ return ;
3564
+ case GenericScheduler::ResourceReduce:
3565
+ NumResourceReducePostRA++;
3566
+ return ;
3567
+ case GenericScheduler::ResourceDemand:
3568
+ NumResourceDemandPostRA++;
3569
+ return ;
3570
+ case GenericScheduler::TopDepthReduce:
3571
+ NumTopDepthReducePostRA++;
3572
+ return ;
3573
+ case GenericScheduler::TopPathReduce:
3574
+ NumTopPathReducePostRA++;
3575
+ return ;
3576
+ case GenericScheduler::BotHeightReduce:
3577
+ NumBotHeightReducePostRA++;
3578
+ return ;
3579
+ case GenericScheduler::BotPathReduce:
3580
+ NumBotPathReducePostRA++;
3581
+ return ;
3582
+ case GenericScheduler::NodeOrder:
3583
+ NumNodeOrderPostRA++;
3584
+ return ;
3585
+ case GenericScheduler::FirstValid:
3586
+ NumFirstValidPostRA++;
3587
+ return ;
3588
+ };
3589
+ } else {
3590
+ if (IsTop)
3591
+ NumTopPreRA++;
3592
+ else
3593
+ NumBotPreRA++;
3594
+
3595
+ switch (Reason) {
3596
+ case GenericScheduler::NoCand:
3597
+ NumNoCandPreRA++;
3598
+ return ;
3599
+ case GenericScheduler::Only1:
3600
+ NumOnly1PreRA++;
3601
+ return ;
3602
+ case GenericScheduler::PhysReg:
3603
+ NumPhysRegPreRA++;
3604
+ return ;
3605
+ case GenericScheduler::RegExcess:
3606
+ NumRegExcessPreRA++;
3607
+ return ;
3608
+ case GenericScheduler::RegCritical:
3609
+ NumRegCriticalPreRA++;
3610
+ return ;
3611
+ case GenericScheduler::Stall:
3612
+ NumStallPreRA++;
3613
+ return ;
3614
+ case GenericScheduler::Cluster:
3615
+ NumClusterPreRA++;
3616
+ return ;
3617
+ case GenericScheduler::Weak:
3618
+ NumWeakPreRA++;
3619
+ return ;
3620
+ case GenericScheduler::RegMax:
3621
+ NumRegMaxPreRA++;
3622
+ return ;
3623
+ case GenericScheduler::ResourceReduce:
3624
+ NumResourceReducePreRA++;
3625
+ return ;
3626
+ case GenericScheduler::ResourceDemand:
3627
+ NumResourceDemandPreRA++;
3628
+ return ;
3629
+ case GenericScheduler::TopDepthReduce:
3630
+ NumTopDepthReducePreRA++;
3631
+ return ;
3632
+ case GenericScheduler::TopPathReduce:
3633
+ NumTopPathReducePreRA++;
3634
+ return ;
3635
+ case GenericScheduler::BotHeightReduce:
3636
+ NumBotHeightReducePreRA++;
3637
+ return ;
3638
+ case GenericScheduler::BotPathReduce:
3639
+ NumBotPathReducePreRA++;
3640
+ return ;
3641
+ case GenericScheduler::NodeOrder:
3642
+ NumNodeOrderPreRA++;
3643
+ return ;
3644
+ case GenericScheduler::FirstValid:
3645
+ NumFirstValidPreRA++;
3646
+ return ;
3647
+ };
3648
+ }
3649
+ llvm_unreachable (" Unknown reason!" );
3436
3650
}
3437
3651
3438
- static void tracePick (const GenericSchedulerBase::SchedCandidate &Cand) {
3439
- tracePick (Cand.Reason , Cand.AtTop );
3652
+ static void tracePick (const GenericSchedulerBase::SchedCandidate &Cand,
3653
+ bool IsPostRA = false ) {
3654
+ tracePick (Cand.Reason , Cand.AtTop , IsPostRA);
3440
3655
}
3441
3656
3442
3657
void GenericScheduler::initialize (ScheduleDAGMI *dag) {
@@ -3862,12 +4077,12 @@ SUnit *GenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
3862
4077
// efficient, but also provides the best heuristics for CriticalPSets.
3863
4078
if (SUnit *SU = Bot.pickOnlyChoice ()) {
3864
4079
IsTopNode = false ;
3865
- tracePick (Only1, false );
4080
+ tracePick (Only1, /* IsTopNode= */ false );
3866
4081
return SU;
3867
4082
}
3868
4083
if (SUnit *SU = Top.pickOnlyChoice ()) {
3869
4084
IsTopNode = true ;
3870
- tracePick (Only1, true );
4085
+ tracePick (Only1, /* IsTopNode= */ true );
3871
4086
return SU;
3872
4087
}
3873
4088
// Set the bottom-up policy based on the state of the current bottom zone and
@@ -4224,12 +4439,12 @@ SUnit *PostGenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
4224
4439
// efficient, but also provides the best heuristics for CriticalPSets.
4225
4440
if (SUnit *SU = Bot.pickOnlyChoice ()) {
4226
4441
IsTopNode = false ;
4227
- tracePick (Only1, false );
4442
+ tracePick (Only1, /* IsTopNode= */ false , /* IsPostRA= */ true );
4228
4443
return SU;
4229
4444
}
4230
4445
if (SUnit *SU = Top.pickOnlyChoice ()) {
4231
4446
IsTopNode = true ;
4232
- tracePick (Only1, true );
4447
+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
4233
4448
return SU;
4234
4449
}
4235
4450
// Set the bottom-up policy based on the state of the current bottom zone and
@@ -4292,7 +4507,7 @@ SUnit *PostGenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
4292
4507
}
4293
4508
4294
4509
IsTopNode = Cand.AtTop ;
4295
- tracePick (Cand);
4510
+ tracePick (Cand, /* IsPostRA= */ true );
4296
4511
return Cand.SU ;
4297
4512
}
4298
4513
@@ -4308,7 +4523,7 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
4308
4523
if (RegionPolicy.OnlyBottomUp ) {
4309
4524
SU = Bot.pickOnlyChoice ();
4310
4525
if (SU) {
4311
- tracePick (Only1, true );
4526
+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
4312
4527
} else {
4313
4528
CandPolicy NoPolicy;
4314
4529
BotCand.reset (NoPolicy);
@@ -4317,14 +4532,14 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
4317
4532
setPolicy (BotCand.Policy , /* IsPostRA=*/ true , Bot, nullptr );
4318
4533
pickNodeFromQueue (Bot, BotCand);
4319
4534
assert (BotCand.Reason != NoCand && " failed to find a candidate" );
4320
- tracePick (BotCand);
4535
+ tracePick (BotCand, /* IsPostRA= */ true );
4321
4536
SU = BotCand.SU ;
4322
4537
}
4323
4538
IsTopNode = false ;
4324
4539
} else if (RegionPolicy.OnlyTopDown ) {
4325
4540
SU = Top.pickOnlyChoice ();
4326
4541
if (SU) {
4327
- tracePick (Only1, true );
4542
+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
4328
4543
} else {
4329
4544
CandPolicy NoPolicy;
4330
4545
TopCand.reset (NoPolicy);
@@ -4333,7 +4548,7 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
4333
4548
setPolicy (TopCand.Policy , /* IsPostRA=*/ true , Top, nullptr );
4334
4549
pickNodeFromQueue (Top, TopCand);
4335
4550
assert (TopCand.Reason != NoCand && " failed to find a candidate" );
4336
- tracePick (TopCand);
4551
+ tracePick (TopCand, /* IsPostRA= */ true );
4337
4552
SU = TopCand.SU ;
4338
4553
}
4339
4554
IsTopNode = true ;
0 commit comments