X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FVMCore%2FUse.cpp;h=0c566a9cb70aa3a25cfbe1cb6d3532b514da3227;hb=b5bd026a756d8650f2a94607c9b1dc34cf1c024a;hp=5eadaadbb33313dec5942843d7864a091b4a4d77;hpb=023f84ecafa08a67101937ac80f0dfd9f5e69dfb;p=oota-llvm.git diff --git a/lib/VMCore/Use.cpp b/lib/VMCore/Use.cpp index 5eadaadbb33..0c566a9cb70 100644 --- a/lib/VMCore/Use.cpp +++ b/lib/VMCore/Use.cpp @@ -52,7 +52,7 @@ const Use *Use::getImpliedUser() const { const Use *Current = this; while (true) { - unsigned Tag = extractTag((Current++)->Prev); + unsigned Tag = (Current++)->Prev.getInt(); switch (Tag) { case zeroDigitTag: case oneDigitTag: @@ -62,7 +62,7 @@ const Use *Use::getImpliedUser() const { ++Current; ptrdiff_t Offset = 1; while (true) { - unsigned Tag = extractTag(Current->Prev); + unsigned Tag = Current->Prev.getInt(); switch (Tag) { case zeroDigitTag: case oneDigitTag: @@ -91,11 +91,13 @@ Use *Use::initTags(Use * const Start, Use *Stop, ptrdiff_t Done) { --Stop; Stop->Val = 0; if (!Count) { - Stop->Prev = reinterpret_cast(Done == 0 ? fullStopTag : stopTag); + Stop->Prev.setFromOpaqueValue(reinterpret_cast(Done == 0 + ? fullStopTag + : stopTag)); ++Done; Count = Done; } else { - Stop->Prev = reinterpret_cast(Count & 1); + Stop->Prev.setFromOpaqueValue(reinterpret_cast(Count & 1)); Count >>= 1; ++Done; } @@ -127,7 +129,7 @@ void Use::zap(Use *Start, const Use *Stop, bool del) { //===----------------------------------------------------------------------===// struct AugmentedUse : Use { - volatile User *ref; + PointerIntPair ref; AugmentedUse(); // not implemented }; @@ -138,10 +140,12 @@ struct AugmentedUse : Use { User *Use::getUser() const { const Use *End = getImpliedUser(); - volatile User *She = static_cast(End - 1)->ref; - return extractTag(She) - ? llvm::stripTag(She) - : reinterpret_cast(const_cast(End)); + const PointerIntPair& ref( + static_cast(End - 1)->ref); + User *She = ref.getPointer(); + return ref.getInt() + ? She + : (User*)End; } //===----------------------------------------------------------------------===// @@ -153,7 +157,9 @@ Use *User::allocHungoffUses(unsigned N) const { + sizeof(AugmentedUse) - sizeof(Use))); Use *End = Begin + N; - static_cast(End[-1]).ref = addTag(this, tagOne); + PointerIntPair& ref(static_cast(End[-1]).ref); + ref.setPointer(const_cast(this)); + ref.setInt(tagOne); return Use::initTags(Begin, End); }