# HG changeset patch # User Benjamin Kramer # Date 1248687841 -7200 # Node ID ed0feda76820e621201866e99f6237872d0ca313 # Parent c704fea92f80ed4e1b22c79bff57a71886cf6e71 DOUT is deprecated, use DEBUG(errs()) instead diff -r c704fea92f80 -r ed0feda76820 gen/passes/GarbageCollect2Stack.cpp --- a/gen/passes/GarbageCollect2Stack.cpp Sun Jul 26 19:12:37 2009 +0200 +++ b/gen/passes/GarbageCollect2Stack.cpp Mon Jul 27 11:44:01 2009 +0200 @@ -35,6 +35,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; STATISTIC(NumGcToStack, "Number of calls promoted to constant-size allocas"); @@ -318,7 +319,7 @@ /// runOnFunction - Top level algorithm. /// bool GarbageCollect2Stack::runOnFunction(Function &F) { - DEBUG(DOUT << "\nRunning -dgc2stack on function " << F.getName() << '\n'); + DEBUG(errs() << "\nRunning -dgc2stack on function " << F.getName() << '\n'); TargetData& TD = getAnalysis(); DominatorTree& DT = getAnalysis(); @@ -364,7 +365,7 @@ continue; } - DEBUG(DOUT << "GarbageCollect2Stack inspecting: " << *Inst); + DEBUG(errs() << "GarbageCollect2Stack inspecting: " << *Inst); if (!info->analyze(*Context, CS, A) || !isSafeToStackAllocate(Inst, DT)) continue; @@ -375,7 +376,7 @@ IRBuilder<> Builder(BB, Inst); Value* newVal = info->promote(*Context, CS, Builder, A); - DEBUG(DOUT << "Promoted to: " << *newVal); + DEBUG(errs() << "Promoted to: " << *newVal); // Make sure the type is the same as it was before, and replace all // uses of the runtime call with the alloca. @@ -418,7 +419,7 @@ /// Returns whether Def is used by any instruction that is reachable from Alloc /// (without executing Def again). static bool mayBeUsedAfterRealloc(Instruction* Def, Instruction* Alloc, DominatorTree& DT) { - DOUT << "### mayBeUsedAfterRealloc()\n" << *Def << *Alloc; + DEBUG(errs() << "### mayBeUsedAfterRealloc()\n" << *Def << *Alloc); // If the definition isn't used it obviously won't be used after the // allocation. @@ -426,11 +427,11 @@ // without going through Def again first, since the definition couldn't // dominate the user either. if (Def->use_empty() || !DT.dominates(Def, Alloc)) { - DOUT << "### No uses or does not dominate allocation\n"; + DEBUG(errs() << "### No uses or does not dominate allocation\n"); return false; } - DOUT << "### Def dominates Alloc\n"; + DEBUG(errs() << "### Def dominates Alloc\n"); BasicBlock* DefBlock = Def->getParent(); BasicBlock* AllocBlock = Alloc->getParent(); @@ -441,7 +442,7 @@ for (Instruction::use_iterator UI = Def->use_begin(), UE = Def->use_end(); UI != UE; ++UI) { Instruction* User = cast(*UI); - DOUT << "USER: " << *User; + DEBUG(errs() << "USER: " << *User); BasicBlock* UserBlock = User->getParent(); // This dominance check is not performed if they're in the same block @@ -451,7 +452,7 @@ if (AllocBlock != UserBlock && DT.dominates(AllocBlock, UserBlock)) { // There's definitely a path from alloc to this user that does not // go through Def, namely any path that ends up in that user. - DOUT << "### Alloc dominates user " << *User; + DEBUG(errs() << "### Alloc dominates user " << *User); return true; } @@ -491,8 +492,8 @@ // This block does not contain the definition or the allocation, // so any user in this block is definitely reachable without // finding either the definition or the allocation. - DOUT << "### Block " << B->getName() - << " contains a reachable user\n"; + DEBUG(errs() << "### Block " << B->getName() + << " contains a reachable user\n"); return true; } // We need to walk the instructions in the block to see whether we @@ -501,7 +502,7 @@ if (&*BBI == Alloc || &*BBI == Def) break; if (Users.count(BBI)) { - DOUT << "### Problematic user: " << *BBI; + DEBUG(errs() << "### Problematic user: " << *BBI); return true; } } @@ -527,7 +528,7 @@ bool SeenDef = false; while (isa(BBI)) { if (Def == cast(BBI)->getIncomingValueForBlock(B)) { - DOUT << "### Problematic phi user: " << *BBI; + DEBUG(errs() << "### Problematic phi user: " << *BBI); return true; } SeenDef |= (Def == &*BBI); diff -r c704fea92f80 -r ed0feda76820 gen/passes/SimplifyDRuntimeCalls.cpp --- a/gen/passes/SimplifyDRuntimeCalls.cpp Sun Jul 26 19:12:37 2009 +0200 +++ b/gen/passes/SimplifyDRuntimeCalls.cpp Mon Jul 27 11:44:01 2009 +0200 @@ -28,6 +28,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; STATISTIC(NumSimplified, "Number of runtime calls simplified"); @@ -379,7 +380,7 @@ Optimizations.find(CalleeName, CalleeName+Callee->getNameLen()); if (OMI == Optimizations.end()) continue; - DEBUG(DOUT << "SimplifyDRuntimeCalls inspecting: " << *CI); + DEBUG(errs() << "SimplifyDRuntimeCalls inspecting: " << *CI); // Set the builder to the instruction after the call. Builder.SetInsertPoint(BB, I); @@ -388,8 +389,8 @@ Value *Result = OMI->second->OptimizeCall(CI, Changed, TD, AA, Builder); if (Result == 0) continue; - DEBUG(DOUT << "SimplifyDRuntimeCalls simplified: " << *CI; - DOUT << " into: " << *Result << "\n"); + DEBUG(errs() << "SimplifyDRuntimeCalls simplified: " << *CI; + errs() << " into: " << *Result << "\n"); // Something changed! Changed = true; diff -r c704fea92f80 -r ed0feda76820 gen/passes/StripExternals.cpp --- a/gen/passes/StripExternals.cpp Sun Jul 26 19:12:37 2009 +0200 +++ b/gen/passes/StripExternals.cpp Mon Jul 27 11:44:01 2009 +0200 @@ -24,6 +24,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; STATISTIC(NumFunctions, "Number of function bodies removed"); @@ -55,14 +56,14 @@ Changed = true; ++NumFunctions; if (I->use_empty()) { - DOUT << "Deleting function: " << *I; + DEBUG(errs() << "Deleting function: " << *I); Module::iterator todelete = I; ++I; todelete->eraseFromParent(); continue; } else { I->deleteBody(); - DOUT << "Deleted function body: " << *I; + DEBUG(errs() << "Deleted function body: " << *I); } } ++I; @@ -75,7 +76,7 @@ Changed = true; ++NumVariables; if (I->use_empty()) { - DOUT << "Deleting global: " << *I; + DEBUG(errs() << "Deleting global: " << *I); Module::global_iterator todelete = I; ++I; todelete->eraseFromParent(); @@ -83,7 +84,7 @@ } else { I->setInitializer(0); I->setLinkage(GlobalValue::ExternalLinkage); - DOUT << "Deleted initializer: " << *I; + DEBUG(errs() << "Deleted initializer: " << *I); } } ++I; diff -r c704fea92f80 -r ed0feda76820 gen/passes/StripMetaData.cpp --- a/gen/passes/StripMetaData.cpp Sun Jul 26 19:12:37 2009 +0200 +++ b/gen/passes/StripMetaData.cpp Mon Jul 27 11:44:01 2009 +0200 @@ -28,6 +28,7 @@ #include "llvm/ADT/Statistic.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" using namespace llvm; STATISTIC(NumDeleted, "Number of metadata globals deleted"); @@ -68,7 +69,7 @@ && "Not a metadata global?"); Changed = true; NumDeleted++; - DEBUG(DOUT << "Deleting " << *G << '\n'); + DEBUG(errs() << "Deleting " << *G << '\n'); G->eraseFromParent(); } }