[llvm-commits] [llvm] r68356 - in /llvm/trunk/include/llvm: Support/PointerLikeTypeTraits.h Support/ValueHandle.h Use.h

Chris Lattner sabre at nondot.org
Thu Apr 2 17:26:02 PDT 2009


Author: lattner
Date: Thu Apr  2 19:26:01 2009
New Revision: 68356

URL: http://llvm.org/viewvc/llvm-project?rev=68356&view=rev
Log:
Work around an apparent GCC miscompilation by specializing different,
this fixes a regression on some compilers from r68147.

Modified:
    llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
    llvm/trunk/include/llvm/Support/ValueHandle.h
    llvm/trunk/include/llvm/Use.h

Modified: llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h?rev=68356&r1=68355&r2=68356&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h (original)
+++ llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h Thu Apr  2 19:26:01 2009
@@ -58,20 +58,6 @@
   enum { NumLowBitsAvailable = 3 };
 };
 
-// Pointers to pointers are only 4-byte aligned on 32-bit systems.
-template<typename T>
-class PointerLikeTypeTraits<T**> {
-public:
-  static inline void *getAsVoidPointer(T** P) { return P; }
-  static inline T **getFromVoidPointer(void *P) {
-    return static_cast<T**>(P);
-  }
-  enum { NumLowBitsAvailable = 2 };
-};
-  
-  
-  
-  
 // Provide PointerLikeTypeTraits for uintptr_t.
 template<>
 class PointerLikeTypeTraits<uintptr_t> {

Modified: llvm/trunk/include/llvm/Support/ValueHandle.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ValueHandle.h?rev=68356&r1=68355&r2=68356&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/ValueHandle.h (original)
+++ llvm/trunk/include/llvm/Support/ValueHandle.h Thu Apr  2 19:26:01 2009
@@ -18,6 +18,18 @@
 #include "llvm/Value.h"
 
 namespace llvm {
+class ValueHandleBase;
+
+// ValueHandleBase** is only 4-byte aligned.
+template<>
+class PointerLikeTypeTraits<ValueHandleBase**> {
+public:
+  static inline void *getAsVoidPointer(ValueHandleBase** P) { return P; }
+  static inline ValueHandleBase **getFromVoidPointer(void *P) {
+    return static_cast<ValueHandleBase**>(P);
+  }
+  enum { NumLowBitsAvailable = 2 };
+};
 
 /// ValueHandleBase - This is the common base class of value handles.
 /// ValueHandle's are smart pointers to Value's that have special behavior when

Modified: llvm/trunk/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=68356&r1=68355&r2=68356&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Use.h (original)
+++ llvm/trunk/include/llvm/Use.h Thu Apr  2 19:26:01 2009
@@ -29,6 +29,17 @@
 /// Tag - generic tag type for (at least 32 bit) pointers
 enum Tag { noTag, tagOne, tagTwo, tagThree };
 
+// Use** is only 4-byte aligned.
+template<>
+class PointerLikeTypeTraits<Use**> {
+public:
+  static inline void *getAsVoidPointer(Use** P) { return P; }
+  static inline Use **getFromVoidPointer(void *P) {
+    return static_cast<Use**>(P);
+  }
+  enum { NumLowBitsAvailable = 2 };
+};
+
 //===----------------------------------------------------------------------===//
 //                                  Use Class
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list