e0806b538a39280953280fb7f2356c9dafffba38
[oota-llvm.git] / lib / Support / ValueHolder.cpp
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 }