[llvm-commits] [llvm] r68147 - in /llvm/trunk/include/llvm: Support/PointerLikeTypeTraits.h Use.h
Chris Lattner
sabre at nondot.org
Tue Mar 31 14:28:39 PDT 2009
Author: lattner
Date: Tue Mar 31 16:28:39 2009
New Revision: 68147
URL: http://llvm.org/viewvc/llvm-project?rev=68147&view=rev
Log:
teach PointerLikeTypeTraits that all pointers to pointers may only be 4-byte aligned.
Modified:
llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.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=68147&r1=68146&r2=68147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h (original)
+++ llvm/trunk/include/llvm/Support/PointerLikeTypeTraits.h Tue Mar 31 16:28:39 2009
@@ -58,6 +58,20 @@
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/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Use.h?rev=68147&r1=68146&r2=68147&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Use.h (original)
+++ llvm/trunk/include/llvm/Use.h Tue Mar 31 16:28:39 2009
@@ -29,17 +29,6 @@
/// 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