Initial checkin of ValueHolder helper

llvm-svn: 8072
This commit is contained in:
Chris Lattner 2003-08-23 19:43:16 +00:00
parent 39a4430722
commit 32db9de2ff
2 changed files with 32 additions and 0 deletions

View File

@ -0,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));
}

View File

@ -0,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));
}