[llvm-branch-commits] [llvm-branch] r201992 - WIP: start implementing 3-bit waymarking: getImpliedUser<8>

Gabor Greif ggreif at gmail.com
Sun Feb 23 12:51:16 PST 2014


Author: ggreif
Date: Sun Feb 23 14:51:16 2014
New Revision: 201992

URL: http://llvm.org/viewvc/llvm-project?rev=201992&view=rev
Log:
WIP: start implementing 3-bit waymarking: getImpliedUser<8>

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

Modified: llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp?rev=201992&r1=201991&r2=201992&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp (original)
+++ llvm/branches/ggreif/waymark-64-new/lib/IR/Use.cpp Sun Feb 23 14:51:16 2014
@@ -49,13 +49,13 @@ void Use::swap(Use &RHS) {
 //                         Use getImpliedUser Implementation
 //===----------------------------------------------------------------------===//
 
+
 template<>
-const Use *Use::getImpliedUser<8>() const {
+const Use *Use::getImpliedUser<4>() const {
   const Use *Current = this;
 
   while (true) {
-    unsigned Tag = (Current++)->Prev.getInt();
-    switch (Tag) {
+    switch (unsigned Tag = (Current++)->Prev.getInt()) {
       case zeroDigitTag:
       case oneDigitTag:
         continue;
@@ -64,8 +64,7 @@ const Use *Use::getImpliedUser<8>() cons
         ++Current;
         ptrdiff_t Offset = 1;
         while (true) {
-          unsigned Tag = Current->Prev.getInt();
-          switch (Tag) {
+          switch (unsigned Tag = Current->Prev.getInt()) {
             case zeroDigitTag:
             case oneDigitTag:
               ++Current;
@@ -82,6 +81,50 @@ const Use *Use::getImpliedUser<8>() cons
     }
   }
 }
+
+
+enum Tag3 {
+  fullStopTag3,
+  stopTag3,
+  skipStopTag3,
+  skip2StopTag3,
+  zeroZeroDigitTag3,
+  zeroOneDigitTag3,
+  oneZeroDigitTag3,
+  oneOneDigitTag3
+};
+
+template<>
+const Use *Use::getImpliedUser<8>() const {
+  const Use *Current = this;
+
+  while (true) {
+    switch (unsigned Tag = Current->Prev.getInt()) {
+      case fullStopTag3: return Current + 1;
+      case stopTag3:
+      case skipStopTag3:
+      case skip2StopTag3: {
+        Current += Tag;
+        ptrdiff_t Offset = 0;
+        while (true) {
+          switch (unsigned Tag = Current->Prev.getInt()) {
+            case zeroZeroDigitTag3:
+            case zeroOneDigitTag3:
+            case oneZeroDigitTag3:
+            case oneOneDigitTag3:
+              ++Current;
+              Offset = (Offset << 2) | (Tag & 0x3);
+              continue;
+            default:
+              return Current + Offset;
+          }
+        }
+      }
+
+      default: Current += 3; continue;
+    }
+  }
+}
 
 //===----------------------------------------------------------------------===//
 //                         Use initTags Implementation





More information about the llvm-branch-commits mailing list