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

Gabor Greif ggreif at gmail.com
Sat Sep 13 05:40:13 PDT 2008


Author: ggreif
Date: Sat Sep 13 07:40:12 2008
New Revision: 56187

URL: http://llvm.org/viewvc/llvm-project?rev=56187&view=rev
Log:
hackish way to make getValue to compile and link inside the project

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=56187&r1=56186&r2=56187&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Sat Sep 13 07:40:12 2008
@@ -66,6 +66,10 @@
 // Use is here to make keeping the "use" list of a Value up-to-date really easy.
 //
 class Use {
+  class UseWaymark;
+  friend class UseWaymark;
+  Value *getValue() const;
+
 public:
   /// init - specify Value and User
   /// @deprecated in 2.4, will be removed soon

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=56187&r1=56186&r2=56187&view=diff

==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/getValue.cpp Sat Sep 13 07:40:12 2008
@@ -1,8 +1,23 @@
+//===-- Use.cpp - Implement the Use class ---------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements the algorithm for finding the User of a Use.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/User.h"
 #include <new>
 #include <cassert>
 
+namespace llvm {
 
-
+/*
 //===----------------------------------------------------------------------===//
 //                          Generic Tagging Functions
 //===----------------------------------------------------------------------===//
@@ -36,15 +51,18 @@
   return reinterpret_cast<T*>((ptrdiff_t(From) & MASK) | ptrdiff_t(To));
 }
 
+*/
 
 
 
 
+// class Value;
+class Use::UseWaymark {
 
-class Value;
+  friend class Use;
 
 enum { requiredSteps = sizeof(Value*) * 8 - 2 };
-
+/*
 struct Use {
   enum NextPtrTag { zeroDigitTagN = tagTwo
                   , oneDigitTagN = tagOne
@@ -62,6 +80,7 @@
   Value *getValue() const;
 };
 
+*/
 
 /// repaintByCopying -- given a pattern and a
 /// junk tagspace, copy the former's tags into
@@ -306,6 +325,8 @@
   }
 }
 
+}; // class UseWaymark
+
 Value *Use::getValue() const {
   // __builtin_prefetch(Next);
   NextPtrTag Tag(extractTag<NextPtrTag, fullStopTagN>(Next));
@@ -313,19 +334,23 @@
   case fullStopTagN:
       return reinterpret_cast<Value*>(stripTag<fullStopTagN>(Next));
   case stopTagN:
-    return gatherAndPotentiallyRepaint(Next);
+    return UseWaymark::gatherAndPotentiallyRepaint(Next);
   default:
-    return skipPotentiallyGathering(stripTag<fullStopTagN>(Next),
+    return UseWaymark::skipPotentiallyGathering(stripTag<fullStopTagN>(Next),
                                     Tag & 1,
-                                    requiredSteps - 1);
+                                    Use::UseWaymark::requiredSteps - 1);
   }
 }
 
+} // namespace llvm
+
+#if 0
+
 // ################################################################
 // ############################# TESTS ############################
 // ################################################################
 
-
+using namespace llvm;
 
 namespace T1
 {
@@ -461,3 +486,5 @@
     if ((Value*)0xCAFEBABCUL != T4::ms32.getValue()) // check the mutated value
         return 4;
 }
+
+#endif





More information about the llvm-commits mailing list