[PATCH] D51160: Adjust MIScheduler to use ProcResource counts

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 02:26:59 PDT 2018


chill added inline comments.


================
Comment at: lib/CodeGen/MachineScheduler.cpp:1937
+/// scheduled.  Returns (NextCycle, InstanceIDAssignedTo).
+std::pair<unsigned, unsigned> SchedBoundary::
+getNextResourceCycle(unsigned PIdx, unsigned ResCount, unsigned Cycles) {
----------------
Jackson wrote:
> chill wrote:
> > I would write it like:
> > 
> > 
> > ```
> > /// Compute the next cycle at which the given processor resource can be
> > /// scheduled.  Returns (NextCycle, InstanceIDAssignedTo).
> > std::pair<unsigned, unsigned> SchedBoundary::
> > getNextResourceCycle(unsigned PIdx, unsigned ResCount, unsigned Cycles) {
> >   unsigned MinNextUnreserved = InvalidCycle;
> >   unsigned InstanceID = 0;
> >   unsigned StartIndex = ProcessorResourceList[PIdx];
> >   unsigned NumUnits = SchedModel->getProcResource(PIdx)->NumUnits;
> > 
> >   for (unsigned I = StartIndex, E = StartIndex + NumUnits;  I < E; ++I) {
> >     unsigned NextUnreserved =  getNextResourceCycleByInstance(I, Cycles);
> >     if (NextUnreserved < MinNextUnreserved) {
> >         InstanceID = I;
> >         MinNextUnreserved = NextUnreserved;
> >       }
> >   }
> >   return std::make_pair(MinNextUnreserved, InstanceID);
> > }
> > ```
> > 
> > but YMMV.
> Where does `InvalidCycle` come from here?
line 1817


Repository:
  rL LLVM

https://reviews.llvm.org/D51160





More information about the llvm-commits mailing list