summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/Scheduler.h
diff options
context:
space:
mode:
authorMatt Davis <Matthew.Davis@sony.com>2018-07-06 18:03:14 +0000
committerMatt Davis <Matthew.Davis@sony.com>2018-07-06 18:03:14 +0000
commit362ea5f2c35ba021959367759899fb92a06a96f9 (patch)
tree9cd55e024ed93ad8df3e723784ec8a6c1963abfb /llvm/tools/llvm-mca/Scheduler.h
parent42b5ef026908953c823b4849ea1b9d3955c5c172 (diff)
downloadbcm5719-llvm-362ea5f2c35ba021959367759899fb92a06a96f9.tar.gz
bcm5719-llvm-362ea5f2c35ba021959367759899fb92a06a96f9.zip
[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 llvm-svn: 336456
Diffstat (limited to 'llvm/tools/llvm-mca/Scheduler.h')
-rw-r--r--llvm/tools/llvm-mca/Scheduler.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/tools/llvm-mca/Scheduler.h b/llvm/tools/llvm-mca/Scheduler.h
index d6da6c08a1c..428fbc01707 100644
--- a/llvm/tools/llvm-mca/Scheduler.h
+++ b/llvm/tools/llvm-mca/Scheduler.h
@@ -16,6 +16,7 @@
#define LLVM_TOOLS_LLVM_MCA_SCHEDULER_H
#include "HWEventListener.h"
+#include "HardwareUnit.h"
#include "Instruction.h"
#include "LSUnit.h"
#include "RetireControlUnit.h"
@@ -401,7 +402,7 @@ public:
/// issued to a (one or more) pipeline(s). This event also causes an instruction
/// state transition (i.e. from state IS_READY, to state IS_EXECUTING).
/// An Instruction leaves the IssuedQueue when it reaches the write-back stage.
-class Scheduler {
+class Scheduler : public HardwareUnit {
const llvm::MCSchedModel &SM;
// Hardware resources that are managed by this scheduler.
OpenPOWER on IntegriCloud