diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-03-23 17:36:07 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2018-03-23 17:36:07 +0000 |
commit | 51dba7d3ab5e8790e04114ece7df70977324d9e2 (patch) | |
tree | 8127b14c7950725d7465a9089514032aa664e395 /llvm/tools/llvm-mca/Scheduler.cpp | |
parent | c244a15801b2f9a679c188cd13e101a9cfbd2b9c (diff) | |
download | bcm5719-llvm-51dba7d3ab5e8790e04114ece7df70977324d9e2.tar.gz bcm5719-llvm-51dba7d3ab5e8790e04114ece7df70977324d9e2.zip |
[llvm-mca] Make the resource cost a double.
This is done in preparation for the fix for PR36874.
The number of cycles consumed for each pipe is now a double quantity. This
allows reuse of the resource pressure view to print out instruction tables.
llvm-svn: 328335
Diffstat (limited to 'llvm/tools/llvm-mca/Scheduler.cpp')
-rw-r--r-- | llvm/tools/llvm-mca/Scheduler.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/tools/llvm-mca/Scheduler.cpp b/llvm/tools/llvm-mca/Scheduler.cpp index 08ddf6ebe7d..05656246bfe 100644 --- a/llvm/tools/llvm-mca/Scheduler.cpp +++ b/llvm/tools/llvm-mca/Scheduler.cpp @@ -11,9 +11,9 @@ // //===----------------------------------------------------------------------===// +#include "Scheduler.h" #include "Backend.h" #include "HWEventListener.h" -#include "Scheduler.h" #include "Support.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" @@ -180,7 +180,7 @@ bool ResourceManager::mustIssueImmediately(const InstrDesc &Desc) { void ResourceManager::issueInstruction( unsigned Index, const InstrDesc &Desc, - SmallVectorImpl<std::pair<ResourceRef, unsigned>> &Pipes) { + SmallVectorImpl<std::pair<ResourceRef, double>> &Pipes) { for (const std::pair<uint64_t, ResourceUsage> &R : Desc.Resources) { const CycleSegment &CS = R.second.CS; if (!CS.size()) { @@ -196,7 +196,8 @@ void ResourceManager::issueInstruction( // Replace the resource mask with a valid processor resource index. const ResourceState &RS = *Resources[Pipe.first]; Pipe.first = RS.getProcResourceID(); - Pipes.emplace_back(std::pair<ResourceRef, unsigned>(Pipe, CS.size())); + Pipes.emplace_back( + std::pair<ResourceRef, double>(Pipe, static_cast<double>(CS.size()))); } else { assert((countPopulation(R.first) > 1) && "Expected a group!"); // Mark this group as reserved. @@ -338,7 +339,7 @@ void Scheduler::issueInstruction(Instruction &IS, unsigned InstrIndex) { // two resources). We use a small vector here, and conservatively // initialize its capacity to 4. This should address the majority of // the cases. - SmallVector<std::pair<ResourceRef, unsigned>, 4> UsedResources; + SmallVector<std::pair<ResourceRef, double>, 4> UsedResources; Resources->issueInstruction(InstrIndex, D, UsedResources); // Notify the instruction that it started executing. // This updates the internal state of each write. @@ -417,7 +418,7 @@ void Scheduler::updateIssuedQueue() { } void Scheduler::notifyInstructionIssued( - unsigned Index, ArrayRef<std::pair<ResourceRef, unsigned>> Used) { + unsigned Index, ArrayRef<std::pair<ResourceRef, double>> Used) { DEBUG({ dbgs() << "[E] Instruction Issued: " << Index << '\n'; for (const std::pair<ResourceRef, unsigned> &Resource : Used) { |