summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-08-23 19:43:16 +0000
committerChris Lattner <sabre@nondot.org>2003-08-23 19:43:16 +0000
commit32db9de2ff12bc19d0f55a452092c310f2e1ed75 (patch)
tree9711da20c471cb9b07af76468990cbd7f6e114e8 /llvm/lib/Support
parent39a4430722f522c20d42bf8b4a4b62dc0fdc7f35 (diff)
downloadbcm5719-llvm-32db9de2ff12bc19d0f55a452092c310f2e1ed75.tar.gz
bcm5719-llvm-32db9de2ff12bc19d0f55a452092c310f2e1ed75.zip
Initial checkin of ValueHolder helper
llvm-svn: 8072
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/ValueHolder.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Support/ValueHolder.cpp b/llvm/lib/Support/ValueHolder.cpp
new file mode 100644
index 00000000000..e0806b538a3
--- /dev/null
+++ b/llvm/lib/Support/ValueHolder.cpp
@@ -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));
+}
OpenPOWER on IntegriCloud