[llvm-commits] CVS: llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp StructureFieldVisitor.h

Chris Lattner lattner at cs.uiuc.edu
Sun Apr 24 13:09:35 PDT 2005



Changes in directory llvm-poolalloc/lib/Macroscopic:

StructureFieldVisitor.cpp updated: 1.2 -> 1.3
StructureFieldVisitor.h updated: 1.2 -> 1.3
---
Log message:

add a method to shared code


---
Diffs of the changes:  (+34 -0)

 StructureFieldVisitor.cpp |   26 ++++++++++++++++++++++++++
 StructureFieldVisitor.h   |    8 ++++++++
 2 files changed, 34 insertions(+)


Index: llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp
diff -u llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp:1.2 llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp:1.3
--- llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp:1.2	Sat Apr 23 15:36:58 2005
+++ llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.cpp	Sun Apr 24 15:09:19 2005
@@ -24,6 +24,32 @@
 using namespace llvm::Macroscopic;
 using namespace llvm;
 
+/// FindAllDataStructures - Inspect the program specified by ECG, adding to
+/// 'Nodes' all of the data structures node in the program that contain the
+/// "IncludeFlags" and do not contain "ExcludeFlags" node flags.  If
+/// OnlyHomogenous is true, only type-homogenous nodes are considered.
+void FindAllDataStructures(std::set<DSNode*> &Nodes, unsigned IncludeFlags,
+                           unsigned ExcludeFlags, bool OnlyHomogenous,
+                           EquivClassGraphs &ECG) {
+  // Loop over all of the graphs in ECG, finding nodes that are not incomplete
+  // and do not have any of the flags specified by Flags.
+  ExcludeFlags |= DSNode::Incomplete;
+
+  /// FIXME: nodes in the global graph should not be marked incomplete in main!!
+  for (hash_map<const Function*, DSGraph*>::iterator GI = ECG.DSInfo.begin(),
+         E = ECG.DSInfo.end(); GI != E; ++GI) {
+    assert(GI->second && "Null graph pointer?");
+    DSGraph &G = *GI->second;
+    for (DSGraph::node_iterator I = G.node_begin(), E = G.node_end();
+         I != E; ++I)
+      // If this node matches our constraints, include it.
+      if ((I->getNodeFlags() & IncludeFlags) == IncludeFlags &&
+          (I->getNodeFlags() & ExcludeFlags) == 0)
+        if (!OnlyHomogenous || !I->isNodeCompletelyFolded())
+          Nodes.insert(I);
+  }
+}
+
 //===----------------------------------------------------------------------===//
 // LatticeValue class implementation
 //


Index: llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.h
diff -u llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.h:1.2 llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.h:1.3
--- llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.h:1.2	Sat Apr 23 15:36:58 2005
+++ llvm-poolalloc/lib/Macroscopic/StructureFieldVisitor.h	Sun Apr 24 15:09:19 2005
@@ -32,6 +32,14 @@
 
 namespace Macroscopic {
 
+/// FindAllDataStructures - Inspect the program specified by ECG, adding to
+/// 'Nodes' all of the data structures node in the program that contain the
+/// "IncludeFlags" and do not contain "ExcludeFlags" node flags.  If
+/// OnlyHomogenous is true, only type-homogenous nodes are considered.
+void FindAllDataStructures(std::set<DSNode*> &Nodes, unsigned IncludeFlags,
+                           unsigned ExcludeFlags, bool OnlyHomogenous,
+                           EquivClassGraphs &ECG);
+
 //===----------------------------------------------------------------------===//
 /// Visit types - This describes an enum specifying which methods are
 /// overloaded in the concrete implementation of the LatticeValue class.






More information about the llvm-commits mailing list