[llvm][Hexagon] Generalize VLIWResourceModel, VLIWMachineScheduler, and ConvergingVLI...
authorJames Nagurne <j-nagurne@ti.com>
Fri, 22 Oct 2021 22:08:16 +0000 (17:08 -0500)
committerJames Nagurne <j-nagurne@ti.com>
Mon, 6 Dec 2021 22:23:48 +0000 (16:23 -0600)
commitcc3bb85580189d4a004cfd9bd2d6286cd1c1169f
tree664974815e74625761d52f74ed9017c73c659305
parentf527fdf51e7763b516f5d4ebc8c4ffb8808cd281
[llvm][Hexagon] Generalize VLIWResourceModel, VLIWMachineScheduler, and ConvergingVLIWScheduler

The Pre-RA VLIWMachineScheduler used by Hexagon is a relatively generic
implementation that would make sense to use on other VLIW targets.

This commit lifts those classes into their own header/source file with the
root VLIWMachineScheduler. I chose this path rather than adding the
strategy et al. into MachineScheduler to avoid bloating the file with other
implementations.

Target-specific behaviors have been captured and replicated through
function overloads.

- Added an overloadable DFAPacketizer creation member function. This is
  mainly done for our downstream, which has the capability to override
  the DFAPacketizer with custom implementations. This is an upstreamable
  TODO on our end. Currently, it always returns the result of
  TargetInstrInfo::CreateTargetScheduleState
- Added an extra helper which returns the number of instructions in the
  current packet. This is used in our downstream, and may be useful
  elsewhere.
- Placed the priority heuristic values into the ConvergingVLIWscheduler
  class instead of defining them as local statics in the implementation
- Added a overridable helper in ConvergingVLIWScheduler so that targets
  can create their own VLIWResourceModel

Differential Revision: https://reviews.llvm.org/D113150
llvm/include/llvm/CodeGen/MachineScheduler.h
llvm/include/llvm/CodeGen/VLIWMachineScheduler.h [new file with mode: 0644]
llvm/lib/CodeGen/CMakeLists.txt
llvm/lib/CodeGen/MachineScheduler.cpp
llvm/lib/CodeGen/VLIWMachineScheduler.cpp [new file with mode: 0644]
llvm/lib/Target/Hexagon/HexagonMachineScheduler.cpp
llvm/lib/Target/Hexagon/HexagonMachineScheduler.h
llvm/lib/Target/Hexagon/HexagonTargetMachine.cpp