diff options
author | Chris Lattner <sabre@nondot.org> | 2001-06-06 20:29:01 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2001-06-06 20:29:01 +0000 |
commit | 009505452b713ed2e3a8e99c5545a6e721c65495 (patch) | |
tree | 136a71c5b87bdf534d1f20a67558b49226b5a4d6 /include/llvm/User.h | |
parent | 8d0afd3d32d1d67f9aa5df250a1d6955aa8f1ac9 (diff) | |
download | external_llvm-009505452b713ed2e3a8e99c5545a6e721c65495.zip external_llvm-009505452b713ed2e3a8e99c5545a6e721c65495.tar.gz external_llvm-009505452b713ed2e3a8e99c5545a6e721c65495.tar.bz2 |
Initial revision
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/User.h')
-rw-r--r-- | include/llvm/User.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/llvm/User.h b/include/llvm/User.h new file mode 100644 index 0000000..58e0dec --- /dev/null +++ b/include/llvm/User.h @@ -0,0 +1,47 @@ +//===-- llvm/User.h - User class definition ----------------------*- C++ -*--=// +// +// This class defines the interface that one who 'use's a Value must implement. +// Each instance of the Value class keeps track of what User's have handles +// to it. +// +// * Instructions are the largest class of User's. +// * Constants may be users of other constants (think arrays and stuff) +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_USER_H +#define LLVM_USER_H + +#include "llvm/Value.h" + +class User : public Value { + User(const User &); // Do not implement +public: + User(const Type *Ty, ValueTy vty, const string &name = ""); + virtual ~User() {} + + // if i > the number of operands, then getOperand() returns 0, and setOperand + // returns false. setOperand() may also return false if the operand is of + // the wrong type. + // + virtual Value *getOperand(unsigned i) = 0; + virtual const Value *getOperand(unsigned i) const = 0; + virtual bool setOperand(unsigned i, Value *Val) = 0; + + // dropAllReferences() - This virtual function should be overridden to "let + // go" of all references that this user is maintaining. This allows one to + // 'delete' a whole class at a time, even though there may be circular + // references... first all references are dropped, and all use counts go to + // zero. Then everything is delete'd for real. Note that no operations are + // valid on an object that has "dropped all references", except operator + // delete. + // + virtual void dropAllReferences() = 0; + + // replaceUsesOfWith - Replaces all references to the "From" definition with + // references to the "To" definition. (defined in Value.cpp) + // + void replaceUsesOfWith(Value *From, Value *To); +}; + +#endif |