Chris Lattner | f7c4ace | 2003-08-23 19:43:16 +0000 | [diff] [blame] | 1 | //===-- ValueHolder.cpp - Wrapper for Value implementation ----------------===// |
| 2 | // |
| 3 | // This class defines a simple subclass of User, which keeps a pointer to a |
| 4 | // Value, which automatically updates when Value::replaceAllUsesWith is called. |
| 5 | // This is useful when you have pointers to Value's in your pass, but the |
| 6 | // pointers get invalidated when some other portion of the algorithm is |
| 7 | // replacing Values with other Values. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #include "llvm/Support/ValueHolder.h" |
| 12 | #include "llvm/Type.h" |
| 13 | |
| 14 | ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) { |
| 15 | Operands.push_back(Use(V, this)); |
| 16 | } |