mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 03:33:20 +01:00
blockfreq: Separate unwrapLoops() from finalizeMetrics()
<rdar://problem/14292693> llvm-svn: 207185
This commit is contained in:
parent
9f46ab15a9
commit
20bb8bb185
@ -1141,10 +1141,13 @@ public:
|
||||
/// \brief Package up a loop.
|
||||
void packageLoop(LoopData &Loop);
|
||||
|
||||
/// \brief Unwrap loops.
|
||||
void unwrapLoops();
|
||||
|
||||
/// \brief Finalize frequency metrics.
|
||||
///
|
||||
/// Unwraps loop packages, calculates final frequencies, and cleans up
|
||||
/// no-longer-needed data structures.
|
||||
/// Calculates final frequencies and cleans up no-longer-needed data
|
||||
/// structures.
|
||||
void finalizeMetrics();
|
||||
|
||||
/// \brief Clear all memory.
|
||||
@ -1434,6 +1437,7 @@ void BlockFrequencyInfoImpl<BT>::doFunction(const FunctionT *F,
|
||||
// the full function.
|
||||
computeMassInLoops();
|
||||
computeMassInFunction();
|
||||
unwrapLoops();
|
||||
finalizeMetrics();
|
||||
}
|
||||
|
||||
|
@ -846,20 +846,24 @@ static void unwrapLoopPackage(BlockFrequencyInfoImplBase &BFI,
|
||||
}
|
||||
}
|
||||
|
||||
void BlockFrequencyInfoImplBase::finalizeMetrics() {
|
||||
void BlockFrequencyInfoImplBase::unwrapLoops() {
|
||||
// Set initial frequencies from loop-local masses.
|
||||
for (size_t Index = 0; Index < Working.size(); ++Index)
|
||||
Freqs[Index].Floating = Working[Index].Mass.toFloat();
|
||||
|
||||
for (size_t Index = 0; Index < Working.size(); ++Index) {
|
||||
if (Working[Index].isLoopHeader())
|
||||
unwrapLoopPackage(*this, BlockNode(Index));
|
||||
}
|
||||
}
|
||||
|
||||
void BlockFrequencyInfoImplBase::finalizeMetrics() {
|
||||
// Unwrap loop packages in reverse post-order, tracking min and max
|
||||
// frequencies.
|
||||
auto Min = Float::getLargest();
|
||||
auto Max = Float::getZero();
|
||||
for (size_t Index = 0; Index < Working.size(); ++Index) {
|
||||
if (Working[Index].isLoopHeader())
|
||||
unwrapLoopPackage(*this, BlockNode(Index));
|
||||
|
||||
// Update max scale.
|
||||
// Update min/max scale.
|
||||
Min = std::min(Min, Freqs[Index].Floating);
|
||||
Max = std::max(Max, Freqs[Index].Floating);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user