Work around an apparent GCC miscompilation by specializing different,
authorChris Lattner <sabre@nondot.org>
Fri, 3 Apr 2009 00:26:01 +0000 (00:26 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 3 Apr 2009 00:26:01 +0000 (00:26 +0000)
this fixes a regression on some compilers from r68147.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68356 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/PointerLikeTypeTraits.h
include/llvm/Support/ValueHandle.h
include/llvm/Use.h

index 226dacf36118bf69b0ce185e1a2be9c902eee3b6..c5f79ccb83567605c79de167349160b7fe89628c 100644 (file)
@@ -58,20 +58,6 @@ public:
   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> {
index 27714646f70a54eaeff85f1063442c9554862c6d..a668656a07e485d5900b733de27d88c6fb188cf6 100644 (file)
 #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
index 32cdd1b95ddb362d29f32d081bd5598bd381b364..53df699e703601c438c880f3313f704ac7c47f03 100644 (file)
@@ -29,6 +29,17 @@ class Use;
 /// 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
 //===----------------------------------------------------------------------===//