diff options
author | Chris Lattner <sabre@nondot.org> | 2009-03-29 04:32:37 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-03-29 04:32:37 +0000 |
commit | e30173ac3396510bd0bb26a66fd615ff9083436d (patch) | |
tree | d71f62634bc8d263495a1672c22f32f7611fca73 /include/llvm/Use.h | |
parent | 8ee1b5e916249d1a64ad8cf99b08a0e160f9d052 (diff) | |
download | external_llvm-e30173ac3396510bd0bb26a66fd615ff9083436d.zip external_llvm-e30173ac3396510bd0bb26a66fd615ff9083436d.tar.gz external_llvm-e30173ac3396510bd0bb26a66fd615ff9083436d.tar.bz2 |
Replace the PointerLikeTypeTraits::getNumLowBitsAvailable
function with a new NumLowBitsAvailable enum, which makes the
value available as an integer constant expression.
Add PointerLikeTypeTraits specializations for Instruction* and
Use** since they are only guaranteed 4-byte aligned.
Enhance PointerIntPair to know about (and enforce) the alignment
specified by PointerLikeTypeTraits. This should allow things
like PointerIntPair<PointerIntPair<void*, 1,bool>, 1, bool>
because the inner one knows that 2 low bits are free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67979 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Use.h')
-rw-r--r-- | include/llvm/Use.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/llvm/Use.h b/include/llvm/Use.h index cde4366..53df699 100644 --- a/include/llvm/Use.h +++ b/include/llvm/Use.h @@ -24,11 +24,21 @@ namespace llvm { class Value; class User; - +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 @@ -212,7 +222,7 @@ template<> struct simplify_type<value_use_iterator<const User> > { template<> struct simplify_type<const value_use_iterator<const User> > : public simplify_type<value_use_iterator<const User> > {}; - + } // End llvm namespace #endif |