@@ -84,6 +84,97 @@ STATISTIC(NumInstrsScheduledPostRA,
8484 " Number of instructions scheduled by post-RA scheduler" );
8585STATISTIC (NumClustered, " Number of load/store pairs clustered" );
8686
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+
87178namespace llvm {
88179
89180cl::opt<MISched::Direction> PreRADirection (
@@ -3430,13 +3521,137 @@ bool tryLatency(GenericSchedulerBase::SchedCandidate &TryCand,
34303521}
34313522} // end namespace llvm
34323523
3433- static void tracePick (GenericSchedulerBase::CandReason Reason, bool IsTop) {
3524+ static void tracePick (GenericSchedulerBase::CandReason Reason, bool IsTop,
3525+ bool IsPostRA = false ) {
34343526 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!" );
34363650}
34373651
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);
34403655}
34413656
34423657void GenericScheduler::initialize (ScheduleDAGMI *dag) {
@@ -3862,12 +4077,12 @@ SUnit *GenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
38624077 // efficient, but also provides the best heuristics for CriticalPSets.
38634078 if (SUnit *SU = Bot.pickOnlyChoice ()) {
38644079 IsTopNode = false ;
3865- tracePick (Only1, false );
4080+ tracePick (Only1, /* IsTopNode= */ false );
38664081 return SU;
38674082 }
38684083 if (SUnit *SU = Top.pickOnlyChoice ()) {
38694084 IsTopNode = true ;
3870- tracePick (Only1, true );
4085+ tracePick (Only1, /* IsTopNode= */ true );
38714086 return SU;
38724087 }
38734088 // Set the bottom-up policy based on the state of the current bottom zone and
@@ -4224,12 +4439,12 @@ SUnit *PostGenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
42244439 // efficient, but also provides the best heuristics for CriticalPSets.
42254440 if (SUnit *SU = Bot.pickOnlyChoice ()) {
42264441 IsTopNode = false ;
4227- tracePick (Only1, false );
4442+ tracePick (Only1, /* IsTopNode= */ false , /* IsPostRA= */ true );
42284443 return SU;
42294444 }
42304445 if (SUnit *SU = Top.pickOnlyChoice ()) {
42314446 IsTopNode = true ;
4232- tracePick (Only1, true );
4447+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
42334448 return SU;
42344449 }
42354450 // Set the bottom-up policy based on the state of the current bottom zone and
@@ -4292,7 +4507,7 @@ SUnit *PostGenericScheduler::pickNodeBidirectional(bool &IsTopNode) {
42924507 }
42934508
42944509 IsTopNode = Cand.AtTop ;
4295- tracePick (Cand);
4510+ tracePick (Cand, /* IsPostRA= */ true );
42964511 return Cand.SU ;
42974512}
42984513
@@ -4308,7 +4523,7 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
43084523 if (RegionPolicy.OnlyBottomUp ) {
43094524 SU = Bot.pickOnlyChoice ();
43104525 if (SU) {
4311- tracePick (Only1, true );
4526+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
43124527 } else {
43134528 CandPolicy NoPolicy;
43144529 BotCand.reset (NoPolicy);
@@ -4317,14 +4532,14 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
43174532 setPolicy (BotCand.Policy , /* IsPostRA=*/ true , Bot, nullptr );
43184533 pickNodeFromQueue (Bot, BotCand);
43194534 assert (BotCand.Reason != NoCand && " failed to find a candidate" );
4320- tracePick (BotCand);
4535+ tracePick (BotCand, /* IsPostRA= */ true );
43214536 SU = BotCand.SU ;
43224537 }
43234538 IsTopNode = false ;
43244539 } else if (RegionPolicy.OnlyTopDown ) {
43254540 SU = Top.pickOnlyChoice ();
43264541 if (SU) {
4327- tracePick (Only1, true );
4542+ tracePick (Only1, /* IsTopNode= */ true , /* IsPostRA= */ true );
43284543 } else {
43294544 CandPolicy NoPolicy;
43304545 TopCand.reset (NoPolicy);
@@ -4333,7 +4548,7 @@ SUnit *PostGenericScheduler::pickNode(bool &IsTopNode) {
43334548 setPolicy (TopCand.Policy , /* IsPostRA=*/ true , Top, nullptr );
43344549 pickNodeFromQueue (Top, TopCand);
43354550 assert (TopCand.Reason != NoCand && " failed to find a candidate" );
4336- tracePick (TopCand);
4551+ tracePick (TopCand, /* IsPostRA= */ true );
43374552 SU = TopCand.SU ;
43384553 }
43394554 IsTopNode = true ;
0 commit comments