[llvm-commits] [poolalloc] r80714 - in /poolalloc/trunk: include/rdsa/DataStructure.h lib/Makefile lib/rDSA/Basic.cpp lib/rDSA/DataStructure.cpp

Andrew Lenharth alenhar2 at cs.uiuc.edu
Tue Sep 1 12:08:18 PDT 2009


Author: alenhar2
Date: Tue Sep  1 14:08:18 2009
New Revision: 80714

URL: http://llvm.org/viewvc/llvm-project?rev=80714&view=rev
Log:
bring rDSA up to 2.6

Removed:
    poolalloc/trunk/lib/rDSA/Basic.cpp
Modified:
    poolalloc/trunk/include/rdsa/DataStructure.h
    poolalloc/trunk/lib/Makefile
    poolalloc/trunk/lib/rDSA/DataStructure.cpp

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

==============================================================================
--- poolalloc/trunk/include/rdsa/DataStructure.h (original)
+++ poolalloc/trunk/include/rdsa/DataStructure.h Tue Sep  1 14:08:18 2009
@@ -171,25 +171,6 @@
   void copyValue(Value *From, Value *To);
 };
 
-// BasicDataStructures - The analysis is a dummy one -- all pointers can points
-// to all possible locations.
-//
-class BasicDataStructures : public DataStructures {
-public:
-  static char ID;
-  BasicDataStructures() : DataStructures((intptr_t)&ID, "basic.") {}
-  ~BasicDataStructures() { releaseMemory(); }
-
-  virtual bool runOnModule(Module &M);
-
-  /// getAnalysisUsage - This obviously provides a data structure graph.
-  ///
-  virtual void getAnalysisUsage(AnalysisUsage &AU) const {
-    AU.addRequired<TargetData>();
-    AU.setPreservesAll();
-  }
-};
-
 // LocalDataStructures - The analysis that computes the local data structure
 // graphs for all of the functions in the program.
 //

Modified: poolalloc/trunk/lib/Makefile
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/Makefile?rev=80714&r1=80713&r2=80714&view=diff

==============================================================================
--- poolalloc/trunk/lib/Makefile (original)
+++ poolalloc/trunk/lib/Makefile Tue Sep  1 14:08:18 2009
@@ -6,6 +6,6 @@
 #
 # List all of the subdirectories that we will compile.
 #
-DIRS=DSA PoolAllocate AssistDS
+DIRS=DSA PoolAllocate AssistDS rDSA
 
 include $(LEVEL)/Makefile.common

Removed: poolalloc/trunk/lib/rDSA/Basic.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/rDSA/Basic.cpp?rev=80713&view=auto

==============================================================================
--- poolalloc/trunk/lib/rDSA/Basic.cpp (original)
+++ poolalloc/trunk/lib/rDSA/Basic.cpp (removed)
@@ -1,85 +0,0 @@
-//===- Basic.cpp ----------------------------------------------------------===//
-//
-//                     The LLVM Compiler Infrastructure
-//
-// This file was developed by the LLVM research group and is distributed under
-// the University of Illinois Open Source License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Implementation of the basic data structure analysis pass. It simply assumes
-// that all pointers can points to all possible locations.
-//
-//===----------------------------------------------------------------------===//
-
-#include "rdsa/DataStructure.h"
-#include "rdsa/DSGraph.h"
-
-#include "llvm/Module.h"
-#include "llvm/DerivedTypes.h"
-#include "llvm/Constants.h"
-#include "llvm/Instructions.h"
-#include "llvm/Intrinsics.h"
-#include "llvm/Support/InstIterator.h"
-#include "llvm/Support/InstVisitor.h"
-#include "llvm/Support/GetElementPtrTypeIterator.h"
-
-using namespace llvm;
-
-static RegisterPass<BasicDataStructures>
-X("dsa-basic", "Basic Data Structure Analysis(No Analysis)");
-
-char BasicDataStructures::ID = 0;
-
-bool BasicDataStructures::runOnModule(Module &M) {
-  init(&getAnalysis<TargetData>());
-
-  DSNode * GVNodeInternal = new DSNode(PointerType::getUnqual(Type::Int8Ty), GlobalsGraph);
-  DSNode * GVNodeExternal = new DSNode(PointerType::getUnqual(Type::Int8Ty), GlobalsGraph);
-  for (Module::global_iterator I = M.global_begin(), E = M.global_end();
-       I != E; ++I) {
-    if (I->isDeclaration()) {
-      GlobalsGraph->getNodeForValue(&*I).mergeWith(GVNodeExternal);
-    } else {
-      GlobalsGraph->getNodeForValue(&*I).mergeWith(GVNodeInternal);
-    }
-  }
-
-  GVNodeInternal->foldNodeCompletely();
-  GVNodeInternal->maskNodeTypes(DSNode::IncompleteNode);
-
-  GVNodeExternal->foldNodeCompletely();
-
-  // Next step, iterate through the nodes in the globals graph, unioning
-  // together the globals into equivalence classes.
-  formGlobalECs();
-
-  for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
-    if (!F->isDeclaration()) {
-      DSGraph* G = new DSGraph(GlobalECs, getTargetData(), GlobalsGraph);
-      DSNode * Node = new DSNode(PointerType::getUnqual(Type::Int8Ty), G);
-          
-      if (!F->hasInternalLinkage())
-        Node->setExternalMarker();
-
-      // Create scalar nodes for all pointer arguments...
-      for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end();
-          I != E; ++I) {
-        if (isa<PointerType>(I->getType())) {
-          G->getNodeForValue(&*I).mergeWith(Node);
-        }
-      }
-
-      for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) {
-        G->getNodeForValue(&*I).mergeWith(Node);
-      }
-
-      Node->foldNodeCompletely();
-      Node->maskNodeTypes(DSNode::IncompleteNode);
-
-      setDSGraph(F, G);
-    }
-  }
- 
-  return false;
-}

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

==============================================================================
--- poolalloc/trunk/lib/rDSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/rDSA/DataStructure.cpp Tue Sep  1 14:08:18 2009
@@ -120,7 +120,7 @@
 //===----------------------------------------------------------------------===//
 
 DSNode::DSNode(const Type *T, DSGraph *G)
-  : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::VoidTy), NodeType(0) {
+  : NumReferrers(0), Size(0), ParentGraph(G), Ty(Type::getVoidTy(getGlobalContext())), NodeType(0) {
   // Add the type entry if it is specified...
   if (T) mergeTypeInfo(T, 0);
   if (G) G->addNode(this);
@@ -162,8 +162,8 @@
 }
 
 void DSNode::assertOK() const {
-  assert((Ty != Type::VoidTy ||
-          (Ty == Type::VoidTy && (Size == 0 ||
+  assert((Ty != Type::getVoidTy(getGlobalContext()) ||
+          (Ty == Type::getVoidTy(getGlobalContext()) && (Size == 0 ||
                                   (NodeType & DSNode::ArrayNode)))) &&
          "Node not OK!");
 
@@ -187,7 +187,7 @@
   ForwardNH.setTo(To, Offset);
   NodeType = DeadNode;
   Size = 0;
-  Ty = Type::VoidTy;
+  Ty = Type::getVoidTy(getGlobalContext());
 
   // Remove this node from the parent graph's Nodes list.
   ParentGraph->unlinkNode(this);
@@ -243,7 +243,7 @@
   // node.
   if (getSize() <= 1) {
     NodeType |= DSNode::ArrayNode;
-    Ty = Type::VoidTy;
+    Ty = Type::getVoidTy(getGlobalContext());
     Size = 1;
     assert(Links.size() <= 1 && "Size is 1, but has more links?");
     Links.resize(1);
@@ -253,7 +253,7 @@
     // forward, the forwarder has the opportunity to correct the offset.
     DSNode *DestNode = new DSNode(0, ParentGraph);
     DestNode->NodeType = NodeType|DSNode::ArrayNode;
-    DestNode->Ty = Type::VoidTy;
+    DestNode->Ty = Type::getVoidTy(getGlobalContext());
     DestNode->Size = 1;
     DestNode->Globals.swap(Globals);
     
@@ -295,7 +295,7 @@
 /// all of the field sensitivity that may be present in the node.
 ///
 bool DSNode::isNodeCompletelyFolded() const {
-  return getSize() == 1 && Ty == Type::VoidTy && isArray();
+  return getSize() == 1 && Ty == Type::getVoidTy(getGlobalContext()) && isArray();
 }
 
 /// addFullGlobalsList - Compute the full set of global values that are
@@ -474,13 +474,13 @@
   //  Size = 1, Ty = Void, Array = 1: The node is collapsed
   //  Otherwise, sizeof(Ty) = Size
   //
-  assert(((Size == 0 && Ty == Type::VoidTy && !isArray()) ||
+  assert(((Size == 0 && Ty == Type::getVoidTy(getGlobalContext()) && !isArray()) ||
           (Size == 0 && !Ty->isSized() && !isArray()) ||
-          (Size == 1 && Ty == Type::VoidTy && isArray()) ||
+          (Size == 1 && Ty == Type::getVoidTy(getGlobalContext()) && isArray()) ||
           (Size == 0 && !Ty->isSized() && !isArray()) ||
           (TD.getTypeAllocSize(Ty) == Size)) &&
          "Size member of DSNode doesn't match the type structure!");
-  assert(NewTy != Type::VoidTy && "Cannot merge void type into DSNode!");
+  assert(NewTy != Type::getVoidTy(getGlobalContext()) && "Cannot merge void type into DSNode!");
 
   if (Offset == 0 && NewTy == Ty)
     return false;  // This should be a common case, handle it efficiently
@@ -507,7 +507,7 @@
   // we can't, we fold the node completely, if we can, we potentially update our
   // internal state.
   //
-  if (Ty == Type::VoidTy) {
+  if (Ty == Type::getVoidTy(getGlobalContext())) {
     // If this is the first type that this node has seen, just accept it without
     // question....
     assert(Offset == 0 && !isArray() &&
@@ -892,7 +892,7 @@
   }
 #endif  
   // Merge the type entries of the two nodes together...
-  if (NH.getNode()->Ty != Type::VoidTy)
+  if (NH.getNode()->Ty != Type::getVoidTy(getGlobalContext()))
     CurNodeH.getNode()->mergeTypeInfo(NH.getNode()->Ty, NOffset);
   assert(!CurNodeH.getNode()->isDeadNode());
 
@@ -1154,7 +1154,7 @@
       }
 
       // Merge the type entries of the two nodes together...
-      if (SN->getType() != Type::VoidTy && !DN->isNodeCompletelyFolded()) {
+      if (SN->getType() != Type::getVoidTy(getGlobalContext()) && !DN->isNodeCompletelyFolded()) {
         DN->mergeTypeInfo(SN->getType(), NH.getOffset()-SrcNH.getOffset());
         DN = NH.getNode();
       }
@@ -1980,7 +1980,7 @@
     if (N->getNumReferrers() == 1)  // Does it point to a lonely node?
       // No interesting info?
       if ((N->getNodeFlags() & ~DSNode::IncompleteNode) == 0 &&
-          N->getType() == Type::VoidTy && !N->isNodeCompletelyFolded())
+          N->getType() == Type::getVoidTy(getGlobalContext()) && !N->isNodeCompletelyFolded())
         Edge.setTo(0, 0);  // Kill the edge!
 }
 





More information about the llvm-commits mailing list