mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[MCA] Improved debug prints. NFC
llvm-svn: 353852
This commit is contained in:
parent
db8d82f38b
commit
acb3fbc2c0
@ -60,24 +60,13 @@ public:
|
||||
return (Denominator == 1) ? Numerator : (double)Numerator / Denominator;
|
||||
}
|
||||
|
||||
unsigned getNumerator() const { return Numerator; }
|
||||
unsigned getDenominator() const { return Denominator; }
|
||||
|
||||
// Add the components of RHS to this instance. Instead of calculating
|
||||
// the final value here, we keep track of the numerator and denominator
|
||||
// separately, to reduce floating point error.
|
||||
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;
|
||||
}
|
||||
ResourceCycles &operator+=(const ResourceCycles &RHS);
|
||||
};
|
||||
|
||||
/// Populates vector Masks with processor resource masks.
|
||||
|
@ -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';
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user