[PATCH] D47536: [MCSchedule] Add the ability to correctly compute the latency and throughput information for MCInst.

Andrea Di Biagio via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 30 08:08:52 PDT 2018


andreadb created this revision.
andreadb added reviewers: RKSimon, filcab, mattd.

This patch is required by https://reviews.llvm.org/D47374. to avoid regressing a couple of (x86 btver2 specific) `-print-schedule` tests.

Scheduling models have recently gained the ability to resolve variant scheduling classes associated with MCInst objects. Before, models were only able to resolve a variant scheduling class from a MachineInstr object.

Patch https://reviews.llvm.org/D47374 exposes that new knowledge to llvm-mca; it also teaches to the x86 target (model btver2) how to correctly compute the latency profile for the so-called "zero latency vector xor idioms".
However, before https://reviews.llvm.org/D47374 is committed, we need to apply some changes to the scheduling model.
This patch extends the MCSchedModel API with new methods that can be used to obtain the latency and reciprocal througput information from an MCInst. These new methods are meant to be used by llc when flag `-print-schedule` is specified. There are cases where tests contain inline assembly blocks. Inline assembly is parsed end emitted as a sequence of MCInst by the assembly printer. That means, the print-schedule functionality must be able to query the latency/rthroughput associated with MCInst too.
If we don't do this, then we would start losing "-print-schedule" test coverage as soon as the new xor idioms introduced by https://reviews.llvm.org/D47374.

The tablegen SubtargetEmitter changes are required to teach the TargetSubtargetInfo object how to query the latency profile of an MCInst. Note that this should really have been part of patch 2/3 (i.e. r333286). To avoid code duplication, the logic that knows how to "resolve" a variant scheduling classes from a MCInst, is moved to a common place in MC. That logic is shared by the new  "resolveVariantSchedClass" methods redefined in override by the tablegen'd GenSubtargetInfo classes.

Please let me know if okay to commit.

Thanks,
Andrea


https://reviews.llvm.org/D47536

Files:
  include/llvm/CodeGen/TargetSchedule.h
  include/llvm/MC/MCSchedule.h
  lib/CodeGen/TargetSchedule.cpp
  lib/CodeGen/TargetSubtargetInfo.cpp
  lib/MC/MCSchedule.cpp
  utils/TableGen/SubtargetEmitter.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47536.149115.patch
Type: text/x-patch
Size: 9331 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180530/7b160e1b/attachment.bin>


More information about the llvm-commits mailing list