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

Gabor Greif ggreif at gmail.com
Mon Sep 15 08:16:58 PDT 2008


Author: ggreif
Date: Mon Sep 15 10:16:57 2008
New Revision: 56216

URL: http://llvm.org/viewvc/llvm-project?rev=56216&view=rev
Log:
make nilUse inline and prepare for getting rid of PrevU

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=56216&r1=56215&r2=56216&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Mon Sep 15 10:16:57 2008
@@ -69,7 +69,10 @@
   class UseWaymark;
   friend class UseWaymark;
   Value *getValue() const;
-  static Use *nilUse(const Value*); // marks the end of the def/use chain
+  /// nilUse - returns a 'token' that marks the end of the def/use chain
+  static Use *nilUse(const Value *V) {
+    return addTag((Use*)V, fullStopTagN);
+  }
   static bool isNil(Use *U) { return extractTag<NextPtrTag, tagMaskN>(U) == fullStopTagN; }
   void showWaymarks() const;
   static bool isStop(Use *U) {

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=56216&r1=56215&r2=56216&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Mon Sep 15 10:16:57 2008
@@ -62,7 +62,10 @@
 /// punchAwayDigits -- ensure that repainted area
 /// begins with a stop
 ///
-static inline void punchAwayDigits(Use *PrevU) {
+static inline void punchAwayDigits(Use *PrevU, Use **Uprev) {
+  if (PrevU)
+    assert(&PrevU->Next == stripTag<Use::tagMask>(Uprev) && "U->Prev differs from PrevU?");
+
     if (PrevU)
         PrevU->Next = stripTag<Use::tagMaskN>(PrevU->Next);
 }
@@ -149,7 +152,7 @@
             switch (Tag) {
                 case Use::fullStopTagN:
                     if (Cushion <= 0) {
-                        punchAwayDigits(PrevU);
+                        punchAwayDigits(PrevU, U->Prev);
                         repaintByCalculating(reinterpret_cast<unsigned long>(Next), U);
                     }
                     return reinterpret_cast<Value*>(Next);
@@ -191,7 +194,7 @@
   while (1) {
     switch (Tag) {
     case Use::fullStopTagN: {
-        punchAwayDigits(PrevU);
+        punchAwayDigits(PrevU, U->Prev);
         repaintByCalculating(reinterpret_cast<unsigned long>(Next), U);
         return reinterpret_cast<Value*>(Next);
     }
@@ -203,7 +206,7 @@
 
         while (1) {
             if (!digits) {
-                punchAwayDigits(PrevU);
+                punchAwayDigits(PrevU, U->Prev);
                 repaintByCopying(Tagspace, U);
                 return reinterpret_cast<Value*>(Acc << 2);
             }
@@ -216,7 +219,7 @@
             Next = stripTag<Use::tagMaskN>(Next);
             switch (Tag) {
                 case Use::fullStopTagN: {
-                    punchAwayDigits(PrevU);
+                    punchAwayDigits(PrevU, U->Prev);
                     repaintByCalculating(reinterpret_cast<unsigned long>(Next), U);
                     return reinterpret_cast<Value*>(Next);
                 }
@@ -289,11 +292,6 @@
   }
 }
 
-/*inline*/Use *Use::nilUse(const Value *V) {
-  // return 0;
-  return addTag((Use*)V, fullStopTagN);
-}
-
 static bool again(false);
 
 Value *Use::get() const {





More information about the llvm-commits mailing list