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

Gabor Greif ggreif at gmail.com
Fri Mar 28 15:32:52 PDT 2008


Author: ggreif
Date: Fri Mar 28 17:32:52 2008
New Revision: 48929

URL: http://llvm.org/viewvc/llvm-project?rev=48929&view=rev
Log:
make this compilable, interface still not final, cosmetics

Modified:
    llvm/branches/ggreif/use-diet/include/llvm/Use.h
    llvm/branches/ggreif/use-diet/lib/VMCore/Use.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=48929&r1=48928&r2=48929&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Fri Mar 28 17:32:52 2008
@@ -49,6 +49,7 @@
   operator Value*() const { return Val; }
   Value *get() const { return Val; }
   User *getUser() const { return U; }
+  const Use* getImpliedUser() const;
 
   inline void set(Value *Val);
 

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

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Fri Mar 28 17:32:52 2008
@@ -11,7 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "llvm/Use.h"
+#include "llvm/Value.h"
 
 namespace llvm {
 
@@ -20,31 +20,30 @@
 //===----------------------------------------------------------------------===//
 
 const Use *Use::getImpliedUser() const {
+  bool StopEncountered = false;
+  ptrdiff_t Offset = 0;
+  const Use *Current = this;
+  enum { stop = 0x2, fullstop = 0x3 };
+
+  while (true) {
+    unsigned Tag = unsigned(Current->Val) & 0x3;
+    switch (Tag)
+      {
+      case 0:
+      case 1:   // digits
+	if (StopEncountered)
+	  Offset = (Offset << 1) + Tag;
+	break;
+      case stop:
+	if (StopEncountered)
+	  return Current + Offset;
+	StopEncountered = true;
+	break;
+      case fullstop:
+	return Current + 1;
+      }
 
-    bool StopEncountered = false;
-    ptrdiff_t Offset = 0;
-    const Use *Current = this;
-
-    while (true) 
-    {
-        unsigned Tag = unsigned(Current->Val) & 0x3;
-        switch (Tag)
-        {
-            case 0:
-            case 1:   // digits
-                if (StopEncountered)
-                    Offset = (Offset << 1) + Tag;
-                break;
-            case 0x2: // stop
-                if (StopEncountered)
-                    return Current + Offset;
-                StopEncountered = true;
-                break;
-            case 0x3: // full stop
-                return Current + 1;
-        }
-
-        ++Current;
-    }
+    ++Current;
+  }
 }
 }





More information about the llvm-commits mailing list