Chris Lattner | f7c4ace | 2003-08-23 19:43:16 +0000 | [diff] [blame] | 1 | //===-- ValueHolder.cpp - Wrapper for Value implementation ----------------===// |
John Criswell | b576c94 | 2003-10-20 19:43:21 +0000 | [diff] [blame^] | 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file was developed by the LLVM research group and is distributed under |
| 6 | // the University of Illinois Open Source License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | f7c4ace | 2003-08-23 19:43:16 +0000 | [diff] [blame] | 9 | // |
| 10 | // This class defines a simple subclass of User, which keeps a pointer to a |
| 11 | // Value, which automatically updates when Value::replaceAllUsesWith is called. |
| 12 | // This is useful when you have pointers to Value's in your pass, but the |
| 13 | // pointers get invalidated when some other portion of the algorithm is |
| 14 | // replacing Values with other Values. |
| 15 | // |
| 16 | //===----------------------------------------------------------------------===// |
| 17 | |
| 18 | #include "llvm/Support/ValueHolder.h" |
| 19 | #include "llvm/Type.h" |
| 20 | |
| 21 | ValueHolder::ValueHolder(Value *V) : User(Type::TypeTy, Value::TypeVal) { |
| 22 | Operands.push_back(Use(V, this)); |
| 23 | } |