diff options
author | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2019-02-12 16:18:57 +0000 |
---|---|---|
committer | Andrea Di Biagio <Andrea_DiBiagio@sn.scee.net> | 2019-02-12 16:18:57 +0000 |
commit | d30fff9a90492156656b854e0cdbc570934e8d9d (patch) | |
tree | 7c5ddc1b1deaaefdaaf8e6be9f97286d4d399e71 /llvm/lib/MCA | |
parent | 015cc0f0fabc29226671fa64a446fed639062350 (diff) | |
download | bcm5719-llvm-d30fff9a90492156656b854e0cdbc570934e8d9d.tar.gz bcm5719-llvm-d30fff9a90492156656b854e0cdbc570934e8d9d.zip |
[MCA] Improved debug prints. NFC
llvm-svn: 353852
Diffstat (limited to 'llvm/lib/MCA')
-rw-r--r-- | llvm/lib/MCA/Stages/ExecuteStage.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/MCA/Support.cpp | 21 |
2 files changed, 21 insertions, 3 deletions
diff --git a/llvm/lib/MCA/Stages/ExecuteStage.cpp b/llvm/lib/MCA/Stages/ExecuteStage.cpp index 2060fcdbe39..9e0bd26e6d0 100644 --- a/llvm/lib/MCA/Stages/ExecuteStage.cpp +++ b/llvm/lib/MCA/Stages/ExecuteStage.cpp @@ -188,9 +188,10 @@ void ExecuteStage::notifyInstructionIssued( LLVM_DEBUG({ dbgs() << "[E] Instruction Issued: #" << IR << '\n'; for (const std::pair<ResourceRef, ResourceCycles> &Resource : Used) { + assert(Resource.second.getDenominator() == 1 && "Invalid cycles!"); dbgs() << "[E] Resource Used: [" << Resource.first.first << '.' << Resource.first.second << "], "; - dbgs() << "cycles: " << Resource.second << '\n'; + dbgs() << "cycles: " << Resource.second.getNumerator() << '\n'; } }); diff --git a/llvm/lib/MCA/Support.cpp b/llvm/lib/MCA/Support.cpp index e11062f4d72..ce1f0f6f211 100644 --- a/llvm/lib/MCA/Support.cpp +++ b/llvm/lib/MCA/Support.cpp @@ -20,6 +20,22 @@ namespace mca { #define DEBUG_TYPE "llvm-mca" +ResourceCycles &ResourceCycles::operator+=(const ResourceCycles &RHS) { + if (Denominator == RHS.Denominator) + Numerator += RHS.Numerator; + else { + // Create a common denominator for LHS and RHS by calculating the least + // common multiple from the GCD. + unsigned GCD = GreatestCommonDivisor64(Denominator, RHS.Denominator); + unsigned LCM = (Denominator * RHS.Denominator) / GCD; + unsigned LHSNumerator = Numerator * (LCM / Denominator); + unsigned RHSNumerator = RHS.Numerator * (LCM / RHS.Denominator); + Numerator = LHSNumerator + RHSNumerator; + Denominator = LCM; + } + return *this; +} + void computeProcResourceMasks(const MCSchedModel &SM, MutableArrayRef<uint64_t> Masks) { unsigned ProcResourceID = 0; @@ -56,8 +72,9 @@ void computeProcResourceMasks(const MCSchedModel &SM, << "\n"); for (unsigned I = 0, E = SM.getNumProcResourceKinds(); I < E; ++I) { const MCProcResourceDesc &Desc = *SM.getProcResource(I); - LLVM_DEBUG(dbgs() << '[' << I << "] " << Desc.Name << " - " << Masks[I] - << '\n'); + LLVM_DEBUG(dbgs() << '[' << format_decimal(I,2) << "] " << " - " + << format_hex(Masks[I],16) << " - " + << Desc.Name << '\n'); } #endif } |