diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-03 00:26:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-03 00:26:01 +0000 |
commit | ce32794bf2c971a59ee01f28fa72eb51d4240d1d (patch) | |
tree | 5efc1ce1cc15f233a58597e67dd2fc08df05b75a | |
parent | b425feb2aa74989304a2a89e042d5523c24dcbeb (diff) | |
download | bcm5719-llvm-ce32794bf2c971a59ee01f28fa72eb51d4240d1d.tar.gz bcm5719-llvm-ce32794bf2c971a59ee01f28fa72eb51d4240d1d.zip |
Work around an apparent GCC miscompilation by specializing different,
this fixes a regression on some compilers from r68147.
llvm-svn: 68356
-rw-r--r-- | llvm/include/llvm/Support/PointerLikeTypeTraits.h | 14 | ||||
-rw-r--r-- | llvm/include/llvm/Support/ValueHandle.h | 12 | ||||
-rw-r--r-- | llvm/include/llvm/Use.h | 11 |
3 files changed, 23 insertions, 14 deletions
diff --git a/llvm/include/llvm/Support/PointerLikeTypeTraits.h b/llvm/include/llvm/Support/PointerLikeTypeTraits.h index 226dacf3611..c5f79ccb835 100644 --- a/llvm/include/llvm/Support/PointerLikeTypeTraits.h +++ b/llvm/include/llvm/Support/PointerLikeTypeTraits.h @@ -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> { diff --git a/llvm/include/llvm/Support/ValueHandle.h b/llvm/include/llvm/Support/ValueHandle.h index 27714646f70..a668656a07e 100644 --- a/llvm/include/llvm/Support/ValueHandle.h +++ b/llvm/include/llvm/Support/ValueHandle.h @@ -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 diff --git a/llvm/include/llvm/Use.h b/llvm/include/llvm/Use.h index 32cdd1b95dd..53df699e703 100644 --- a/llvm/include/llvm/Use.h +++ b/llvm/include/llvm/Use.h @@ -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 //===----------------------------------------------------------------------===// |