[llvm-commits] [poolalloc] r81292 - in /poolalloc/trunk: include/rdsa/DSGraph.h include/rdsa/DSNode.h lib/rDSA/DataStructure.cpp lib/rDSA/GraphChecker.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Tue Sep 8 17:08:05 PDT 2009


Author: alenhar2
Date: Tue Sep  8 19:08:04 2009
New Revision: 81292

URL: http://llvm.org/viewvc/llvm-project?rev=81292&view=rev
Log:
finish factoring Flags

Modified:
    poolalloc/trunk/include/rdsa/DSGraph.h
    poolalloc/trunk/include/rdsa/DSNode.h
    poolalloc/trunk/lib/rDSA/DataStructure.cpp
    poolalloc/trunk/lib/rDSA/GraphChecker.cpp

Modified: poolalloc/trunk/include/rdsa/DSGraph.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DSGraph.h?rev=81292&r1=81291&r2=81292&view=diff

==============================================================================
--- poolalloc/trunk/include/rdsa/DSGraph.h (original)
+++ poolalloc/trunk/include/rdsa/DSGraph.h Tue Sep  8 19:08:04 2009
@@ -592,13 +592,13 @@
   ReachabilityCloner(DSGraph* dest, const DSGraph* src, unsigned cloneFlags)
     : Dest(dest), Src(src), CloneFlags(cloneFlags) {
     assert(Dest != Src && "Cannot clone from graph to same graph!");
-    BitsToKeep = ~DSNode::DeadNode;
+    BitsToKeep = ~DSFlags::DeadNode;
     if (CloneFlags & DSGraph::StripAllocaBit)
-      BitsToKeep &= ~DSNode::AllocaNode;
+      BitsToKeep &= ~DSFlags::AllocaNode;
     if (CloneFlags & DSGraph::StripModRefBits)
-      BitsToKeep &= ~(DSNode::ModifiedNode | DSNode::ReadNode);
+      BitsToKeep &= ~(DSFlags::ModifiedNode | DSFlags::ReadNode);
     if (CloneFlags & DSGraph::StripIncompleteBit)
-      BitsToKeep &= ~DSNode::IncompleteNode;
+      BitsToKeep &= ~DSFlags::IncompleteNode;
   }
 
   DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);

Modified: poolalloc/trunk/include/rdsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/rdsa/DSNode.h?rev=81292&r1=81291&r2=81292&view=diff

==============================================================================
--- poolalloc/trunk/include/rdsa/DSNode.h (original)
+++ poolalloc/trunk/include/rdsa/DSNode.h Tue Sep  8 19:08:04 2009
@@ -74,39 +74,12 @@
   ///
   std::vector<DSNodeHandle> Links;
 
-  /// Globals - The list of global values that are merged into this node.
-  ///
-  std::vector<const GlobalValue*> Globals;
-
   void operator=(const DSNode &); // DO NOT IMPLEMENT
   DSNode(const DSNode &);         // DO NOT IMPLEMENT
-public:
-  enum NodeTy {
-    ShadowNode         = 0,        // Nothing is known about this node...
-    AllocaNode         = 1 << 0,   // This node was allocated with alloca
-    HeapNode           = 1 << 1,   // This node was allocated with malloc
-    GlobalNode         = 1 << 2,   // This node was allocated by a global var decl
-    UnknownNode        = 1 << 3,   // This node points to unknown allocated memory
-    IncompleteNode     = 1 << 4,   // This node may not be complete
-
-    ModifiedNode       = 1 << 5,   // This node is modified in this context
-    ReadNode           = 1 << 6,   // This node is read in this context
-
-    ArrayNode          = 1 << 7,   // This node is treated like an array
-    ExternalNode       = 1 << 8,   // This node comes from an external source
-    IntToPtrNode       = 1 << 9,   // This node comes from an int cast
-    PtrToIntNode       = 1 << 10,  // This node excapes to an int cast
-    VAStartNode        = 1 << 11,  // This node excapes to an int cast
-
-    FunctionNode       = 1 << 12,  // This node contains a function
-    ExternFunctionNode = 1 << 13, // This node contains an extern func
-
-    //#ifndef NDEBUG
-    DeadNode           = 1 << 14,   // This node is dead and should not be pointed to
-    //#endif
 
-    Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode
-  };
+  /// Globals - The list of global values that are merged into this node.
+  ///
+  std::vector<const GlobalValue*> Globals;
 
 public:
   DSFlags NodeType;

Modified: poolalloc/trunk/lib/rDSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/DataStructure.cpp?rev=81292&r1=81291&r2=81292&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/rDSA/DataStructure.cpp Tue Sep  8 19:08:04 2009
@@ -1334,10 +1334,10 @@
   NodeMapTy OldNodeMap;
 
   // Remove alloca or mod/ref bits as specified...
-  unsigned BitsToClear = ((CloneFlags & StripAllocaBit)? DSNode::AllocaNode : 0)
-    | ((CloneFlags & StripModRefBits)? (DSNode::ModifiedNode | DSNode::ReadNode) : 0)
-    | ((CloneFlags & StripIncompleteBit)? DSNode::IncompleteNode : 0);
-  BitsToClear |= DSNode::DeadNode;  // Clear dead flag...
+  unsigned BitsToClear = ((CloneFlags & StripAllocaBit)? DSFlags::AllocaNode : 0)
+    | ((CloneFlags & StripModRefBits)? (DSFlags::ModifiedNode | DSFlags::ReadNode) : 0)
+    | ((CloneFlags & StripIncompleteBit)? DSFlags::IncompleteNode : 0);
+  BitsToClear |= DSFlags::DeadNode;  // Clear dead flag...
 
   for (node_const_iterator I = G->node_begin(), E = G->node_end(); I != E; ++I) {
     assert(!I->isForwarding() &&
@@ -1802,7 +1802,7 @@
   if (DSNode *N = Edge.getNode())  // Is there an edge?
     if (N->getNumReferrers() == 1)  // Does it point to a lonely node?
       // No interesting info?
-      if ((N->getNodeFlags() & ~DSNode::IncompleteNode) == 0 &&
+      if ((N->getNodeFlags() & ~DSFlags::IncompleteNode) == 0 &&
           N->getType() == Type::getVoidTy(getGlobalContext()) && !N->isNodeCompletelyFolded())
         Edge.setTo(0, 0);  // Kill the edge!
 }

Modified: poolalloc/trunk/lib/rDSA/GraphChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/GraphChecker.cpp?rev=81292&r1=81291&r2=81292&view=diff

==============================================================================
--- poolalloc/trunk/lib/rDSA/GraphChecker.cpp (original)
+++ poolalloc/trunk/lib/rDSA/GraphChecker.cpp Tue Sep  8 19:08:04 2009
@@ -153,14 +153,14 @@
       unsigned Flags = 0;
       for (unsigned C = ColonPos+1; C != I->size(); ++C)
         switch ((*I)[C]) {
-        case 'S': Flags |= DSNode::AllocaNode;      break;
-        case 'H': Flags |= DSNode::HeapNode;        break;
-        case 'G': Flags |= DSNode::GlobalNode;      break;
-        case 'U': Flags |= DSNode::UnknownNode;     break;
-        case 'I': Flags |= DSNode::IncompleteNode;  break;
-        case 'M': Flags |= DSNode::ModifiedNode;    break;
-        case 'R': Flags |= DSNode::ReadNode;        break;
-        case 'A': Flags |= DSNode::ArrayNode;       break;
+        case 'S': Flags |= DSFlags::AllocaNode;      break;
+        case 'H': Flags |= DSFlags::HeapNode;        break;
+        case 'G': Flags |= DSFlags::GlobalNode;      break;
+        case 'U': Flags |= DSFlags::UnknownNode;     break;
+        case 'I': Flags |= DSFlags::IncompleteNode;  break;
+        case 'M': Flags |= DSFlags::ModifiedNode;    break;
+        case 'R': Flags |= DSFlags::ReadNode;        break;
+        case 'A': Flags |= DSFlags::ArrayNode;       break;
         default: cerr << "Invalid DSNode flag!\n"; abort();
         }
       CheckFlagsM[std::string(I->begin(), I->begin()+ColonPos)] = Flags;





More information about the llvm-commits mailing list