summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-mca/Backend.h
diff options
context:
space:
mode:
authorAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-08 16:08:43 +0000
committerAndrea Di Biagio <Andrea_DiBiagio@sn.scee.net>2018-03-08 16:08:43 +0000
commit8af3fe81eb94e71c4921ac246feaa76c47ecbf39 (patch)
tree7284415a8ba7bdbcfd4eb4c8c2584e9b74ca2fa4 /llvm/tools/llvm-mca/Backend.h
parentb312b1396069203bb1cfd64a5c4c903b05d3cd6a (diff)
downloadbcm5719-llvm-8af3fe81eb94e71c4921ac246feaa76c47ecbf39.tar.gz
bcm5719-llvm-8af3fe81eb94e71c4921ac246feaa76c47ecbf39.zip
[llvm-mca] Unify the API for the various views. NFCI
This allows the customization of the performance report. Users can specify their own custom sequence of views. Each view contributes a portion of the performance report generated by the BackendPrinter. Internally, class BackendPrinter keeps a sequence of views; views are printed out in sequence when method 'printReport()' is called. This patch addresses one of the two review comments from Clement in D43951. llvm-svn: 327018
Diffstat (limited to 'llvm/tools/llvm-mca/Backend.h')
-rw-r--r--llvm/tools/llvm-mca/Backend.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/tools/llvm-mca/Backend.h b/llvm/tools/llvm-mca/Backend.h
index 6e2db08227e..5d1df1d875a 100644
--- a/llvm/tools/llvm-mca/Backend.h
+++ b/llvm/tools/llvm-mca/Backend.h
@@ -48,7 +48,7 @@ class Backend {
std::unique_ptr<InstrBuilder> IB;
std::unique_ptr<Scheduler> HWS;
std::unique_ptr<DispatchUnit> DU;
- std::unique_ptr<SourceMgr> SM;
+ SourceMgr &SM;
unsigned Cycles;
llvm::DenseMap<unsigned, std::unique_ptr<Instruction>> Instructions;
@@ -58,7 +58,7 @@ class Backend {
public:
Backend(const llvm::MCSubtargetInfo &Subtarget, const llvm::MCInstrInfo &MCII,
- const llvm::MCRegisterInfo &MRI, std::unique_ptr<SourceMgr> Source,
+ const llvm::MCRegisterInfo &MRI, SourceMgr &Source,
unsigned DispatchWidth = 0, unsigned RegisterFileSize = 0,
unsigned MaxRetirePerCycle = 0, unsigned LoadQueueSize = 0,
unsigned StoreQueueSize = 0, bool AssumeNoAlias = false)
@@ -69,17 +69,17 @@ public:
DU(llvm::make_unique<DispatchUnit>(
this, MRI, Subtarget.getSchedModel().MicroOpBufferSize,
RegisterFileSize, MaxRetirePerCycle, DispatchWidth, HWS.get())),
- SM(std::move(Source)), Cycles(0) {
+ SM(Source), Cycles(0) {
IB = llvm::make_unique<InstrBuilder>(MCII, getProcResourceMasks());
}
void run() {
- while (SM->hasNext() || !DU->isRCUEmpty())
+ while (SM.hasNext() || !DU->isRCUEmpty())
runCycle(Cycles++);
}
- unsigned getNumIterations() const { return SM->getNumIterations(); }
- unsigned getNumInstructions() const { return SM->size(); }
+ unsigned getNumIterations() const { return SM.getNumIterations(); }
+ unsigned getNumInstructions() const { return SM.size(); }
unsigned getNumCycles() const { return Cycles; }
unsigned getTotalRegisterMappingsCreated() const {
return DU->getTotalRegisterMappingsCreated();
@@ -114,14 +114,14 @@ public:
}
const llvm::MCInst &getMCInstFromIndex(unsigned Index) const {
- return SM->getMCInstFromIndex(Index);
+ return SM.getMCInstFromIndex(Index);
}
const InstrDesc &getInstrDesc(const llvm::MCInst &Inst) const {
return IB->getOrCreateInstrDesc(STI, Inst);
}
- const SourceMgr &getSourceMgr() const { return *SM; }
+ const SourceMgr &getSourceMgr() const { return SM; }
void addEventListener(HWEventListener *Listener);
void notifyCycleBegin(unsigned Cycle);
OpenPOWER on IntegriCloud