Index: include/llvm/IR/Use.h =================================================================== --- include/llvm/IR/Use.h +++ include/llvm/IR/Use.h @@ -61,9 +61,27 @@ /// that also works with less standard-compliant compilers void swap(Use &RHS); + /// Pointer traits for the UserRef PointerIntPair. + struct UserRefPointerTraits { + static inline void *getAsVoidPointer(User *P) { return P; } + static inline User *getFromVoidPointer(void *P) { + return (User *)P; + } + enum { NumLowBitsAvailable = 1 }; + }; + // A type for the word following an array of hung-off Uses in memory, which is // a pointer back to their User with the bottom bit set. - typedef PointerIntPair UserRef; + typedef PointerIntPair UserRef; + + /// Pointer traits for the Prev PointerIntPair. + struct PrevPointerTraits { + static inline void *getAsVoidPointer(Use **P) { return P; } + static inline Use **getFromVoidPointer(void *P) { + return (Use **)P; + } + enum { NumLowBitsAvailable = 2 }; + }; private: /// Destructor - Only for zap() @@ -115,7 +133,7 @@ Value *Val; Use *Next; - PointerIntPair Prev; + PointerIntPair Prev; void setPrev(Use **NewPrev) { Prev.setPointer(NewPrev); }