diff options
author | Chris Lattner <sabre@nondot.org> | 2002-05-22 17:17:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-05-22 17:17:27 +0000 |
commit | f016ea4ff80c56c467247a90567dd07bddb590f3 (patch) | |
tree | 83ccc99063e91b0f13ad44491575a52378fa0cb5 /lib/Transforms/Scalar/SCCP.cpp | |
parent | 70e60cbd4dd59b61e3e9d0a55f24cf92b0dc8724 (diff) |
Use the new DEBUG(x) macro to allow debugging code to be enabled on the commandline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2713 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 591c22e231..93e85fc191 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -34,12 +34,6 @@ using std::cerr; static Statistic<> NumInstRemoved("sccp\t\t- Number of instructions removed"); -#if 0 // Enable this to get SCCP debug output -#define DEBUG_SCCP(X) X -#else -#define DEBUG_SCCP(X) -#endif - // InstVal class - This class represents the different lattice values that an // instruction may occupy. It is a simple class with value semantics. // @@ -125,7 +119,7 @@ private: // the users of the instruction are updated later. // inline bool markConstant(Instruction *I, Constant *V) { - DEBUG_SCCP(cerr << "markConstant: " << V << " = " << I); + DEBUG(cerr << "markConstant: " << V << " = " << I); if (ValueState[I].markConstant(V)) { InstWorkList.push_back(I); @@ -141,7 +135,7 @@ private: inline bool markOverdefined(Value *V) { if (ValueState[V].markOverdefined()) { if (Instruction *I = dyn_cast<Instruction>(V)) { - DEBUG_SCCP(cerr << "markOverdefined: " << V); + DEBUG(cerr << "markOverdefined: " << V); InstWorkList.push_back(I); // Only instructions go on the work list } return true; @@ -173,7 +167,7 @@ private: // void markExecutable(BasicBlock *BB) { if (BBExecutable.count(BB)) return; - DEBUG_SCCP(cerr << "Marking BB Executable: " << BB); + DEBUG(cerr << "Marking BB Executable: " << BB); BBExecutable.insert(BB); // Basic block is executable! BBWorkList.push_back(BB); // Add the block to the work list! } @@ -258,7 +252,7 @@ bool SCCP::runOnFunction(Function *F) { Instruction *I = InstWorkList.back(); InstWorkList.pop_back(); - DEBUG_SCCP(cerr << "\nPopped off I-WL: " << I); + DEBUG(cerr << "\nPopped off I-WL: " << I); // "I" got into the work list because it either made the transition from @@ -275,7 +269,7 @@ bool SCCP::runOnFunction(Function *F) { BasicBlock *BB = BBWorkList.back(); BBWorkList.pop_back(); - DEBUG_SCCP(cerr << "\nPopped off BBWL: " << BB); + DEBUG(cerr << "\nPopped off BBWL: " << BB); // If this block only has a single successor, mark it as executable as // well... if not, terminate the do loop. @@ -289,13 +283,11 @@ bool SCCP::runOnFunction(Function *F) { } } -#if 0 - for (Function::iterator BBI = F->begin(), BBEnd = F->end(); - BBI != BBEnd; ++BBI) - if (!BBExecutable.count(*BBI)) - cerr << "BasicBlock Dead:" << *BBI; -#endif - + if (DebugFlag) { + for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) + if (!BBExecutable.count(*I)) + cerr << "BasicBlock Dead:" << *I; + } // Iterate over all of the instructions in a function, replacing them with // constants if we have found them to be of constant values. @@ -308,7 +300,7 @@ bool SCCP::runOnFunction(Function *F) { InstVal &IV = ValueState[Inst]; if (IV.isConstant()) { Constant *Const = IV.getConstant(); - DEBUG_SCCP(cerr << "Constant: " << Const << " = " << Inst); + DEBUG(cerr << "Constant: " << Const << " = " << Inst); // Replaces all of the uses of a variable with uses of the constant. Inst->replaceAllUsesWith(Const); |