Work around an apparent GCC miscompilation by specializing different,

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
This commit is contained in:
Chris Lattner 2009-04-03 00:26:01 +00:00
parent 8f9643f0f7
commit b7a00daa11
3 changed files with 23 additions and 14 deletions

View 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> {

View File

@ -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

View 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
//===----------------------------------------------------------------------===//