[MC][Tablegen] Allow models to describe the retire control unit for llvm-mca.
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 5 Apr 2018 15:41:41 +0000 (15:41 +0000)
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>
Thu, 5 Apr 2018 15:41:41 +0000 (15:41 +0000)
commitc74ad502cecf221e2cbfed86f79a93155247760a
treea8803caa215d0107dad7d27842c2fe9d6b4709a3
parent2204520e49581352227091f9f052ff708ae1398b
[MC][Tablegen] Allow models to describe the retire control unit for llvm-mca.

This patch adds the ability to describe properties of the hardware retire
control unit.

Tablegen class RetireControlUnit has been added for this purpose (see
TargetSchedule.td).

A RetireControlUnit specifies the size of the reorder buffer, as well as the
maximum number of opcodes that can be retired every cycle.

A zero (or negative) value for the reorder buffer size means: "the size is
unknown". If the size is unknown, then llvm-mca defaults it to the value of
field SchedMachineModel::MicroOpBufferSize.  A zero or negative number of
opcodes retired per cycle means: "there is no restriction on the number of
instructions that can be retired every cycle".

Models can optionally specify an instance of RetireControlUnit. There can only
be up-to one RetireControlUnit definition per scheduling model.

Information related to the RCU (RetireControlUnit) is stored in (two new fields
of) MCExtraProcessorInfo.  llvm-mca loads that information when it initializes
the DispatchUnit / RetireControlUnit (see Dispatch.h/Dispatch.cpp).

This patch fixes PR36661.

Differential Revision: https://reviews.llvm.org/D45259

llvm-svn: 329304
12 files changed:
llvm/include/llvm/MC/MCSchedule.h
llvm/include/llvm/Target/TargetSchedule.td
llvm/lib/Target/X86/X86ScheduleBtVer2.td
llvm/test/tools/llvm-mca/X86/BtVer2/dot-product.s
llvm/test/tools/llvm-mca/X86/BtVer2/pipes-fpu.s
llvm/test/tools/llvm-mca/X86/BtVer2/register-files-5.s
llvm/tools/llvm-mca/Backend.h
llvm/tools/llvm-mca/Dispatch.cpp
llvm/tools/llvm-mca/Dispatch.h
llvm/utils/TableGen/CodeGenSchedule.cpp
llvm/utils/TableGen/CodeGenSchedule.h
llvm/utils/TableGen/SubtargetEmitter.cpp