[llvm-branch-commits] [llvm-branch] r109173 - in /llvm/branches/ggreif/waymark-64: include/llvm/Use.h lib/VMCore/Use.cpp

Gabor Greif ggreif at gmail.com
Thu Jul 22 14:47:39 PDT 2010


Author: ggreif
Date: Thu Jul 22 16:47:39 2010
New Revision: 109173

URL: http://llvm.org/viewvc/llvm-project?rev=109173&view=rev
Log:
second shot at parameterized getImpliedUser -- this time for the win

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

Modified: llvm/branches/ggreif/waymark-64/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/waymark-64/include/llvm/Use.h?rev=109173&r1=109172&r2=109173&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/waymark-64/include/llvm/Use.h Thu Jul 22 16:47:39 2010
@@ -117,12 +117,8 @@
 private:
   enum { availableTagBits = sizeof(Use*) < 8 ? 2 : 3 };
   template <unsigned>
-  struct UseTraits {
-    static const Use* getImpliedUser(const Use*);
-  };
-  inline const Use* getImpliedUser() const {
-		return UseTraits<availableTagBits>::getImpliedUser(this);
-	}
+  struct Traits;
+  inline const Use* getImpliedUser() const;
   static Use *initTags(Use *Start, Use *Stop, ptrdiff_t Done = 0);
   
   Value *Val;
@@ -148,6 +144,18 @@
   friend class User;
 };
 
+  template <>
+  struct Use::Traits<2> {
+    static const Use* getImpliedUser(const Use*);
+  };
+  template <>
+  struct Use::Traits<3> {
+    static const Use* getImpliedUser(const Use*);
+  };
+  inline const Use* Use::getImpliedUser() const {
+		return Traits<availableTagBits>::getImpliedUser(this);
+	}
+
 // simplify_type - Allow clients to treat uses just like values when using
 // casting operators.
 template<> struct simplify_type<Use> {

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=109173&r1=109172&r2=109173&view=diff
==============================================================================
--- llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp (original)
+++ llvm/branches/ggreif/waymark-64/lib/VMCore/Use.cpp Thu Jul 22 16:47:39 2010
@@ -48,13 +48,11 @@
 //                         Use getImpliedUser Implementations
 //===----------------------------------------------------------------------===//
 
-template <>
-const Use *Use::UseTraits<3>::getImpliedUser(const Use *Current) {
-  return UseTraits<2>::getImpliedUser(Current);
+const Use *Use::Traits<3>::getImpliedUser(const Use *Current) {
+  return Traits<2>::getImpliedUser(Current);
 }
 
-template <>
-const Use *Use::UseTraits<2>::getImpliedUser(const Use *Current) {
+const Use *Use::Traits<2>::getImpliedUser(const Use *Current) {
   while (true) {
     unsigned Tag = (Current++)->Prev.getInt();
     switch (Tag) {





More information about the llvm-branch-commits mailing list