[llvm-commits] [poolalloc] r98128 - in /poolalloc/trunk: include/dsa/DSNode.h lib/DSA/Local.cpp

alenhar2 at llvm.org alenhar2 at llvm.org
Tue Mar 9 18:33:42 PST 2010


Author: alenhar2
Date: Tue Mar  9 20:33:42 2010
New Revision: 98128

URL: http://llvm.org/viewvc/llvm-project?rev=98128&view=rev
Log:
Handle aliases as normal variables

Modified:
    poolalloc/trunk/include/dsa/DSNode.h
    poolalloc/trunk/lib/DSA/Local.cpp

Modified: poolalloc/trunk/include/dsa/DSNode.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSNode.h?rev=98128&r1=98127&r2=98128&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSNode.h (original)
+++ poolalloc/trunk/include/dsa/DSNode.h Tue Mar  9 20:33:42 2010
@@ -278,6 +278,8 @@
   ///
   void addGlobal(const GlobalValue *GV);
 
+  void addFunction(const Function* F);
+
   /// removeGlobal - Remove the specified global that is explicitly in the
   /// globals list.
   void removeGlobal(const GlobalValue *GV);

Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=98128&r1=98127&r2=98128&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Tue Mar  9 20:33:42 2010
@@ -234,19 +234,19 @@
   // Check first for constant expressions that must be traversed to
   // extract the actual value.
   DSNode* N;
-  if (GlobalVariable* GV = dyn_cast<GlobalVariable>(V)) {
+  if (Function * F = dyn_cast<Function > (V)) {
+    // Create a new global node for this function.
+    N = createNode();
+    N->addFunction(F);
+    if (F->isDeclaration())
+      N->setExternFuncMarker();
+  } else if (GlobalValue * GV = dyn_cast<GlobalValue > (V)) {
     // Create a new global node for this global variable.
     N = createNode();
     N->addGlobal(GV);
     if (GV->isDeclaration())
       N->setExternGlobalMarker();
-  } else if (Function* GV = dyn_cast<Function>(V)) {
-    // Create a new global node for this function.
-    N = createNode();
-    N->addGlobal(GV);
-    if (GV->isDeclaration())
-      N->setExternFuncMarker();
-  } else if (Constant *C = dyn_cast<Constant>(V)) {
+  } else if (Constant * C = dyn_cast<Constant > (V)) {
     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
       if (CE->isCast()) {
         if (isa<PointerType>(CE->getOperand(0)->getType()))
@@ -269,13 +269,6 @@
     } else if (isa<UndefValue>(C)) {
       G.eraseNodeForValue(V);
       return 0;
-    } else if (isa<GlobalAlias>(C)) {
-      // XXX: Need more investigation
-      // According to Andrew, DSA is broken on global aliasing, since it does
-      // not handle the aliases of parameters correctly. Here is only a quick
-      // fix for some special cases.
-      NH = getValueDest(cast<GlobalAlias>(C)->getAliasee());
-      return NH;
     } else {
       errs() << "Unknown constant: " << *C << "\n";
       assert(0 && "Unknown constant type!");





More information about the llvm-commits mailing list