summaryrefslogtreecommitdiff
path: root/include/llvm/Support/PointerLikeTypeTraits.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-31 21:28:39 +0000
committerChris Lattner <sabre@nondot.org>2009-03-31 21:28:39 +0000
commitf385167b85abf9cb63a0bec94732d7185ee74e36 (patch)
treea9eab553d45d1543b064fd1c852e053358439166 /include/llvm/Support/PointerLikeTypeTraits.h
parentbdd376ccb25f251e115fff24b526b4e65e03a1d3 (diff)
downloadllvm-f385167b85abf9cb63a0bec94732d7185ee74e36.tar.gz
llvm-f385167b85abf9cb63a0bec94732d7185ee74e36.tar.bz2
llvm-f385167b85abf9cb63a0bec94732d7185ee74e36.tar.xz
teach PointerLikeTypeTraits that all pointers to pointers may only be 4-byte aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/PointerLikeTypeTraits.h')
-rw-r--r--include/llvm/Support/PointerLikeTypeTraits.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/Support/PointerLikeTypeTraits.h b/include/llvm/Support/PointerLikeTypeTraits.h
index c5f79ccb83..226dacf361 100644
--- a/include/llvm/Support/PointerLikeTypeTraits.h
+++ b/include/llvm/Support/PointerLikeTypeTraits.h
@@ -58,6 +58,20 @@ 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> {