@@ -2344,7 +2344,7 @@ stops, so that the
worst case is 20 memory accesses when there are
@@ -2434,7 +2434,7 @@ OK, passed 500 tests.
@@ -2446,7 +2446,8 @@ tag bits.
For layout b) instead of the
User we find a pointer (
User* with LSBit set).
Following this pointer brings us to the
User. A portable trick ensures
that the first bytes of
User (if interpreted as a pointer) never has
-the LSBit set.
+the LSBit set. (Portability is relying on the fact that all known compilers place the
+
vptr in the first word of the instances.)
@@ -2491,7 +2492,7 @@ the
lib/VMCore directory.
@@ -2513,7 +2514,7 @@ the
lib/VMCore directory.
diff --git a/include/llvm/Use.h b/include/llvm/Use.h
index b4d2c488243..7d6bf5027bc 100644
--- a/include/llvm/Use.h
+++ b/include/llvm/Use.h
@@ -18,6 +18,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/ADT/iterator.h"
+#include "llvm/ADT/PointerIntPair.h"
namespace llvm {
@@ -25,46 +26,9 @@ class Value;
class User;
-//===----------------------------------------------------------------------===//
-// Generic Tagging Functions
-//===----------------------------------------------------------------------===//
-
-// We adhere to the following convention: The type of a tagged pointer
-// to T is T volatile*. This means that functions that superpose a tag
-// on a pointer will be supplied a T* (or T const*) and will return a
-// tagged one: T volatile*. Untagging functions do it the other way
-// 'round. While this scheme does not prevent dereferencing of tagged
-// pointers, proper type annotations do catch most inappropriate uses.
-
/// Tag - generic tag type for (at least 32 bit) pointers
enum Tag { noTag, tagOne, tagTwo, tagThree };
-/// addTag - insert tag bits into an (untagged) pointer
-template
-inline volatile T *addTag(const T *P, TAG Tag) {
- return reinterpret_cast(ptrdiff_t(P) | Tag);
-}
-
-/// stripTag - remove tag bits from a pointer,
-/// making it dereferencable
-template
-inline T *stripTag(const volatile T *P) {
- return reinterpret_cast(ptrdiff_t(P) & ~MASK);
-}
-
-/// extractTag - extract tag bits from a pointer
-template
-inline TAG extractTag(const volatile T *P) {
- return TAG(ptrdiff_t(P) & MASK);
-}
-
-/// transferTag - transfer tag bits from a pointer,
-/// to an untagged pointer
-template
-inline volatile T *transferTag(const volatile T *From, const T *To) {
- return reinterpret_cast((ptrdiff_t(From) & MASK) | ptrdiff_t(To));
-}
-
//===----------------------------------------------------------------------===//
// Use Class
@@ -133,10 +97,11 @@ private:
static Use *initTags(Use *Start, Use *Stop, ptrdiff_t Done = 0);
Value *Val;
- Use *Next, *volatile*Prev;
+ Use *Next;
+ PointerIntPair