OSDN Git Service

[llvm-mca] Add HardwareUnit and Context classes.
authorMatt Davis <Matthew.Davis@sony.com>
Fri, 6 Jul 2018 18:03:14 +0000 (18:03 +0000)
committerMatt Davis <Matthew.Davis@sony.com>
Fri, 6 Jul 2018 18:03:14 +0000 (18:03 +0000)
commit73b3f8bb2de6bb98635880b4cdc636f080d40425
tree88b4c36c9a41b391533ab37fa69e7116da1eb5dc
parent80e7ea0a47d867c27fc9651ceb8e9eb70f8246a5
[llvm-mca] Add HardwareUnit and Context classes.

This patch moves the construction of the default backend from llvm-mca.cpp and
into mca::Context. The Context class is responsible for holding ownership of
the simulated hardware components. These components are subclasses of
HardwareUnit. Right now the HardwareUnit is pretty bare-bones, but eventually
we might want to add some common functionality across all hardware components,
such as isReady() or something similar.

I have a feeling this patch will probably need some updates, but it's a start.
One thing I am not particularly fond of is the rather large interface for
createDefaultPipeline. That convenience routine takes a rather large set of
inputs from the llvm-mca driver, where many of those inputs are generated via
command line options.

One item I think we might want to change is the separating of ownership of
hardware components (owned by the context) and the pipeline (which owns
Stages). In short, a Pipeline owns Stages, a Context (currently) owns hardware.
The Pipeline's Stages make use of the components, and thus there is a lifetime
dependency generated. The components must outlive the pipeline. We could solve
this by having the Context also own the Pipeline, and not return a
unique_ptr<Pipeline>. Now that I think about it, I like that idea more.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336456 91177308-0d34-0410-b5e6-96231b3b80d8
tools/llvm-mca/CMakeLists.txt
tools/llvm-mca/Context.cpp [new file with mode: 0644]
tools/llvm-mca/Context.h [new file with mode: 0644]
tools/llvm-mca/HardwareUnit.cpp [new file with mode: 0644]
tools/llvm-mca/HardwareUnit.h [new file with mode: 0644]
tools/llvm-mca/RegisterFile.h
tools/llvm-mca/RetireControlUnit.h
tools/llvm-mca/Scheduler.h
tools/llvm-mca/llvm-mca.cpp