diff options
author | Chris Lattner <sabre@nondot.org> | 2002-10-09 00:42:03 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-10-09 00:42:03 +0000 |
commit | 806fd40074b3a27234884e7f8fc096432ce25e30 (patch) | |
tree | c4d7437b1c8e7bbea57d200fb5bc40f16723ce44 /include/llvm/Value.h | |
parent | d9b11cf4df1f50eefab0f7eb14ec9c7dff6e153d (diff) | |
download | external_llvm-806fd40074b3a27234884e7f8fc096432ce25e30.zip external_llvm-806fd40074b3a27234884e7f8fc096432ce25e30.tar.gz external_llvm-806fd40074b3a27234884e7f8fc096432ce25e30.tar.bz2 |
- Detemplatize UseTy<> in Value.h, because it's only instantiated for one
type!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4093 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Value.h')
-rw-r--r-- | include/llvm/Value.h | 47 |
1 files changed, 21 insertions, 26 deletions
diff --git a/include/llvm/Value.h b/include/llvm/Value.h index e5c975e..9627a02 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -131,45 +131,42 @@ inline std::ostream &operator<<(std::ostream &OS, const Value &V) { //===----------------------------------------------------------------------===// -// UseTy Class +// Use Class //===----------------------------------------------------------------------===// -// UseTy and it's friendly typedefs (Use) are here to make keeping the "use" -// list of a definition node up-to-date really easy. +// Use is here to make keeping the "use" list of a Value up-to-date really easy. // -template<class ValueSubclass> -class UseTy { - ValueSubclass *Val; +class Use { + Value *Val; User *U; public: - inline UseTy<ValueSubclass>(ValueSubclass *v, User *user) { + inline Use(Value *v, User *user) { Val = v; U = user; if (Val) Val->addUse(U); } - inline ~UseTy<ValueSubclass>() { if (Val) Val->killUse(U); } - - inline operator ValueSubclass *() const { return Val; } - - inline UseTy<ValueSubclass>(const UseTy<ValueSubclass> &user) { + inline Use(const Use &user) { Val = 0; U = user.U; operator=(user.Val); } - inline ValueSubclass *operator=(ValueSubclass *V) { + inline ~Use() { if (Val) Val->killUse(U); } + inline operator Value*() const { return Val; } + + inline Value *operator=(Value *V) { if (Val) Val->killUse(U); Val = V; if (V) V->addUse(U); return V; } - inline ValueSubclass *operator->() { return Val; } - inline const ValueSubclass *operator->() const { return Val; } + inline Value *operator->() { return Val; } + inline const Value *operator->() const { return Val; } - inline ValueSubclass *get() { return Val; } - inline const ValueSubclass *get() const { return Val; } + inline Value *get() { return Val; } + inline const Value *get() const { return Val; } - inline UseTy<ValueSubclass> &operator=(const UseTy<ValueSubclass> &user) { + inline const Use &operator=(const Use &user) { if (Val) Val->killUse(U); Val = user.Val; Val->addUse(U); @@ -177,19 +174,17 @@ public: } }; -typedef UseTy<Value> Use; // Provide Use as a common UseTy type - -template<typename From> struct simplify_type<UseTy<From> > { - typedef typename simplify_type<From*>::SimpleType SimpleType; +template<> struct simplify_type<Use> { + typedef Value* SimpleType; - static SimpleType getSimplifiedValue(const UseTy<From> &Val) { + static SimpleType getSimplifiedValue(const Use &Val) { return (SimpleType)Val.get(); } }; -template<typename From> struct simplify_type<const UseTy<From> > { - typedef typename simplify_type<From*>::SimpleType SimpleType; +template<> struct simplify_type<const Use> { + typedef Value* SimpleType; - static SimpleType getSimplifiedValue(const UseTy<From> &Val) { + static SimpleType getSimplifiedValue(const Use &Val) { return (SimpleType)Val.get(); } }; |