aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/DataStructure/DataStructure.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Analysis/DataStructure/DataStructure.cpp')
-rw-r--r--lib/Analysis/DataStructure/DataStructure.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index 15c6c75dc6..505fe91362 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());