Skip to content

Commit

Permalink
Move internal enum out of class declaration [NFC]
Browse files Browse the repository at this point in the history
llvm-svn: 270054
  • Loading branch information
Johannes Doerfert committed May 19, 2016
1 parent ffd222f commit 469db6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
7 changes: 0 additions & 7 deletions polly/include/polly/ScopDetection.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,6 @@ class ScopDetection : public FunctionPass {
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.
using DetectionContextMapTy = DenseMap<BBPair, DetectionContext>;
mutable DetectionContextMapTy DetectionContextMap;
Expand Down
19 changes: 13 additions & 6 deletions polly/lib/Analysis/ScopDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
BasicBlock *REntry = R.getEntry();
BasicBlock *RExit = R.getExit();
Expand All @@ -1394,10 +1401,10 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {

// Initialize the map for all BB with WHITE color.
for (auto *BB : R.blocks())
BBColorMap[BB] = ScopDetection::WHITE;
BBColorMap[BB] = WHITE;

// Process the entry block of the Region.
BBColorMap[CurrBB] = ScopDetection::GREY;
BBColorMap[CurrBB] = GREY;
DFSStack.push(std::make_pair(CurrBB, 0));

while (!DFSStack.empty()) {
Expand All @@ -1418,15 +1425,15 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
continue;

// 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.
DFSStack.push(std::make_pair(CurrBB, I + 1));
// Push the next BB to be processed.
DFSStack.push(std::make_pair(SuccBB, 0));
// First time the BB is being processed.
BBColorMap[SuccBB] = ScopDetection::GREY;
BBColorMap[SuccBB] = GREY;
break;
} else if (BBColorMap[SuccBB] == ScopDetection::GREY) {
} else if (BBColorMap[SuccBB] == GREY) {
// GREY indicates a loop in the control flow.
// If the destination dominates the source, it is a natural loop
// else, an irreducible control flow in the region is detected.
Expand All @@ -1441,7 +1448,7 @@ bool ScopDetection::isReducibleRegion(Region &R, DebugLoc &DbgLoc) const {
// If all children of current BB have been processed,
// then mark that BB as fully processed.
if (AdjacentBlockIndex == NSucc)
BBColorMap[CurrBB] = ScopDetection::BLACK;
BBColorMap[CurrBB] = BLACK;
}

return true;
Expand Down

0 comments on commit 469db6a

Please sign in to comment.