blob: 66bd8898b1c30802b2fc08c50fbf56347db827db [file] [log] [blame]
Chris Lattnerbb2a28f2002-03-26 22:39:06 +00001//===- NodeImpl.cpp - Implement the data structure analysis nodes ---------===//
2//
3// Implement the LLVM data structure analysis library.
4//
5//===----------------------------------------------------------------------===//
6
Chris Lattnerb28bf052002-03-31 07:16:08 +00007#include "llvm/Analysis/DataStructureGraph.h"
Chris Lattnere6d4ec32002-04-08 21:58:53 +00008#include "llvm/Assembly/Writer.h"
Chris Lattnerbb2a28f2002-03-26 22:39:06 +00009#include "llvm/DerivedTypes.h"
10#include "llvm/Function.h"
11#include "llvm/BasicBlock.h"
12#include "llvm/iMemory.h"
13#include "llvm/iOther.h"
Chris Lattnerbb2a28f2002-03-26 22:39:06 +000014#include "Support/STLExtras.h"
15#include <algorithm>
16#include <sstream>
17
Chris Lattnerb28bf052002-03-31 07:16:08 +000018bool AllocDSNode::isEquivalentTo(DSNode *Node) const {
19 if (AllocDSNode *N = dyn_cast<AllocDSNode>(Node))
20 return getType() == Node->getType();
Chris Lattnerb28bf052002-03-31 07:16:08 +000021 return false;
22}
23
24bool GlobalDSNode::isEquivalentTo(DSNode *Node) const {
Chris Lattner212be2e2002-04-16 03:44:03 +000025 if (GlobalDSNode *G = dyn_cast<GlobalDSNode>(Node)) {
26 if (G->Val != Val) return false;
27
28 // Check that the outgoing links are identical...
29 assert(getNumLinks() == G->getNumLinks() && "Not identical shape?");
30 for (unsigned i = 0, e = getNumLinks(); i != e; ++i)
31 if (getLink(i) != G->getLink(i)) // Check links
32 return false;
33 return true;
34 }
Chris Lattnerb28bf052002-03-31 07:16:08 +000035 return false;
36}
37
Chris Lattner212be2e2002-04-16 03:44:03 +000038// Call node equivalency - Two call nodes are identical if all of the outgoing
39// links are the same, AND if all of the incoming links are identical.
40//
Chris Lattnerb28bf052002-03-31 07:16:08 +000041bool CallDSNode::isEquivalentTo(DSNode *Node) const {
Chris Lattner212be2e2002-04-16 03:44:03 +000042 if (CallDSNode *C = dyn_cast<CallDSNode>(Node)) {
Chris Lattner7650b942002-04-16 20:39:59 +000043 if (getReferrers().size() != C->getReferrers().size() ||
44 C->getType() != getType())
Chris Lattner212be2e2002-04-16 03:44:03 +000045 return false; // Quick check...
Chris Lattnerb28bf052002-03-31 07:16:08 +000046
Chris Lattner212be2e2002-04-16 03:44:03 +000047 // Check that the outgoing links are identical...
48 assert(getNumLinks() == C->getNumLinks() && "Not identical shape?");
49 for (unsigned i = 0, e = getNumLinks(); i != e; ++i)
50 if (getLink(i) != C->getLink(i)) // Check links
51 return false;
52
53
54 std::vector<PointerValSet*> Refs1 = C->getReferrers();
55 std::vector<PointerValSet*> Refs2 = getReferrers();
56
57 sort(Refs1.begin(), Refs1.end());
58 sort(Refs2.begin(), Refs2.end());
59 if (Refs1 != Refs2) return false; // Incoming edges different?
60
61 // Check that all outgoing links are the same...
62 return C->ArgLinks == ArgLinks; // Check that the arguments are identical
63 }
Chris Lattnerb28bf052002-03-31 07:16:08 +000064 return false;
65}
66
67// NodesAreEquivalent - Check to see if the nodes are equivalent in all ways
68// except node type. Since we know N1 is a shadow node, N2 is allowed to be
69// any type.
70//
71bool ShadowDSNode::isEquivalentTo(DSNode *Node) const {
Chris Lattner0009dac2002-04-04 19:21:51 +000072 return getType() == Node->getType();
Chris Lattnerb28bf052002-03-31 07:16:08 +000073}
74
75
76
77
Chris Lattnerbb2a28f2002-03-26 22:39:06 +000078//===----------------------------------------------------------------------===//
79// DSNode Class Implementation
80//
81
82static void MapPVS(PointerValSet &PVSOut, const PointerValSet &PVSIn,
Chris Lattner1120c8b2002-03-28 17:56:03 +000083 map<const DSNode*, DSNode*> &NodeMap, bool ReinitOk = false){
84 assert((ReinitOk || PVSOut.empty()) && "Value set already initialized!");
Chris Lattnerbb2a28f2002-03-26 22:39:06 +000085
86 for (unsigned i = 0, e = PVSIn.size(); i != e; ++i)
87 PVSOut.add(PointerVal(NodeMap[PVSIn[i].Node], PVSIn[i].Index));
88}
89
90
91
92unsigned countPointerFields(const Type *Ty) {
93 switch (Ty->getPrimitiveID()) {
94 case Type::StructTyID: {
95 const StructType *ST = cast<StructType>(Ty);
96 unsigned Sum = 0;
97 for (unsigned i = 0, e = ST->getNumContainedTypes(); i != e; ++i)
98 Sum += countPointerFields(ST->getContainedType(i));
99
100 return Sum;
101 }
102
103 case Type::ArrayTyID:
104 // All array elements are folded together...
105 return countPointerFields(cast<ArrayType>(Ty)->getElementType());
106
107 case Type::PointerTyID:
108 return 1;
109
110 default: // Some other type, just treat it like a scalar
111 return 0;
112 }
113}
114
115DSNode::DSNode(enum NodeTy NT, const Type *T) : Ty(T), NodeType(NT) {
116 // Create field entries for all of the values in this type...
117 FieldLinks.resize(countPointerFields(getType()));
118}
119
120void DSNode::removeReferrer(PointerValSet *PVS) {
121 vector<PointerValSet*>::iterator I = std::find(Referrers.begin(),
122 Referrers.end(), PVS);
123 assert(I != Referrers.end() && "PVS not pointing to node!");
124 Referrers.erase(I);
125}
126
127
Chris Lattner6088c4f2002-03-27 19:46:05 +0000128// removeAllIncomingEdges - Erase all edges in the graph that point to this node
129void DSNode::removeAllIncomingEdges() {
130 while (!Referrers.empty())
131 Referrers.back()->removePointerTo(this);
132}
133
134
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000135static void replaceIn(std::string &S, char From, const std::string &To) {
136 for (unsigned i = 0; i < S.size(); )
137 if (S[i] == From) {
138 S.replace(S.begin()+i, S.begin()+i+1,
139 To.begin(), To.end());
140 i += To.size();
141 } else {
142 ++i;
143 }
144}
145
146static void writeEdges(std::ostream &O, const void *SrcNode,
147 const char *SrcNodePortName, int SrcNodeIdx,
148 const PointerValSet &VS, const string &EdgeAttr = "") {
149 for (unsigned j = 0, je = VS.size(); j != je; ++j) {
150 O << "\t\tNode" << SrcNode << SrcNodePortName;
151 if (SrcNodeIdx != -1) O << SrcNodeIdx;
152
153 O << " -> Node" << VS[j].Node;
154 if (VS[j].Index)
155 O << ":g" << VS[j].Index;
156
157 if (!EdgeAttr.empty())
158 O << "[" << EdgeAttr << "]";
159 O << ";\n";
160 }
161}
162
163static string escapeLabel(const string &In) {
164 string Label(In);
165 replaceIn(Label, '\\', "\\\\\\\\"); // Escape caption...
166 replaceIn(Label, ' ', "\\ ");
167 replaceIn(Label, '{', "\\{");
168 replaceIn(Label, '}', "\\}");
169 return Label;
170}
171
Chris Lattnerb28bf052002-03-31 07:16:08 +0000172void DSNode::dump() const { print(cerr); }
173
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000174void DSNode::print(std::ostream &O) const {
175 string Caption = escapeLabel(getCaption());
176
177 O << "\t\tNode" << (void*)this << " [ label =\"{" << Caption;
178
179 const vector<PointerValSet> *Links = getAuxLinks();
180 if (Links && !Links->empty()) {
181 O << "|{";
182 for (unsigned i = 0; i < Links->size(); ++i) {
183 if (i) O << "|";
184 O << "<f" << i << ">";
185 }
186 O << "}";
187 }
188
189 if (!FieldLinks.empty()) {
190 O << "|{";
191 for (unsigned i = 0; i < FieldLinks.size(); ++i) {
192 if (i) O << "|";
193 O << "<g" << i << ">";
194 }
195 O << "}";
196 }
197 O << "}\"];\n";
198
199 if (Links)
200 for (unsigned i = 0; i < Links->size(); ++i)
201 writeEdges(O, this, ":f", i, (*Links)[i]);
202 for (unsigned i = 0; i < FieldLinks.size(); ++i)
203 writeEdges(O, this, ":g", i, FieldLinks[i]);
204}
205
206void DSNode::mapNode(map<const DSNode*, DSNode*> &NodeMap, const DSNode *Old) {
207 assert(FieldLinks.size() == Old->FieldLinks.size() &&
208 "Cloned nodes do not have the same number of links!");
209 for (unsigned j = 0, je = FieldLinks.size(); j != je; ++j)
210 MapPVS(FieldLinks[j], Old->FieldLinks[j], NodeMap);
Chris Lattnerfe145682002-04-17 03:24:59 +0000211
212 // Map our SynthNodes...
213 assert(SynthNodes.empty() && "Synthnodes already mapped?");
214 SynthNodes.reserve(Old->SynthNodes.size());
215 for (unsigned i = 0, e = Old->SynthNodes.size(); i != e; ++i)
216 SynthNodes.push_back(std::make_pair(Old->SynthNodes[i].first,
217 (ShadowDSNode*)NodeMap[Old->SynthNodes[i].second]));
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000218}
219
Chris Lattner1120c8b2002-03-28 17:56:03 +0000220AllocDSNode::AllocDSNode(AllocationInst *V)
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000221 : DSNode(NewNode, V->getType()->getElementType()), Allocation(V) {
222}
223
Chris Lattner1120c8b2002-03-28 17:56:03 +0000224bool AllocDSNode::isAllocaNode() const {
Chris Lattner6088c4f2002-03-27 19:46:05 +0000225 return isa<AllocaInst>(Allocation);
226}
227
228
Chris Lattner1120c8b2002-03-28 17:56:03 +0000229string AllocDSNode::getCaption() const {
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000230 stringstream OS;
Chris Lattner6088c4f2002-03-27 19:46:05 +0000231 OS << (isMallocNode() ? "new " : "alloca ");
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000232
233 WriteTypeSymbolic(OS, getType(),
234 Allocation->getParent()->getParent()->getParent());
235 if (Allocation->isArrayAllocation())
236 OS << "[ ]";
237 return OS.str();
238}
239
240GlobalDSNode::GlobalDSNode(GlobalValue *V)
241 : DSNode(GlobalNode, V->getType()->getElementType()), Val(V) {
242}
243
244string GlobalDSNode::getCaption() const {
245 stringstream OS;
Chris Lattner7650b942002-04-16 20:39:59 +0000246 if (isa<Function>(Val))
247 OS << "fn ";
248 else
249 OS << "global ";
250
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000251 WriteTypeSymbolic(OS, getType(), Val->getParent());
Chris Lattner7650b942002-04-16 20:39:59 +0000252 return OS.str() + " %" + Val->getName();
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000253}
254
255
Chris Lattner7650b942002-04-16 20:39:59 +0000256ShadowDSNode::ShadowDSNode(const Type *Ty, Module *M) : DSNode(ShadowNode, Ty) {
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000257 Mod = M;
258 ShadowParent = 0;
259}
260
Chris Lattnerfe145682002-04-17 03:24:59 +0000261ShadowDSNode::ShadowDSNode(const Type *Ty, Module *M, DSNode *ShadParent)
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000262 : DSNode(ShadowNode, Ty) {
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000263 Mod = M;
264 ShadowParent = ShadParent;
265}
266
267std::string ShadowDSNode::getCaption() const {
268 stringstream OS;
Chris Lattner6088c4f2002-03-27 19:46:05 +0000269 OS << "shadow ";
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000270 WriteTypeSymbolic(OS, getType(), Mod);
Chris Lattner6088c4f2002-03-27 19:46:05 +0000271 return OS.str();
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000272}
273
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000274CallDSNode::CallDSNode(CallInst *ci) : DSNode(CallNode, ci->getType()), CI(ci) {
275 unsigned NumPtrs = 0;
Chris Lattner7650b942002-04-16 20:39:59 +0000276 for (unsigned i = 0, e = ci->getNumOperands(); i != e; ++i)
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000277 if (isa<PointerType>(ci->getOperand(i)->getType()))
278 NumPtrs++;
279 ArgLinks.resize(NumPtrs);
280}
281
282string CallDSNode::getCaption() const {
283 stringstream OS;
284 if (const Function *CM = CI->getCalledFunction())
285 OS << "call " << CM->getName();
286 else
287 OS << "call <indirect>";
Chris Lattneref35ff02002-04-17 03:42:51 +0000288 OS << ": ";
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000289 WriteTypeSymbolic(OS, getType(),
290 CI->getParent()->getParent()->getParent());
291 return OS.str();
292}
293
294void CallDSNode::mapNode(map<const DSNode*, DSNode*> &NodeMap,
295 const DSNode *O) {
Chris Lattner1120c8b2002-03-28 17:56:03 +0000296 const CallDSNode *Old = cast<CallDSNode>(O);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000297 DSNode::mapNode(NodeMap, Old); // Map base portions first...
298
299 assert(ArgLinks.size() == Old->ArgLinks.size() && "# Arguments changed!?");
300 for (unsigned i = 0, e = Old->ArgLinks.size(); i != e; ++i)
301 MapPVS(ArgLinks[i], Old->ArgLinks[i], NodeMap);
302}
303
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000304void FunctionDSGraph::printFunction(std::ostream &O,
305 const char *Label) const {
306 O << "\tsubgraph cluster_" << Label << "_Function" << (void*)this << " {\n";
307 O << "\t\tlabel=\"" << Label << " Function\\ " << Func->getName() << "\";\n";
Chris Lattner1120c8b2002-03-28 17:56:03 +0000308 for (unsigned i = 0, e = AllocNodes.size(); i != e; ++i)
309 AllocNodes[i]->print(O);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000310 for (unsigned i = 0, e = ShadowNodes.size(); i != e; ++i)
311 ShadowNodes[i]->print(O);
Chris Lattner1120c8b2002-03-28 17:56:03 +0000312 for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i)
313 GlobalNodes[i]->print(O);
314 for (unsigned i = 0, e = CallNodes.size(); i != e; ++i)
315 CallNodes[i]->print(O);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000316
317 if (RetNode.size()) {
318 O << "\t\tNode" << (void*)this << Label
319 << " [shape=\"ellipse\", label=\"Returns\"];\n";
320 writeEdges(O, this, Label, -1, RetNode);
321 }
322
323 O << "\n";
324 for (std::map<Value*, PointerValSet>::const_iterator I = ValueMap.begin(),
325 E = ValueMap.end(); I != E; ++I) {
Chris Lattner7650b942002-04-16 20:39:59 +0000326 if (I->second.size()) { // Only output nodes with edges...
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000327 stringstream OS;
328 WriteTypeSymbolic(OS, I->first->getType(), Func->getParent());
329
330 // Create node for I->first
331 O << "\t\tNode" << (void*)I->first << Label << " [shape=\"box\", label=\""
332 << escapeLabel(OS.str()) << "\\n%" << escapeLabel(I->first->getName())
333 << "\",fontsize=\"12.0\",color=\"gray70\"];\n";
334
335 // add edges from I->first to all pointers in I->second
336 writeEdges(O, I->first, Label, -1, I->second,
337 "weight=\"0.9\",color=\"gray70\"");
338 }
339 }
340
341 O << "\t}\n";
342}
343
344// Copy constructor - Since we copy the nodes over, we have to be sure to go
345// through and fix pointers to point into the new graph instead of into the old
346// graph...
347//
348FunctionDSGraph::FunctionDSGraph(const FunctionDSGraph &DSG) : Func(DSG.Func) {
Chris Lattner212be2e2002-04-16 03:44:03 +0000349 vector<PointerValSet> Args;
350 RetNode = cloneFunctionIntoSelf(DSG, true, Args);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000351}
352
353
354// cloneFunctionIntoSelf - Clone the specified method graph into the current
355// method graph, returning the Return's set of the graph. If ValueMap is set
356// to true, the ValueMap of the function is cloned into this function as well
Chris Lattner212be2e2002-04-16 03:44:03 +0000357// as the data structure graph itself. Regardless, the arguments value sets
358// of DSG are copied into Args.
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000359//
360PointerValSet FunctionDSGraph::cloneFunctionIntoSelf(const FunctionDSGraph &DSG,
Chris Lattner212be2e2002-04-16 03:44:03 +0000361 bool CloneValueMap,
362 vector<PointerValSet> &Args) {
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000363 map<const DSNode*, DSNode*> NodeMap; // Map from old graph to new graph...
Chris Lattner1120c8b2002-03-28 17:56:03 +0000364 unsigned StartAllocSize = AllocNodes.size();
365 AllocNodes.reserve(StartAllocSize+DSG.AllocNodes.size());
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000366 unsigned StartShadowSize = ShadowNodes.size();
367 ShadowNodes.reserve(StartShadowSize+DSG.ShadowNodes.size());
Chris Lattner1120c8b2002-03-28 17:56:03 +0000368 unsigned StartGlobalSize = GlobalNodes.size();
369 GlobalNodes.reserve(StartGlobalSize+DSG.GlobalNodes.size());
370 unsigned StartCallSize = CallNodes.size();
371 CallNodes.reserve(StartCallSize+DSG.CallNodes.size());
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000372
Chris Lattner1120c8b2002-03-28 17:56:03 +0000373 // Clone all of the alloc nodes similarly...
374 for (unsigned i = 0, e = DSG.AllocNodes.size(); i != e; ++i) {
375 AllocDSNode *New = cast<AllocDSNode>(DSG.AllocNodes[i]->clone());
376 NodeMap[DSG.AllocNodes[i]] = New;
377 AllocNodes.push_back(New);
378 }
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000379
380 // Clone all of the shadow nodes similarly...
Chris Lattnerdd3fc182002-03-27 00:54:31 +0000381 for (unsigned i = 0, e = DSG.ShadowNodes.size(); i != e; ++i) {
382 ShadowDSNode *New = cast<ShadowDSNode>(DSG.ShadowNodes[i]->clone());
383 NodeMap[DSG.ShadowNodes[i]] = New;
384 ShadowNodes.push_back(New);
385 }
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000386
Chris Lattner1120c8b2002-03-28 17:56:03 +0000387 // Clone all of the global nodes...
388 for (unsigned i = 0, e = DSG.GlobalNodes.size(); i != e; ++i) {
389 GlobalDSNode *New = cast<GlobalDSNode>(DSG.GlobalNodes[i]->clone());
390 NodeMap[DSG.GlobalNodes[i]] = New;
391 GlobalNodes.push_back(New);
392 }
393
394 // Clone all of the call nodes...
395 for (unsigned i = 0, e = DSG.CallNodes.size(); i != e; ++i) {
396 CallDSNode *New = cast<CallDSNode>(DSG.CallNodes[i]->clone());
397 NodeMap[DSG.CallNodes[i]] = New;
398 CallNodes.push_back(New);
399 }
400
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000401 // Convert all of the links over in the nodes now that the map has been filled
402 // in all the way...
403 //
Chris Lattner1120c8b2002-03-28 17:56:03 +0000404 for (unsigned i = 0, e = DSG.AllocNodes.size(); i != e; ++i)
405 AllocNodes[i+StartAllocSize]->mapNode(NodeMap, DSG.AllocNodes[i]);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000406 for (unsigned i = 0, e = DSG.ShadowNodes.size(); i != e; ++i)
407 ShadowNodes[i+StartShadowSize]->mapNode(NodeMap, DSG.ShadowNodes[i]);
Chris Lattner1120c8b2002-03-28 17:56:03 +0000408 for (unsigned i = 0, e = DSG.GlobalNodes.size(); i != e; ++i)
409 GlobalNodes[i+StartGlobalSize]->mapNode(NodeMap, DSG.GlobalNodes[i]);
410 for (unsigned i = 0, e = DSG.CallNodes.size(); i != e; ++i)
411 CallNodes[i+StartCallSize]->mapNode(NodeMap, DSG.CallNodes[i]);
412
Chris Lattner212be2e2002-04-16 03:44:03 +0000413 // Convert over the arguments...
414 Function *OF = DSG.getFunction();
415 for (Function::ArgumentListType::iterator I = OF->getArgumentList().begin(),
416 E = OF->getArgumentList().end(); I != E; ++I)
417 if (isa<PointerType>(((Value*)*I)->getType())) {
418 PointerValSet ArgPVS;
419 assert(DSG.getValueMap().find((Value*)*I) != DSG.getValueMap().end());
420 MapPVS(ArgPVS, DSG.getValueMap().find((Value*)*I)->second, NodeMap);
421 assert(!ArgPVS.empty() && "Argument has no links!");
422 Args.push_back(ArgPVS);
423 }
424
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000425
426 if (CloneValueMap) {
427 // Convert value map... the values themselves stay the same, just the nodes
428 // have to change...
429 //
430 for (std::map<Value*,PointerValSet>::const_iterator I =DSG.ValueMap.begin(),
431 E = DSG.ValueMap.end(); I != E; ++I)
Chris Lattner1120c8b2002-03-28 17:56:03 +0000432 MapPVS(ValueMap[I->first], I->second, NodeMap, true);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000433 }
434
435 // Convert over return node...
436 PointerValSet RetVals;
437 MapPVS(RetVals, DSG.RetNode, NodeMap);
438 return RetVals;
439}
440
441
442FunctionDSGraph::~FunctionDSGraph() {
443 RetNode.clear();
444 ValueMap.clear();
Chris Lattner1120c8b2002-03-28 17:56:03 +0000445 for_each(AllocNodes.begin(), AllocNodes.end(),
446 mem_fun(&DSNode::dropAllReferences));
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000447 for_each(ShadowNodes.begin(), ShadowNodes.end(),
448 mem_fun(&DSNode::dropAllReferences));
Chris Lattner1120c8b2002-03-28 17:56:03 +0000449 for_each(GlobalNodes.begin(), GlobalNodes.end(),
450 mem_fun(&DSNode::dropAllReferences));
451 for_each(CallNodes.begin(), CallNodes.end(),
452 mem_fun(&DSNode::dropAllReferences));
Chris Lattner1120c8b2002-03-28 17:56:03 +0000453 for_each(AllocNodes.begin(), AllocNodes.end(), deleter<DSNode>);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000454 for_each(ShadowNodes.begin(), ShadowNodes.end(), deleter<DSNode>);
Chris Lattner1120c8b2002-03-28 17:56:03 +0000455 for_each(GlobalNodes.begin(), GlobalNodes.end(), deleter<DSNode>);
456 for_each(CallNodes.begin(), CallNodes.end(), deleter<DSNode>);
Chris Lattnerbb2a28f2002-03-26 22:39:06 +0000457}
458