[llvm-commits] [llvm] r56193 - in /llvm/branches/ggreif/use-diet: include/llvm/Use.h include/llvm/Value.h lib/VMCore/Use.cpp
Gabor Greif
ggreif at gmail.com
Sat Sep 13 16:30:31 PDT 2008
Author: ggreif
Date: Sat Sep 13 18:30:30 2008
New Revision: 56193
URL: http://llvm.org/viewvc/llvm-project?rev=56193&view=rev
Log:
various bugfixes to maintain invariants
Modified:
llvm/branches/ggreif/use-diet/include/llvm/Use.h
llvm/branches/ggreif/use-diet/include/llvm/Value.h
llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp
Modified: llvm/branches/ggreif/use-diet/include/llvm/Use.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Use.h?rev=56193&r1=56192&r2=56193&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Sat Sep 13 18:30:30 2008
@@ -70,7 +70,7 @@
friend class UseWaymark;
Value *getValue() const;
static Use *nilUse(const Value*); // marks the end of the def/use chain
-
+ static bool isNil(Use *U) { return extractTag<NextPtrTag, tagMaskN>(U) == fullStopTagN; }
public:
/// init - specify Value and User
/// @deprecated in 2.4, will be removed soon
@@ -154,7 +154,8 @@
void removeFromList() {
Use **StrippedPrev = stripTag<tagMask>(Prev);
*StrippedPrev = Next;
- if (Next) Next->setPrev(StrippedPrev);
+ Use *StrippedNext(getNext());
+ if (StrippedNext) StrippedNext->setPrev(StrippedPrev);
}
friend class Value;
Modified: llvm/branches/ggreif/use-diet/include/llvm/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/include/llvm/Value.h?rev=56193&r1=56192&r2=56193&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Value.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Value.h Sat Sep 13 18:30:30 2008
@@ -135,7 +135,7 @@
typedef value_use_iterator<User> use_iterator;
typedef value_use_iterator<const User> use_const_iterator;
- bool use_empty() const { return UseList == 0; }
+ bool use_empty() const { return Use::isNil(UseList); }
use_iterator use_begin() { return use_iterator(UseList); }
use_const_iterator use_begin() const { return use_const_iterator(UseList); }
use_iterator use_end() { return use_iterator(0); }
@@ -235,12 +235,14 @@
void Use::init(Value *V, User *user) {
Val1 = V;
if (V) V->addUse(*this);
+ else Next = nilUse(0);
}
void Use::set(Value *V) {
if (Val1) removeFromList();
Val1 = V;
if (V) V->addUse(*this);
+ else Next = nilUse(0);
}
Modified: llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp?rev=56193&r1=56192&r2=56193&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp (original)
+++ llvm/branches/ggreif/use-diet/lib/VMCore/Use.cpp Sat Sep 13 18:30:30 2008
@@ -90,6 +90,7 @@
while (Start != Stop) {
--Stop;
Stop->Val1 = 0;
+ Stop->Next = nilUse(0);
if (!Count) {
Stop->Prev = reinterpret_cast<Use**>(Done == 0 ? fullStopTag : stopTag);
++Done;
More information about the llvm-commits
mailing list