forked from OSchip/llvm-project
Move internal enum out of class declaration [NFC]
llvm-svn: 270054
This commit is contained in:
parent
ffd222f2d6
commit
469db6a247
|
@ -203,13 +203,6 @@ private:
|
||||||
AliasAnalysis *AA;
|
AliasAnalysis *AA;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// @brief Enum for coloring BBs in Region.
|
|
||||||
///
|
|
||||||
/// WHITE - Unvisited BB in DFS walk.
|
|
||||||
/// GREY - BBs which are currently on the DFS stack for processing.
|
|
||||||
/// BLACK - Visited and completely processed BB.
|
|
||||||
enum Color { WHITE, GREY, BLACK };
|
|
||||||
|
|
||||||
/// @brief Map to remember detection contexts for all regions.
|
/// @brief Map to remember detection contexts for all regions.
|
||||||
using DetectionContextMapTy = DenseMap<BBPair, DetectionContext>;
|
using DetectionContextMapTy = DenseMap<BBPair, DetectionContext>;
|
||||||
mutable DetectionContextMapTy DetectionContextMap;
|
mutable DetectionContextMapTy DetectionContextMap;
|
||||||
|
|
|
@ -1380,6 +1380,13 @@ void ScopDetection::emitMissedRemarks(const Function &F) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @brief Enum for coloring BBs in Region.
|
||||||
|
///
|
||||||
|
/// WHITE - Unvisited BB in DFS walk.
|
||||||
|
/// GREY - BBs which are currently on the DFS stack for processing.
|
||||||
|
/// BLACK - Visited and completely processed BB.
|
||||||
|
enum Color { WHITE, GREY, BLACK };
|
||||||
|
|
||||||
bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
|
bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
|
||||||
BasicBlock *REntry = R.getEntry();
|
BasicBlock *REntry = R.getEntry();
|
||||||
BasicBlock *RExit = R.getExit();
|
BasicBlock *RExit = R.getExit();
|
||||||
|
@ -1394,10 +1401,10 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
|
||||||
|
|
||||||
// Initialize the map for all BB with WHITE color.
|
// Initialize the map for all BB with WHITE color.
|
||||||
for (auto *BB : R.blocks())
|
for (auto *BB : R.blocks())
|
||||||
BBColorMap[BB] = ScopDetection::WHITE;
|
BBColorMap[BB] = WHITE;
|
||||||
|
|
||||||
// Process the entry block of the Region.
|
// Process the entry block of the Region.
|
||||||
BBColorMap[CurrBB] = ScopDetection::GREY;
|
BBColorMap[CurrBB] = GREY;
|
||||||
DFSStack.push(std::make_pair(CurrBB, 0));
|
DFSStack.push(std::make_pair(CurrBB, 0));
|
||||||
|
|
||||||
while (!DFSStack.empty()) {
|
while (!DFSStack.empty()) {
|
||||||
|
@ -1418,15 +1425,15 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// WHITE indicates an unvisited BB in DFS walk.
|
// WHITE indicates an unvisited BB in DFS walk.
|
||||||
if (BBColorMap[SuccBB] == ScopDetection::WHITE) {
|
if (BBColorMap[SuccBB] == WHITE) {
|
||||||
// Push the current BB and the index of the next child to be visited.
|
// Push the current BB and the index of the next child to be visited.
|
||||||
DFSStack.push(std::make_pair(CurrBB, I + 1));
|
DFSStack.push(std::make_pair(CurrBB, I + 1));
|
||||||
// Push the next BB to be processed.
|
// Push the next BB to be processed.
|
||||||
DFSStack.push(std::make_pair(SuccBB, 0));
|
DFSStack.push(std::make_pair(SuccBB, 0));
|
||||||
// First time the BB is being processed.
|
// First time the BB is being processed.
|
||||||
BBColorMap[SuccBB] = ScopDetection::GREY;
|
BBColorMap[SuccBB] = GREY;
|
||||||
break;
|
break;
|
||||||
} else if (BBColorMap[SuccBB] == ScopDetection::GREY) {
|
} else if (BBColorMap[SuccBB] == GREY) {
|
||||||
// GREY indicates a loop in the control flow.
|
// GREY indicates a loop in the control flow.
|
||||||
// If the destination dominates the source, it is a natural loop
|
// If the destination dominates the source, it is a natural loop
|
||||||
// else, an irreducible control flow in the region is detected.
|
// else, an irreducible control flow in the region is detected.
|
||||||
|
@ -1441,7 +1448,7 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
|
||||||
// If all children of current BB have been processed,
|
// If all children of current BB have been processed,
|
||||||
// then mark that BB as fully processed.
|
// then mark that BB as fully processed.
|
||||||
if (AdjacentBlockIndex == NSucc)
|
if (AdjacentBlockIndex == NSucc)
|
||||||
BBColorMap[CurrBB] = ScopDetection::BLACK;
|
BBColorMap[CurrBB] = BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue