mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-04 09:37:20 +00:00
blockfreq: Use a pointer for ContainingLoop too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
92897fda32
commit
40a483e980
@ -958,16 +958,25 @@ public:
|
||||
/// \brief Index of loop information.
|
||||
struct WorkingData {
|
||||
LoopData *Loop; ///< The loop this block is the header of.
|
||||
BlockNode ContainingLoop; ///< The block whose loop this block is inside.
|
||||
bool IsPackaged; ///< Has ContainingLoop been packaged up?
|
||||
LoopData *ContainingLoop; ///< The block whose loop this block is inside.
|
||||
BlockMass Mass; ///< Mass distribution from the entry block.
|
||||
|
||||
WorkingData() : Loop(nullptr), IsPackaged(false) {}
|
||||
WorkingData() : Loop(nullptr), ContainingLoop(nullptr) {}
|
||||
|
||||
bool hasLoopHeader() const { return ContainingLoop.isValid(); }
|
||||
bool hasLoopHeader() const { return ContainingLoop; }
|
||||
bool isLoopHeader() const { return Loop; }
|
||||
|
||||
/// \brief Has this block's loop been packaged up?
|
||||
BlockNode getContainingHeader() const {
|
||||
if (ContainingLoop)
|
||||
return ContainingLoop->Header;
|
||||
return BlockNode();
|
||||
}
|
||||
|
||||
/// \brief Has ContainingLoop been packaged up?
|
||||
bool isPackaged() const {
|
||||
return ContainingLoop && ContainingLoop->IsPackaged;
|
||||
}
|
||||
/// \brief Has Loop been packaged up?
|
||||
bool isAPackage() const { return Loop && Loop->IsPackaged; }
|
||||
};
|
||||
|
||||
@ -1041,7 +1050,7 @@ public:
|
||||
/// \brief Loop data: see initializeLoops().
|
||||
std::vector<WorkingData> Working;
|
||||
|
||||
/// \brief Indexed information about packaged loops.
|
||||
/// \brief Indexed information about loops.
|
||||
std::vector<std::unique_ptr<LoopData>> PackagedLoops;
|
||||
|
||||
/// \brief Add all edges out of a packaged loop to the distribution.
|
||||
@ -1452,7 +1461,7 @@ template <class BT> void BlockFrequencyInfoImpl<BT>::initializeLoops() {
|
||||
const auto &HeaderData = Working[Header.Index];
|
||||
assert(HeaderData.isLoopHeader());
|
||||
|
||||
Working[Index].ContainingLoop = Header;
|
||||
Working[Index].ContainingLoop = HeaderData.Loop;
|
||||
HeaderData.Loop->Members.push_back(Index);
|
||||
DEBUG(dbgs() << " - loop = " << getBlockName(Header)
|
||||
<< ": member = " << getBlockName(Index) << "\n");
|
||||
|
@ -630,11 +630,11 @@ static void cleanup(BlockFrequencyInfoImplBase &BFI) {
|
||||
static BlockNode getPackagedNode(const BlockFrequencyInfoImplBase &BFI,
|
||||
const BlockNode &Node) {
|
||||
assert(Node.isValid());
|
||||
if (!BFI.Working[Node.Index].IsPackaged)
|
||||
if (!BFI.Working[Node.Index].isPackaged())
|
||||
return Node;
|
||||
if (!BFI.Working[Node.Index].ContainingLoop.isValid())
|
||||
if (!BFI.Working[Node.Index].isAPackage())
|
||||
return Node;
|
||||
return getPackagedNode(BFI, BFI.Working[Node.Index].ContainingLoop);
|
||||
return getPackagedNode(BFI, BFI.Working[Node.Index].getContainingHeader());
|
||||
}
|
||||
|
||||
/// \brief Get the appropriate mass for a possible pseudo-node loop package.
|
||||
@ -645,7 +645,7 @@ static BlockNode getPackagedNode(const BlockFrequencyInfoImplBase &BFI,
|
||||
static BlockMass &getPackageMass(BlockFrequencyInfoImplBase &BFI,
|
||||
const BlockNode &Node) {
|
||||
assert(Node.isValid());
|
||||
assert(!BFI.Working[Node.Index].IsPackaged);
|
||||
assert(!BFI.Working[Node.Index].isPackaged());
|
||||
if (!BFI.Working[Node.Index].isAPackage())
|
||||
return BFI.Working[Node.Index].Mass;
|
||||
|
||||
@ -681,7 +681,7 @@ void BlockFrequencyInfoImplBase::addToDist(Distribution &Dist,
|
||||
BlockNode Resolved = getPackagedNode(*this, Succ);
|
||||
assert(Resolved != LoopHead);
|
||||
|
||||
if (Working[Resolved.Index].ContainingLoop != LoopHead) {
|
||||
if (Working[Resolved.Index].getContainingHeader() != LoopHead) {
|
||||
DEBUG(debugSuccessor(" exit ", Resolved));
|
||||
Dist.addExit(Resolved, Weight);
|
||||
return;
|
||||
@ -746,10 +746,10 @@ void BlockFrequencyInfoImplBase::packageLoop(const BlockNode &LoopHead) {
|
||||
DEBUG(dbgs() << "packaging-loop: " << getBlockName(LoopHead) << "\n");
|
||||
auto &PackagedLoop = getLoopPackage(LoopHead);
|
||||
PackagedLoop.IsPackaged = true;
|
||||
for (const BlockNode &M : PackagedLoop.Members) {
|
||||
DEBUG(dbgs() << " - node: " << getBlockName(M.Index) << "\n");
|
||||
Working[M.Index].IsPackaged = true;
|
||||
}
|
||||
DEBUG(for (const BlockNode &M
|
||||
: PackagedLoop.Members) {
|
||||
dbgs() << " - node: " << getBlockName(M.Index) << "\n";
|
||||
});
|
||||
}
|
||||
|
||||
void BlockFrequencyInfoImplBase::distributeMass(const BlockNode &Source,
|
||||
|
Loading…
x
Reference in New Issue
Block a user