Convert DOUT to DEBUG(errs()...).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79747 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bill Wendling 2009-08-22 20:03:00 +00:00
parent cda7f78233
commit 3403bcd8f9

View File

@ -28,6 +28,7 @@
#include "llvm/Support/CommandLine.h" #include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h" #include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/ADT/SmallSet.h" #include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/Statistic.h" #include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/STLExtras.h"
@ -108,7 +109,7 @@ FunctionPass *llvm::createBranchFoldingPass(bool DefaultEnableTailMerge) {
/// function, updating the CFG. /// function, updating the CFG.
void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) { void BranchFolder::RemoveDeadBlock(MachineBasicBlock *MBB) {
assert(MBB->pred_empty() && "MBB must be dead!"); assert(MBB->pred_empty() && "MBB must be dead!");
DOUT << "\nRemoving MBB: " << *MBB; DEBUG(errs() << "\nRemoving MBB: " << *MBB);
MachineFunction *MF = MBB->getParent(); MachineFunction *MF = MBB->getParent();
// drop all successors. // drop all successors.
@ -568,8 +569,8 @@ unsigned BranchFolder::CreateCommonTailOnlyBlock(MachineBasicBlock *&PredBB,
MachineBasicBlock::iterator BBI = SameTails[commonTailIndex].second; MachineBasicBlock::iterator BBI = SameTails[commonTailIndex].second;
MachineBasicBlock *MBB = SameTails[commonTailIndex].first->second; MachineBasicBlock *MBB = SameTails[commonTailIndex].first->second;
DOUT << "\nSplitting " << MBB->getNumber() << ", size " << DEBUG(errs() << "\nSplitting " << MBB->getNumber() << ", size "
maxCommonTailLength; << maxCommonTailLength);
MachineBasicBlock *newMBB = SplitMBBAt(*MBB, BBI); MachineBasicBlock *newMBB = SplitMBBAt(*MBB, BBI);
SameTails[commonTailIndex].first->second = newMBB; SameTails[commonTailIndex].first->second = newMBB;
@ -597,7 +598,7 @@ bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
unsigned minCommonTailLength = (SuccBB ? 1 : 2) + 1; unsigned minCommonTailLength = (SuccBB ? 1 : 2) + 1;
MadeChange = false; MadeChange = false;
DOUT << "\nTryMergeBlocks " << MergePotentials.size() << '\n'; DEBUG(errs() << "\nTryMergeBlocks " << MergePotentials.size() << '\n');
// Sort by hash value so that blocks with identical end sequences sort // Sort by hash value so that blocks with identical end sequences sort
// together. // together.
@ -644,17 +645,17 @@ bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
MachineBasicBlock *MBB = SameTails[commonTailIndex].first->second; MachineBasicBlock *MBB = SameTails[commonTailIndex].first->second;
// MBB is common tail. Adjust all other BB's to jump to this one. // MBB is common tail. Adjust all other BB's to jump to this one.
// Traversal must be forwards so erases work. // Traversal must be forwards so erases work.
DOUT << "\nUsing common tail " << MBB->getNumber() << " for "; DEBUG(errs() << "\nUsing common tail " << MBB->getNumber() << " for ");
for (unsigned int i=0; i<SameTails.size(); ++i) { for (unsigned int i=0; i<SameTails.size(); ++i) {
if (commonTailIndex==i) if (commonTailIndex==i)
continue; continue;
DOUT << SameTails[i].first->second->getNumber() << ","; DEBUG(errs() << SameTails[i].first->second->getNumber() << ",");
// Hack the end off BB i, making it jump to BB commonTailIndex instead. // Hack the end off BB i, making it jump to BB commonTailIndex instead.
ReplaceTailWithBranchTo(SameTails[i].second, MBB); ReplaceTailWithBranchTo(SameTails[i].second, MBB);
// BB i is no longer a predecessor of SuccBB; remove it from the worklist. // BB i is no longer a predecessor of SuccBB; remove it from the worklist.
MergePotentials.erase(SameTails[i].first); MergePotentials.erase(SameTails[i].first);
} }
DOUT << "\n"; DEBUG(errs() << "\n");
// We leave commonTailIndex in the worklist in case there are other blocks // We leave commonTailIndex in the worklist in case there are other blocks
// that match it with a smaller number of instructions. // that match it with a smaller number of instructions.
MadeChange = true; MadeChange = true;
@ -1008,8 +1009,8 @@ void BranchFolder::OptimizeBlock(MachineBasicBlock *MBB) {
// Reverse the branch so we will fall through on the previous true cond. // Reverse the branch so we will fall through on the previous true cond.
SmallVector<MachineOperand, 4> NewPriorCond(PriorCond); SmallVector<MachineOperand, 4> NewPriorCond(PriorCond);
if (!TII->ReverseBranchCondition(NewPriorCond)) { if (!TII->ReverseBranchCondition(NewPriorCond)) {
DOUT << "\nMoving MBB: " << *MBB; DEBUG(errs() << "\nMoving MBB: " << *MBB
DOUT << "To make fallthrough to: " << *PriorTBB << "\n"; << "To make fallthrough to: " << *PriorTBB << "\n");
TII->RemoveBranch(PrevBB); TII->RemoveBranch(PrevBB);
TII->InsertBranch(PrevBB, MBB, 0, NewPriorCond); TII->InsertBranch(PrevBB, MBB, 0, NewPriorCond);