[llvm-branch-commits] [llvm-branch] r109437 - /llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp

Gabor Greif ggreif at gmail.com
Mon Jul 26 14:12:20 PDT 2010


Author: ggreif
Date: Mon Jul 26 16:12:20 2010
New Revision: 109437

URL: http://llvm.org/viewvc/llvm-project?rev=109437&view=rev
Log:
archive another, presumably more efficient, but also more obfuscated solution; passes all tests too

Modified:
    llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp

Modified: llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp?rev=109437&r1=109436&r2=109437&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp (original)
+++ llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp Mon Jul 26 16:12:20 2010
@@ -51,51 +51,52 @@
 template <>
 const Use *Use::getImpliedUser<3>(const Use *Current) {
   while (true) {
-    unsigned Tag = (Current++)->Prev.getInt();
+    int Tag = (Current++)->Prev.getInt() - stop64Tag;
     ptrdiff_t Offset;
-    switch (Tag) {
-      case zero64Tag:
-      case one64Tag:
-      case two64Tag:
-      case three64Tag:
-        continue;
-      case stop64Tag:
+		if (Tag == 0) {
         switch (Current->Prev.getInt()) {
           case 0: ++Current; Offset = 4; goto digits;
           case xStop64Tag: ++Current; Offset = 1; goto digits;
           case yStop64Tag: return Current + 3;
-          default: Offset = 0; goto digits;
-        }
-      case xStop64Tag:
-        if (Current->Prev.getInt() == fullStop64Tag)
-          return Current + 1;
-        Offset = 1; goto digits;
-      case yStop64Tag:
-        if (Current->Prev.getInt() == xStop64Tag)
-          return Current + 2;
-        Offset = 2;
-        while (true) {
-          digits:
-          unsigned Tag = Current->Prev.getInt();
-          switch (Tag) {
-            case zero64Tag:
-            case one64Tag:
-            case two64Tag:
-            case three64Tag:
-              ++Current;
-              Offset = (Offset << 2) + Tag;
-              continue;
-            case xStop64Tag:
-              return Current + (Offset << 2) + one64Tag + 1;
-            default:
-              return Current + Offset;
-          }
+				  default: Offset = 0; goto digits;
         }
-
-      case fullStop64Tag:
-        return Current;
-    }
-  }
+		}
+		else if (Tag < 0)
+			continue;
+		else {
+			Tag -= 2;
+			if (Tag > 0)
+				return Current;
+			else if (Tag == 0) {
+				if (Current->Prev.getInt() == xStop64Tag)
+					return Current + 2;
+				Offset = 2;
+			}
+			else {
+				if (Current->Prev.getInt() == fullStop64Tag)
+					return Current + 1;
+				Offset = 1;
+			}
+
+			while (true) {
+				digits:
+						unsigned Tag = Current->Prev.getInt();
+						switch (Tag) {
+              case zero64Tag:
+              case one64Tag:
+              case two64Tag:
+              case three64Tag:
+                ++Current;
+                Offset = (Offset << 2) + Tag;
+                continue;
+              case xStop64Tag:
+                return Current + (Offset << 2) + one64Tag + 1;
+              default:
+                return Current + Offset;
+						}
+			}
+		}
+	}
 }
 
 template <>





More information about the llvm-branch-commits mailing list