summaryrefslogtreecommitdiff
path: root/include
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
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')
-rw-r--r--include/llvm/Support/PointerLikeTypeTraits.h14
-rw-r--r--include/llvm/Use.h11
2 files changed, 14 insertions, 11 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> {
diff --git a/include/llvm/Use.h b/include/llvm/Use.h
index 53df699e70..32cdd1b95d 100644
--- a/include/llvm/Use.h
+++ b/include/llvm/Use.h
@@ -29,17 +29,6 @@ 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
//===----------------------------------------------------------------------===//