diff options
author | Renato Golin <renato.golin@arm.com> | 2011-03-14 22:22:46 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@arm.com> | 2011-03-14 22:22:46 +0000 |
commit | 4b6ae939cadbafd4433594433057f80336b1856f (patch) | |
tree | 619bfcf581276239ea8076379b040c6fa54a7629 /llvm/tools/llvm-diff/DifferenceEngine.cpp | |
parent | c9a16d581d82e0b2d84be92ed55329ee8da021b1 (diff) | |
download | bcm5719-llvm-4b6ae939cadbafd4433594433057f80336b1856f.tar.gz bcm5719-llvm-4b6ae939cadbafd4433594433057f80336b1856f.zip |
This patch is a big refactoring of llvm-diff. It doesn't add new features, but it re-organizes the old features, so I can insert the MetadataEngine to use the same infrastructure.
llvm-svn: 127627
Diffstat (limited to 'llvm/tools/llvm-diff/DifferenceEngine.cpp')
-rw-r--r-- | llvm/tools/llvm-diff/DifferenceEngine.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/llvm/tools/llvm-diff/DifferenceEngine.cpp b/llvm/tools/llvm-diff/DifferenceEngine.cpp index b0a24d0737e..3cf178e7f16 100644 --- a/llvm/tools/llvm-diff/DifferenceEngine.cpp +++ b/llvm/tools/llvm-diff/DifferenceEngine.cpp @@ -506,30 +506,30 @@ void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart, for (unsigned I = 0; I != NL+1; ++I) { Cur[I].Cost = I * LeftCost; for (unsigned J = 0; J != I; ++J) - Cur[I].Path.push_back(DifferenceEngine::DC_left); + Cur[I].Path.push_back(DC_left); } for (BasicBlock::iterator RI = RStart; RI != RE; ++RI) { // Initialize the first row. Next[0] = Cur[0]; Next[0].Cost += RightCost; - Next[0].Path.push_back(DifferenceEngine::DC_right); + Next[0].Path.push_back(DC_right); unsigned Index = 1; for (BasicBlock::iterator LI = LStart; LI != LE; ++LI, ++Index) { if (matchForBlockDiff(&*LI, &*RI)) { Next[Index] = Cur[Index-1]; Next[Index].Cost += MatchCost; - Next[Index].Path.push_back(DifferenceEngine::DC_match); + Next[Index].Path.push_back(DC_match); TentativeValues.insert(std::make_pair(&*LI, &*RI)); } else if (Next[Index-1].Cost <= Cur[Index].Cost) { Next[Index] = Next[Index-1]; Next[Index].Cost += LeftCost; - Next[Index].Path.push_back(DifferenceEngine::DC_left); + Next[Index].Path.push_back(DC_left); } else { Next[Index] = Cur[Index]; Next[Index].Cost += RightCost; - Next[Index].Path.push_back(DifferenceEngine::DC_right); + Next[Index].Path.push_back(DC_right); } } @@ -543,23 +543,23 @@ void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart, SmallVectorImpl<char> &Path = Cur[NL].Path; BasicBlock::iterator LI = LStart, RI = RStart; - DifferenceEngine::DiffLogBuilder Diff(Engine); + DiffLogBuilder Diff(Engine.getConsumer()); // Drop trailing matches. - while (Path.back() == DifferenceEngine::DC_match) + while (Path.back() == DC_match) Path.pop_back(); // Skip leading matches. SmallVectorImpl<char>::iterator PI = Path.begin(), PE = Path.end(); - while (PI != PE && *PI == DifferenceEngine::DC_match) { + while (PI != PE && *PI == DC_match) { unify(&*LI, &*RI); ++PI, ++LI, ++RI; } for (; PI != PE; ++PI) { - switch (static_cast<DifferenceEngine::DiffChange>(*PI)) { - case DifferenceEngine::DC_match: + switch (static_cast<DiffChange>(*PI)) { + case DC_match: assert(LI != LE && RI != RE); { Instruction *L = &*LI, *R = &*RI; @@ -569,13 +569,13 @@ void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart, ++LI; ++RI; break; - case DifferenceEngine::DC_left: + case DC_left: assert(LI != LE); Diff.addLeft(&*LI); ++LI; break; - case DifferenceEngine::DC_right: + case DC_right: assert(RI != RE); Diff.addRight(&*RI); ++RI; |