[llvm-commits] CVS: llvm-poolalloc/include/dsa/DSGraph.h DSNode.h

Andrew Lenharth alenhar2 at cs.uiuc.edu
Tue Apr 17 16:41:29 PDT 2007



Changes in directory llvm-poolalloc/include/dsa:

DSGraph.h updated: 1.114 -> 1.115
DSNode.h updated: 1.61 -> 1.62
---
Log message:

Normalize Flag names and functions, also add a couple informative ones

---
Diffs of the changes:  (+48 -43)

 DSGraph.h |    8 ++---
 DSNode.h  |   83 ++++++++++++++++++++++++++++++++------------------------------
 2 files changed, 48 insertions(+), 43 deletions(-)


Index: llvm-poolalloc/include/dsa/DSGraph.h
diff -u llvm-poolalloc/include/dsa/DSGraph.h:1.114 llvm-poolalloc/include/dsa/DSGraph.h:1.115
--- llvm-poolalloc/include/dsa/DSGraph.h:1.114	Wed Apr 11 12:37:43 2007
+++ llvm-poolalloc/include/dsa/DSGraph.h	Tue Apr 17 18:41:06 2007
@@ -415,7 +415,7 @@
     for (node_iterator I = node_begin(), E = node_end(); I != E; ++I)
       I->maskNodeTypes(Mask);
   }
-  void maskIncompleteMarkers() { maskNodeTypes(~DSNode::Incomplete); }
+  void maskIncompleteMarkers() { maskNodeTypes(~DSNode::IncompleteNode); }
 
   // markIncompleteNodes - Traverse the graph, identifying nodes that may be
   // modified by other functions that have not been resolved yet.  This marks
@@ -564,13 +564,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::DEAD;
+    BitsToKeep = ~DSNode::DeadNode;
     if (CloneFlags & DSGraph::StripAllocaBit)
       BitsToKeep &= ~DSNode::AllocaNode;
     if (CloneFlags & DSGraph::StripModRefBits)
-      BitsToKeep &= ~(DSNode::Modified | DSNode::Read);
+      BitsToKeep &= ~(DSNode::ModifiedNode | DSNode::ReadNode);
     if (CloneFlags & DSGraph::StripIncompleteBit)
-      BitsToKeep &= ~DSNode::Incomplete;
+      BitsToKeep &= ~DSNode::IncompleteNode;
   }
 
   DSNodeHandle getClonedNH(const DSNodeHandle &SrcNH);


Index: llvm-poolalloc/include/dsa/DSNode.h
diff -u llvm-poolalloc/include/dsa/DSNode.h:1.61 llvm-poolalloc/include/dsa/DSNode.h:1.62
--- llvm-poolalloc/include/dsa/DSNode.h:1.61	Wed Dec 13 23:51:06 2006
+++ llvm-poolalloc/include/dsa/DSNode.h	Tue Apr 17 18:41:06 2007
@@ -80,20 +80,23 @@
   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
-    Incomplete  = 1 << 4,   // This node may not be complete
+    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
 
-    Modified    = 1 << 5,   // This node is modified in this context
-    Read        = 1 << 6,   // This node is read in this context
-
-    Array       = 1 << 7,   // This node is treated like an array
-    External    = 1 << 8,   // This node comes from an external source
     //#ifndef NDEBUG
-    DEAD        = 1 << 9,   // This node is dead and should not be pointed to
+    DeadNode        = 1 << 11,   // This node is dead and should not be pointed to
     //#endif
 
     Composition = AllocaNode | HeapNode | GlobalNode | UnknownNode
@@ -147,7 +150,7 @@
   ///
   const Type *getType() const { return Ty; }
 
-  bool isArray() const { return NodeType & Array; }
+  bool isArray() const { return NodeType & ArrayNode; }
 
   /// hasNoReferrers - Return true if nothing is pointing to this node at all.
   ///
@@ -332,36 +335,38 @@
   /// getNodeFlags - Return all of the flags set on the node.  If the DEAD flag
   /// is set, hide it from the caller.
   ///
-  unsigned getNodeFlags() const { return NodeType & ~DEAD; }
+  unsigned getNodeFlags() const { return NodeType & ~DeadNode; }
 
-  bool isAllocaNode()  const { return NodeType & AllocaNode; }
-  bool isHeapNode()    const { return NodeType & HeapNode; }
-  bool isGlobalNode()  const { return NodeType & GlobalNode; }
-  bool isUnknownNode() const { return NodeType & UnknownNode; }
-
-  bool isModified() const   { return NodeType & Modified; }
-  bool isRead() const       { return NodeType & Read; }
-
-  bool isIncomplete() const { return NodeType & Incomplete; }
-  bool isComplete() const   { return !isIncomplete(); }
-  bool isDeadNode() const   { return NodeType & DEAD; }
-  bool isExternalNode() const { return NodeType & External; }
-
-  DSNode *setAllocaNodeMarker()  { NodeType |= AllocaNode;  return this; }
-  DSNode *setHeapNodeMarker()    { NodeType |= HeapNode;    return this; }
-  DSNode *setGlobalNodeMarker()  { NodeType |= GlobalNode;  return this; }
-  DSNode *setUnknownNodeMarker() { NodeType |= UnknownNode; return this; }
-
-  DSNode *setExternalMarker() { NodeType |= External; return this; }
-  DSNode *setIncompleteMarker() { NodeType |= Incomplete; return this; }
-  DSNode *setModifiedMarker()   { NodeType |= Modified;   return this; }
-  DSNode *setReadMarker()       { NodeType |= Read;       return this; }
-  DSNode *setArrayMarker()      { NodeType |= Array; return this; }
+  bool isAllocaNode()     const { return NodeType & AllocaNode;    }
+  bool isHeapNode()       const { return NodeType & HeapNode;      }
+  bool isGlobalNode()     const { return NodeType & GlobalNode;    }
+  bool isUnknownNode()    const { return NodeType & UnknownNode;   }
+  bool isModifiedNode()   const { return NodeType & ModifiedNode;  }
+  bool isReadNode()       const { return NodeType & ReadNode;      }
+  bool isArrayNode()      const { return NodeType & ArrayNode;     }
+  bool isIncompleteNode() const { return NodeType & IncompleteNode;}
+  bool isCompleteNode()   const { return !isIncompleteNode();      }
+  bool isDeadNode()       const { return NodeType & DeadNode;      }
+  bool isExternalNode()   const { return NodeType & ExternalNode;  }
+  bool isIntToPtrNode()   const { return NodeType & IntToPtrNode;  }
+  bool isPtrToIntNode()   const { return NodeType & PtrToIntNode;  }
+
+  DSNode* setAllocaMarker()     { NodeType |= AllocaNode;     return this; }
+  DSNode* setHeapMarker()       { NodeType |= HeapNode;       return this; }
+  DSNode* setGlobalMarker()     { NodeType |= GlobalNode;     return this; }
+  DSNode* setUnknownMarker()    { NodeType |= UnknownNode;    return this; }
+  DSNode* setModifiedMarker()   { NodeType |= ModifiedNode;   return this; }
+  DSNode* setReadMarker()       { NodeType |= ReadNode;       return this; }
+  DSNode* setArrayMarker()      { NodeType |= ArrayNode;      return this; }
+  DSNode* setIncompleteMarker() { NodeType |= IncompleteNode; return this; }
+  DSNode* setExternalMarker()   { NodeType |= ExternalNode;   return this; }
+  DSNode* setIntToPtrMarker()   { NodeType |= IntToPtrNode;   return this; }
+  DSNode* setPtrToIntMarker()   { NodeType |= PtrToIntNode;   return this; }
 
   void makeNodeDead() {
     Globals.clear();
     assert(hasNoReferrers() && "Dead node shouldn't have refs!");
-    NodeType = DEAD;
+    NodeType = DeadNode;
   }
 
   /// forwardNode - Mark this node as being obsolete, and all references to it
@@ -463,7 +468,7 @@
       Offset = 0;
     }
   }
-  assert(!N || ((N->NodeType & DSNode::DEAD) == 0));
+  assert(!N || ((N->NodeType & DSNode::DeadNode) == 0));
   assert((!N || Offset < N->Size || (N->Size == 0 && Offset == 0) ||
           N->isForwarding()) && "Node handle offset out of range!");
 }






More information about the llvm-commits mailing list