summaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2006-11-17 07:33:59 +0000
committerBill Wendling <isanbard@gmail.com>2006-11-17 07:33:59 +0000
commit5294fb0b3fda7f14b83fd34f62116f1c5f499ba2 (patch)
tree6832f23bf63ba2b644e4afe3b4b64ad26ad76cf0 /lib/Analysis/DataStructure
parent0cb83fcab50c5c7ce1f4d04d2b9ffb878a5a642c (diff)
Replace DEBUG(std::cerr with DOUT. Removed some iostream #includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31811 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure')
-rw-r--r--lib/Analysis/DataStructure/BottomUpClosure.cpp60
-rw-r--r--lib/Analysis/DataStructure/CompleteBottomUp.cpp23
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp42
-rw-r--r--lib/Analysis/DataStructure/EquivClassGraphs.cpp37
-rw-r--r--lib/Analysis/DataStructure/Local.cpp14
-rw-r--r--lib/Analysis/DataStructure/TopDownClosure.cpp25
6 files changed, 95 insertions, 106 deletions
diff --git a/lib/Analysis/DataStructure/BottomUpClosure.cpp b/lib/Analysis/DataStructure/BottomUpClosure.cpp
index a7104d570fd..0f48850ae9e 100644
--- a/lib/Analysis/DataStructure/BottomUpClosure.cpp
+++ b/lib/Analysis/DataStructure/BottomUpClosure.cpp
@@ -138,8 +138,8 @@ static void AddGlobalToNode(BUDataStructures* B, DSCallSite D, Function* F) {
DSNode *N = new DSNode(F->getType()->getElementType(), GI); // Create the node
N->addGlobal(F);
NHF.setTo(N,0);
- DEBUG(std::cerr << "Adding " << F->getName() << " to a call node in "
- << D.getCaller().getName() << "\n");
+ DOUT << "Adding " << F->getName() << " to a call node in "
+ << D.getCaller().getName() << "\n";
}
DL.getCalleeNode()->mergeWith(NHF, 0);
}
@@ -171,8 +171,8 @@ bool BUDataStructures::runOnModule(Module &M) {
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isExternal() && !DSInfo.count(I)) {
if (MainFunc)
- DEBUG(std::cerr << "*** BU: Function unreachable from main: "
- << I->getName() << "\n");
+ DOUT << "*** BU: Function unreachable from main: "
+ << I->getName() << "\n";
calculateGraphs(I, Stack, NextID, ValMap); // Calculate all graphs.
}
@@ -203,7 +203,7 @@ bool BUDataStructures::runOnModule(Module &M) {
BuildGlobalECs(*GlobalsGraph, ECGlobals);
if (!ECGlobals.empty()) {
NamedRegionTimer X("Bottom-UP EC Cleanup");
- DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n");
+ DOUT << "Eliminating " << ECGlobals.size() << " EC Globals!\n";
for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(),
E = DSInfo.end(); I != E; ++I)
EliminateUsesOfECGlobals(*I->second, ECGlobals);
@@ -235,12 +235,12 @@ bool BUDataStructures::runOnModule(Module &M) {
ee = MainGraph.afc_end(); ii != ee; ++ii) {
std::vector<Function*> Funcs;
GetAllCalleesN(*ii, Funcs);
- DEBUG(std::cerr << "Lost site\n");
+ DOUT << "Lost site\n";
DEBUG(ii->getCallSite().getInstruction()->dump());
for (std::vector<Function*>::iterator iif = Funcs.begin(), eef = Funcs.end();
iif != eef; ++iif) {
AddGlobalToNode(this, *ii, *iif);
- DEBUG(std::cerr << "Adding\n");
+ DOUT << "Adding\n";
ActualCallees.insert(std::make_pair(ii->getCallSite().getInstruction(), *iif));
}
}
@@ -383,15 +383,15 @@ unsigned BUDataStructures::calculateGraphs(Function *F,
// If this is a new SCC, process it now.
if (Stack.back() == F) { // Special case the single "SCC" case here.
- DEBUG(std::cerr << "Visiting single node SCC #: " << MyID << " fn: "
- << F->getName() << "\n");
+ DOUT << "Visiting single node SCC #: " << MyID << " fn: "
+ << F->getName() << "\n";
Stack.pop_back();
DSGraph &G = getDSGraph(*F);
- DEBUG(std::cerr << " [BU] Calculating graph for: " << F->getName()<< "\n");
+ DOUT << " [BU] Calculating graph for: " << F->getName()<< "\n";
calculateGraph(G);
- DEBUG(std::cerr << " [BU] Done inlining: " << F->getName() << " ["
- << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size()
- << "]\n");
+ DOUT << " [BU] Done inlining: " << F->getName() << " ["
+ << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size()
+ << "]\n";
if (MaxSCC < 1) MaxSCC = 1;
@@ -399,7 +399,7 @@ unsigned BUDataStructures::calculateGraphs(Function *F,
// callees.
GetAllAuxCallees(Graph, CalleeFunctions);
if (!CalleeFunctions.empty()) {
- DEBUG(std::cerr << "Recalculating " << F->getName() << " due to new knowledge\n");
+ DOUT << "Recalculating " << F->getName() << " due to new knowledge\n";
ValMap.erase(F);
return calculateGraphs(F, Stack, NextID, ValMap);
} else {
@@ -440,8 +440,8 @@ unsigned BUDataStructures::calculateGraphs(Function *F,
}
Stack.pop_back();
- DEBUG(std::cerr << "Calculating graph for SCC #: " << MyID << " of size: "
- << SCCSize << "\n");
+ DOUT << "Calculating graph for SCC #: " << MyID << " of size: "
+ << SCCSize << "\n";
// Compute the Max SCC Size.
if (MaxSCC < SCCSize)
@@ -453,10 +453,9 @@ unsigned BUDataStructures::calculateGraphs(Function *F,
// Now that we have one big happy family, resolve all of the call sites in
// the graph...
calculateGraph(SCCGraph);
- DEBUG(std::cerr << " [BU] Done inlining SCC [" << SCCGraph.getGraphSize()
- << "+" << SCCGraph.getAuxFunctionCalls().size() << "]\n");
-
- DEBUG(std::cerr << "DONE with SCC #: " << MyID << "\n");
+ DOUT << " [BU] Done inlining SCC [" << SCCGraph.getGraphSize()
+ << "+" << SCCGraph.getAuxFunctionCalls().size() << "]\n"
+ << "DONE with SCC #: " << MyID << "\n";
// We never have to revisit "SCC" processed functions...
return MyID;
@@ -579,12 +578,11 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
// Get the data structure graph for the called function.
GI = &getDSGraph(*Callee); // Graph to inline
- DEBUG(std::cerr << " Inlining graph for " << Callee->getName());
-
- DEBUG(std::cerr << "[" << GI->getGraphSize() << "+"
- << GI->getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n");
+ DOUT << " Inlining graph for " << Callee->getName()
+ << "[" << GI->getGraphSize() << "+"
+ << GI->getAuxFunctionCalls().size() << "] into '"
+ << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
+ << Graph.getAuxFunctionCalls().size() << "]\n";
Graph.mergeInGraph(CS, *Callee, *GI,
DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes);
++NumBUInlines;
@@ -653,11 +651,11 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
GI = IndCallGraph.first;
// Merge the unified graph into this graph now.
- DEBUG(std::cerr << " Inlining multi callee graph "
- << "[" << GI->getGraphSize() << "+"
- << GI->getAuxFunctionCalls().size() << "] into '"
- << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
- << Graph.getAuxFunctionCalls().size() << "]\n");
+ DOUT << " Inlining multi callee graph "
+ << "[" << GI->getGraphSize() << "+"
+ << GI->getAuxFunctionCalls().size() << "] into '"
+ << Graph.getFunctionNames() << "' [" << Graph.getGraphSize() <<"+"
+ << Graph.getAuxFunctionCalls().size() << "]\n";
Graph.mergeInGraph(CS, IndCallGraph.second, *GI,
DSGraph::StripAllocaBit |
diff --git a/lib/Analysis/DataStructure/CompleteBottomUp.cpp b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
index 90c14b408ff..aea113d97dd 100644
--- a/lib/Analysis/DataStructure/CompleteBottomUp.cpp
+++ b/lib/Analysis/DataStructure/CompleteBottomUp.cpp
@@ -21,7 +21,6 @@
#include "llvm/ADT/SCCIterator.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/STLExtras.h"
-#include <iostream>
using namespace llvm;
namespace {
@@ -52,14 +51,14 @@ bool CompleteBUDataStructures::runOnModule(Module &M) {
if (!MainFunc->isExternal())
calculateSCCGraphs(getOrCreateGraph(*MainFunc), Stack, NextID, ValMap);
} else {
- DEBUG(std::cerr << "CBU-DSA: No 'main' function found!\n");
+ DOUT << "CBU-DSA: No 'main' function found!\n";
}
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isExternal() && !DSInfo.count(I)) {
if (MainFunc) {
- DEBUG(std::cerr << "*** CBU: Function unreachable from main: "
- << I->getName() << "\n");
+ DOUT << "*** CBU: Function unreachable from main: "
+ << I->getName() << "\n";
}
calculateSCCGraphs(getOrCreateGraph(*I), Stack, NextID, ValMap);
}
@@ -218,14 +217,14 @@ void CompleteBUDataStructures::processGraph(DSGraph &G) {
G.mergeInGraph(CS, *CalleeFunc, GI,
DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
- DEBUG(std::cerr << " Inlining graph [" << i << "/"
- << G.getFunctionCalls().size()-1
- << ":" << TNum << "/" << Num-1 << "] for "
- << CalleeFunc->getName() << "["
- << GI.getGraphSize() << "+" << GI.getAuxFunctionCalls().size()
- << "] into '" /*<< G.getFunctionNames()*/ << "' ["
- << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size()
- << "]\n");
+ DOUT << " Inlining graph [" << i << "/"
+ << G.getFunctionCalls().size()-1
+ << ":" << TNum << "/" << Num-1 << "] for "
+ << CalleeFunc->getName() << "["
+ << GI.getGraphSize() << "+" << GI.getAuxFunctionCalls().size()
+ << "] into '" /*<< G.getFunctionNames()*/ << "' ["
+ << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size()
+ << "]\n";
}
}
}
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 15c6c75dc6a..505fe91362c 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -431,8 +431,7 @@ static bool ElementTypesAreCompatible(const Type *T1, const Type *T2,
///
bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
bool FoldIfIncompatible) {
- DEBUG(std::cerr << "merging " << *NewTy << " at " << Offset
- << " with " << *Ty << "\n");
+ DOUT << "merging " << *NewTy << " at " << Offset << " with " << *Ty << "\n";
const TargetData &TD = getTargetData();
// Check to make sure the Size member is up-to-date. Size can be one of the
// following:
@@ -521,9 +520,10 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
//handle some common cases:
// Ty: struct { t1, t2, t3, t4, ..., tn}
// NewTy: struct { offset, stuff...}
- // try merge with NewTy: struct {t1, t2, stuff...} if offset lands exactly on a field in Ty
+ // try merge with NewTy: struct {t1, t2, stuff...} if offset lands exactly
+ // on a field in Ty
if (isa<StructType>(NewTy) && isa<StructType>(Ty)) {
- DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n");
+ DOUT << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n";
const StructType *STy = cast<StructType>(Ty);
const StructLayout &SL = *TD.getStructLayout(STy);
unsigned i = SL.getElementContainingOffset(Offset);
@@ -539,15 +539,16 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
nt.insert(nt.end(), STy->element_begin(), STy->element_end());
//and merge
STy = StructType::get(nt);
- DEBUG(std::cerr << "Trying with: " << *STy << "\n");
+ DOUT << "Trying with: " << *STy << "\n";
return mergeTypeInfo(STy, 0);
}
//Ty: struct { t1, t2, t3 ... tn}
//NewTy T offset x
- //try merge with NewTy: struct : {t1, t2, T} if offset lands on a field in Ty
+ //try merge with NewTy: struct : {t1, t2, T} if offset lands on a field
+ //in Ty
if (isa<StructType>(Ty)) {
- DEBUG(std::cerr << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n");
+ DOUT << "Ty: " << *Ty << "\nNewTy: " << *NewTy << "@" << Offset << "\n";
const StructType *STy = cast<StructType>(Ty);
const StructLayout &SL = *TD.getStructLayout(STy);
unsigned i = SL.getElementContainingOffset(Offset);
@@ -562,12 +563,13 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
nt.push_back(NewTy);
//and merge
STy = StructType::get(nt);
- DEBUG(std::cerr << "Trying with: " << *STy << "\n");
+ DOUT << "Trying with: " << *STy << "\n";
return mergeTypeInfo(STy, 0);
}
- std::cerr << "UNIMP: Trying to merge a growth type into "
- << "offset != 0: Collapsing!\n";
+ assert(0 &&
+ "UNIMP: Trying to merge a growth type into "
+ "offset != 0: Collapsing!");
abort();
if (FoldIfIncompatible) foldNodeCompletely();
return true;
@@ -717,10 +719,11 @@ bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset,
Module *M = 0;
if (getParentGraph()->retnodes_begin() != getParentGraph()->retnodes_end())
M = getParentGraph()->retnodes_begin()->first->getParent();
- DEBUG(std::cerr << "MergeTypeInfo Folding OrigTy: ";
- WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
+
+ DOUT << "MergeTypeInfo Folding OrigTy: ";
+ DEBUG(WriteTypeSymbolic(std::cerr, Ty, M) << "\n due to:";
WriteTypeSymbolic(std::cerr, NewTy, M) << " @ " << Offset << "!\n"
- << "SubType: ";
+ << "SubType: ";
WriteTypeSymbolic(std::cerr, SubType, M) << "\n\n");
if (FoldIfIncompatible) foldNodeCompletely();
@@ -926,8 +929,7 @@ void DSNode::mergeWith(const DSNodeHandle &NH, unsigned Offset) {
if (N == this) {
// We cannot merge two pieces of the same node together, collapse the node
// completely.
- DEBUG(std::cerr << "Attempting to merge two chunks of"
- << " the same node together!\n");
+ DOUT << "Attempting to merge two chunks of the same node together!\n";
foldNodeCompletely();
return;
}
@@ -1808,9 +1810,7 @@ static void removeIdenticalCalls(std::list<DSCallSite> &Calls) {
// eliminate it.
if (Callee->getNumReferrers() == 1 && Callee->isComplete() &&
Callee->getGlobalsList().empty()) { // No useful info?
-#ifndef NDEBUG
- std::cerr << "WARNING: Useless call site found.\n";
-#endif
+ DOUT << "WARNING: Useless call site found.\n";
Calls.erase(OldIt);
++NumDeleted;
continue;
@@ -1930,8 +1930,8 @@ static void removeIdenticalCalls(std::list<DSCallSite> &Calls) {
// Track the number of call nodes merged away...
NumCallNodesMerged += NumDeleted;
- DEBUG(if (NumDeleted)
- std::cerr << "Merged " << NumDeleted << " call nodes.\n";);
+ if (NumDeleted)
+ DOUT << "Merged " << NumDeleted << " call nodes.\n";
}
@@ -2263,7 +2263,7 @@ void DSGraph::AssertCallSiteInGraph(const DSCallSite &CS) const {
#if 0
if (CS.getNumPtrArgs() && CS.getCalleeNode() == CS.getPtrArg(0).getNode() &&
CS.getCalleeNode() && CS.getCalleeNode()->getGlobals().empty())
- std::cerr << "WARNING: WEIRD CALL SITE FOUND!\n";
+ DOUT << "WARNING: WEIRD CALL SITE FOUND!\n";
#endif
}
AssertNodeInGraph(CS.getRetVal().getNode());
diff --git a/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
index e28f4210b0d..4b1eaa9ea01 100644
--- a/lib/Analysis/DataStructure/EquivClassGraphs.cpp
+++ b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
@@ -213,7 +213,7 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
// Now that all of the equivalences have been built, merge the graphs for
// each equivalence class.
//
- DEBUG(std::cerr << "\nIndirect Function Equivalence Sets:\n");
+ DOUT << "\nIndirect Function Equivalence Sets:\n";
for (EquivalenceClasses<Function*>::iterator EQSI = FuncECs.begin(), E =
FuncECs.end(); EQSI != E; ++EQSI) {
if (!EQSI->isLeader()) continue;
@@ -229,10 +229,10 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
Function* LF = *SI;
#ifndef NDEBUG
- DEBUG(std::cerr <<" Equivalence set for leader " << LF->getName() <<" = ");
+ DOUT <<" Equivalence set for leader " << LF->getName() <<" = ";
for (SN = SI; SN != FuncECs.member_end(); ++SN)
- DEBUG(std::cerr << " " << (*SN)->getName() << "," );
- DEBUG(std::cerr << "\n");
+ DOUT << " " << (*SN)->getName() << "," ;
+ DOUT << "\n";
#endif
// This equiv class has multiple functions: merge their graphs. First,
@@ -286,7 +286,7 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
DEBUG(MergedG.AssertGraphOK());
}
}
- DEBUG(std::cerr << "\n");
+ DOUT << "\n";
}
@@ -322,8 +322,7 @@ processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack, unsigned &NextID,
if (It != ValMap.end() && It->first == &FG)
return It->second;
- DEBUG(std::cerr << " ProcessSCC for function " << FG.getFunctionNames()
- << "\n");
+ DOUT << " ProcessSCC for function " << FG.getFunctionNames() << "\n";
unsigned Min = NextID++, MyID = Min;
ValMap[&FG] = Min;
@@ -386,8 +385,7 @@ processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack, unsigned &NextID,
/// processGraph - Process the CBU graphs for the program in bottom-up order on
/// the SCC of the __ACTUAL__ call graph. This builds final folded CBU graphs.
void EquivClassGraphs::processGraph(DSGraph &G) {
- DEBUG(std::cerr << " ProcessGraph for function "
- << G.getFunctionNames() << "\n");
+ DOUT << " ProcessGraph for function " << G.getFunctionNames() << "\n";
hash_set<Instruction*> calls;
@@ -434,15 +432,15 @@ void EquivClassGraphs::processGraph(DSGraph &G) {
DSGraph::StripAllocaBit |
DSGraph::DontCloneCallNodes |
DSGraph::DontCloneAuxCallNodes);
- DEBUG(std::cerr << " Inlining graph [" << i << "/"
- << G.getFunctionCalls().size()-1
- << ":" << TNum << "/" << Num-1 << "] for "
- << CalleeFunc->getName() << "["
- << CalleeGraph->getGraphSize() << "+"
- << CalleeGraph->getAuxFunctionCalls().size()
- << "] into '" /*<< G.getFunctionNames()*/ << "' ["
- << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size()
- << "]\n");
+ DOUT << " Inlining graph [" << i << "/"
+ << G.getFunctionCalls().size()-1
+ << ":" << TNum << "/" << Num-1 << "] for "
+ << CalleeFunc->getName() << "["
+ << CalleeGraph->getGraphSize() << "+"
+ << CalleeGraph->getAuxFunctionCalls().size()
+ << "] into '" /*<< G.getFunctionNames()*/ << "' ["
+ << G.getGraphSize() << "+" << G.getAuxFunctionCalls().size()
+ << "]\n";
}
}
@@ -476,6 +474,5 @@ void EquivClassGraphs::processGraph(DSGraph &G) {
E = MainSM.global_end(); I != E; ++I)
RC.getClonedNH(MainSM[*I]);
- DEBUG(std::cerr << " -- DONE ProcessGraph for function "
- << G.getFunctionNames() << "\n");
+ DOUT << " -- DONE ProcessGraph for function " << G.getFunctionNames() <<"\n";
}
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index 856ceb3c9a5..c8880c11c53 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -188,7 +188,7 @@ DSGraph::DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &td,
: GlobalsGraph(GG), ScalarMap(ECs), TD(td) {
PrintAuxCalls = false;
- DEBUG(std::cerr << " [Loc] Calculating graph for: " << F.getName() << "\n");
+ DOUT << " [Loc] Calculating graph for: " << F.getName() << "\n";
// Use the graph builder to construct the local version of the graph
GraphBuilder B(F, *this, ReturnNodes[&F], FunctionCalls);
@@ -573,7 +573,7 @@ bool GraphBuilder::visitIntrinsic(CallSite CS, Function *F) {
N->setModifiedMarker();
return true;
default:
- DEBUG(std::cerr << "[dsa:local] Unhandled intrinsic: " << F->getName() << "\n");
+ DOUT << "[dsa:local] Unhandled intrinsic: " << F->getName() << "\n";
return false;
}
}
@@ -1047,8 +1047,8 @@ void GraphBuilder::visitCallSite(CallSite CS) {
break;
}
if (Warn) {
- DEBUG(std::cerr << "WARNING: Call to unknown external function '"
- << F->getName() << "' will cause pessimistic results!\n");
+ DOUT << "WARNING: Call to unknown external function '"
+ << F->getName() << "' will cause pessimistic results!\n";
}
}
@@ -1158,7 +1158,7 @@ void GraphBuilder::MergeConstantInitIntoNode(DSNodeHandle &NH, Constant *C) {
DSNodeHandle NewNH(NHN, NH.getOffset()+(unsigned)SL->MemberOffsets[i]);
MergeConstantInitIntoNode(NewNH, cast<Constant>(CS->getOperand(i)));
} else if (SL->MemberOffsets[i] == SL->StructSize) {
- DEBUG(std::cerr << "Zero size element at end of struct\n");
+ DOUT << "Zero size element at end of struct\n";
NHN->foldNodeCompletely();
} else {
assert(0 && "type was smaller than offsets of of struct layout indicate");
@@ -1280,7 +1280,7 @@ bool LocalDataStructures::runOnModule(Module &M) {
// together the globals into equivalence classes.
std::set<GlobalValue*> ECGlobals;
BuildGlobalECs(*GlobalsGraph, ECGlobals);
- DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n");
+ DOUT << "Eliminating " << ECGlobals.size() << " EC Globals!\n";
ECGlobals.clear();
// Calculate all of the graphs...
@@ -1298,7 +1298,7 @@ bool LocalDataStructures::runOnModule(Module &M) {
// program.
BuildGlobalECs(*GlobalsGraph, ECGlobals);
if (!ECGlobals.empty()) {
- DEBUG(std::cerr << "Eliminating " << ECGlobals.size() << " EC Globals!\n");
+ DOUT << "Eliminating " << ECGlobals.size() << " EC Globals!\n";
for (hash_map<Function*, DSGraph*>::iterator I = DSInfo.begin(),
E = DSInfo.end(); I != E; ++I)
EliminateUsesOfECGlobals(*I->second, ECGlobals);
diff --git a/lib/Analysis/DataStructure/TopDownClosure.cpp b/lib/Analysis/DataStructure/TopDownClosure.cpp
index d0bb7e1e07c..57a8924ae47 100644
--- a/lib/Analysis/DataStructure/TopDownClosure.cpp
+++ b/lib/Analysis/DataStructure/TopDownClosure.cpp
@@ -21,7 +21,6 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Timer.h"
#include "llvm/ADT/Statistic.h"
-#include <iostream>
using namespace llvm;
#if 0
@@ -241,8 +240,7 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
RC.getClonedNH(GG.getNodeForValue(*GI));
}
- DEBUG(std::cerr << "[TD] Inlining callers into '" << DSG.getFunctionNames()
- << "'\n");
+ DOUT << "[TD] Inlining callers into '" << DSG.getFunctionNames() << "'\n";
// Iteratively inline caller graphs into this graph.
while (!EdgesFromCaller.empty()) {
@@ -258,16 +256,13 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
do {
const DSCallSite &CS = *EdgesFromCaller.back().CS;
Function &CF = *EdgesFromCaller.back().CalledFunction;
- DEBUG(std::cerr << " [TD] Inlining graph into Fn '"
- << CF.getName() << "' from ");
+ DOUT << " [TD] Inlining graph into Fn '" << CF.getName() << "' from ";
if (CallerGraph.getReturnNodes().empty())
- DEBUG(std::cerr << "SYNTHESIZED INDIRECT GRAPH");
+ DOUT << "SYNTHESIZED INDIRECT GRAPH";
else
- DEBUG (std::cerr << "Fn '"
- << CS.getCallSite().getInstruction()->
- getParent()->getParent()->getName() << "'");
- DEBUG(std::cerr << ": " << CF.getFunctionType()->getNumParams()
- << " args\n");
+ DOUT << "Fn '" << CS.getCallSite().getInstruction()->
+ getParent()->getParent()->getName() << "'";
+ DOUT << ": " << CF.getFunctionType()->getNumParams() << " args\n";
// Get the formal argument and return nodes for the called function and
// merge them with the cloned subgraph.
@@ -371,8 +366,8 @@ void TDDataStructures::InlineCallersIntoGraph(DSGraph &DSG) {
// If we already have this graph, recycle it.
if (IndCallRecI != IndCallMap.end() && IndCallRecI->first == Callees) {
- DEBUG(std::cerr << " [TD] *** Reuse of indcall graph for " << Callees.size()
- << " callees!\n");
+ DOUT << " [TD] *** Reuse of indcall graph for " << Callees.size()
+ << " callees!\n";
IndCallGraph = IndCallRecI->second;
} else {
// Otherwise, create a new DSGraph to represent this.
@@ -464,8 +459,8 @@ void TDDataStructures::copyValue(Value *From, Value *To) {
return;
}
- std::cerr << *From;
- std::cerr << *To;
+ DOUT << *From;
+ DOUT << *To;
assert(0 && "Do not know how to copy this yet!");
abort();
}