This is an archive of the discontinued LLVM Phabricator instance.

[llvm-mca] Make Dispatch a subclass of Stage.
ClosedPublic

Authored by mattd on May 16 2018, 3:27 PM.

Details

Summary

The logic of dispatch remains the same, but now DispatchUnit is a Stage (DispatchStage).

This change has the benefit of simplifying the backend runCycle() code.
The same logic applies, but it belongs to different components now. This is just a start,
eventually we will need to remove the call to the DispatchStage in Scheduler.cpp, but
that will be a separate patch. This change is mostly a renaming and moving of existing logic.

This change also encouraged me to remove the Subtarget (STI) member from the
Backend class. That member was used to initialize the other members of Backend
and to eventually call DispatchUnit::dispatch(). Now that we have Stages, we
can eliminate this by instantiating the DispatchStage with everything it needs
at the time of construction (e.g., Subtarget). That change allows us to call
DispatchStage::execute(IR) as we expect to call execute() for all other stages.

Once we add the Stage list (D46907) we can more cleanly call preExecute() on
all of the stages, DispatchStage, will probably wrap cycleEvent() in that
case.

Made some formatting and minor cleanups to README.txt. Some of the text
was re-flowed to stay within 80 cols.

Diff Detail

Repository
rL LLVM

Event Timeline

mattd created this revision.May 16 2018, 3:27 PM
courbet accepted this revision.May 17 2018, 5:21 AM
This revision is now accepted and ready to land.May 17 2018, 5:21 AM

LGTM too.

Thanks Matt.

andreadb accepted this revision.May 17 2018, 9:57 AM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/tools/llvm-mca/Dispatch.h