[llvm-commits] [llvm] r56195 - in /llvm/branches/ggreif/use-diet: include/llvm/Use.h lib/VMCore/getValue.cpp

Gabor Greif ggreif at gmail.com
Sun Sep 14 08:48:52 PDT 2008


Author: ggreif
Date: Sun Sep 14 10:48:51 2008
New Revision: 56195

URL: http://llvm.org/viewvc/llvm-project?rev=56195&view=rev
Log:
add some diagnostic facilities to squash the last bugs

Modified:
    llvm/branches/ggreif/use-diet/include/llvm/Use.h
    llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp

Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56195&r1=56194&r2=56195&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Sun Sep 14 10:48:51 2008
@@ -71,6 +71,10 @@
   Value *getValue() const;
   static Use *nilUse(const Value*); // marks the end of the def/use chain
   static bool isNil(Use *U) { return extractTag<NextPtrTag, tagMaskN>(U) == fullStopTagN; }
+  void showWaymarks() const;
+  static bool isStop(Use *U) {
+    return isStopTag(extractTag<NextPtrTag, tagMaskN>(U));
+  }
 public:
   /// init - specify Value and User
   /// @deprecated in 2.4, will be removed soon
@@ -104,6 +108,10 @@
                   , fullStopTagN = tagThree
                   , tagMaskN = tagThree };
 
+  static bool isStopTag(NextPtrTag T) {
+    bool P[] = { true, false, false, true };
+    return P[T];
+  }
   inline Value *getFastValueMaybe() const;
 public:
 
@@ -152,9 +160,13 @@
     *List = this;
   }
   void removeFromList() {
+    // __builtin_prefetch(Next);
     Use **StrippedPrev = stripTag<tagMask>(Prev);
-    *StrippedPrev = Next;
     Use *StrippedNext(getNext());
+    if (isStop(Next))
+      assert((isStop(*StrippedPrev) || (StrippedNext ? isStop(StrippedNext->Next) : true)) && "joining digits?");
+    *StrippedPrev = Next;
+  //    Use *StrippedNext(getNext());
     if (StrippedNext) StrippedNext->setPrev(StrippedPrev);
   }
 

Modified: llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp?rev=56195&r1=56194&r2=56195&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Sun Sep 14 10:48:51 2008
@@ -13,7 +13,9 @@
 
 #include "llvm/User.h"
 #include <new>
-#include <cassert>
+//#include <cassert>
+// this can later be removed:
+#include <iostream>
 
 namespace llvm {
 
@@ -295,6 +297,29 @@
     assert(V == ValComp && "Computed Value wrong?");
   return V;
 }
+
+static char TagChar(int Tag) {
+  return "s10S"[Tag];
+}
+
+void Use::showWaymarks() const {
+  const Use *me(this);
+  if (NextPtrTag Tag = extractTag<Use::NextPtrTag, Use::tagMaskN>(me)) {
+    me = stripTag<tagMaskN>(me);
+    std::cerr << '(' << TagChar(Tag) << ')';
+  }
+
+  me = me->Next;
+  NextPtrTag TagHere = extractTag<Use::NextPtrTag, Use::tagMaskN>(me);
+  std::cerr << TagChar(TagHere);
+
+  me = stripTag<tagMaskN>(me);
+  if (TagHere == fullStopTagN)
+    std::cerr << " ---> " << me << std::endl;
+  else
+    me->showWaymarks();
+}
+
 } // namespace llvm
 
 #if 0





More information about the llvm-commits mailing list