[llvm-commits] [llvm] r49526 - in /llvm/branches/ggreif/use-diet/include/llvm: Use.h Value.h
Gabor Greif
ggreif at gmail.com
Fri Apr 11 04:22:09 PDT 2008
Author: ggreif
Date: Fri Apr 11 06:22:04 2008
New Revision: 49526
URL: http://llvm.org/viewvc/llvm-project?rev=49526&view=rev
Log:
implement transferTag and use it in Use::init and Use::set
Modified:
llvm/branches/ggreif/use-diet/include/llvm/Use.h
llvm/branches/ggreif/use-diet/include/llvm/Value.h
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=49526&r1=49525&r2=49526&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Use.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Use.h Fri Apr 11 06:22:04 2008
@@ -80,6 +80,9 @@
static Value *stripTag(Value *V) {
return reinterpret_cast<Value*>(reinterpret_cast<ptrdiff_t>(V) & ~3UL);
}
+ Value *transferTag(Value *V) {
+ return reinterpret_cast<Value*>(reinterpret_cast<ptrdiff_t>(V) + (reinterpret_cast<ptrdiff_t>(Val) & ~3UL));
+ }
void addToList(Use **List) {
Next = *List;
if (Next) Next->Prev = &Next;
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=49526&r1=49525&r2=49526&view=diff
==============================================================================
--- llvm/branches/ggreif/use-diet/include/llvm/Value.h (original)
+++ llvm/branches/ggreif/use-diet/include/llvm/Value.h Fri Apr 11 06:22:04 2008
@@ -223,15 +223,15 @@
return OS;
}
-void Use::init(Value *v, User *user) {
- Val = v;
+void Use::init(Value *V, User *user) {
+ Val = transferTag(V);
U = user;
- if (Val) Val->addUse(*this);
+ if (V) V->addUse(*this);
}
void Use::set(Value *V) {
- if (Val) removeFromList();
- Val = V;
+ if (stripTag(Val)) removeFromList();
+ Val = transferTag(V);
if (V) V->addUse(*this);
}
More information about the llvm-commits
mailing list