[llvm-commits] CVS: llvm/lib/Support/ValueHolder.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Aug 23 14:44:13 PDT 2003


Changes in directory llvm/lib/Support:

ValueHolder.cpp added (r1.1)

---
Log message:

Initial checkin of ValueHolder helper


---
Diffs of the changes:

Index: llvm/lib/Support/ValueHolder.cpp
diff -c /dev/null llvm/lib/Support/ValueHolder.cpp:1.1
*** /dev/null	Sat Aug 23 14:43:26 2003
--- llvm/lib/Support/ValueHolder.cpp	Sat Aug 23 14:43:16 2003
***************
*** 0 ****
--- 1,16 ----
+ //===-- ValueHolder.cpp - Wrapper for Value implementation ----------------===//
+ //
+ // This class defines a simple subclass of User, which keeps a pointer to a
+ // Value, which automatically updates when Value::replaceAllUsesWith is called.
+ // This is useful when you have pointers to Value's in your pass, but the
+ // pointers get invalidated when some other portion of the algorithm is
+ // replacing Values with other Values.
+ //
+ //===----------------------------------------------------------------------===//
+ 
+ #include "llvm/Support/ValueHolder.h"
+ #include "llvm/Type.h"
+ 
+ ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) {
+   Operands.push_back(Use(V, this));
+ }





More information about the llvm-commits mailing list