From 18961504fc2b299578dba817900a0696cf3ccc4d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 25 Jun 2002 16:12:52 +0000 Subject: *** empty log message *** git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2777 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Value.h | 80 ++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 46 deletions(-) (limited to 'include/llvm/Value.h') diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 004a8ff..573ca17 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -25,8 +25,6 @@ class GlobalValue; class Function; class GlobalVariable; class SymbolTable; -template - class ValueHolder; //===----------------------------------------------------------------------===// // Value Class @@ -128,6 +126,11 @@ inline std::ostream &operator<<(std::ostream &OS, const Value *V) { return OS; } +inline std::ostream &operator<<(std::ostream &OS, const Value &V) { + V.print(OS); + return OS; +} + //===----------------------------------------------------------------------===// // UseTy Class @@ -178,61 +181,46 @@ public: typedef UseTy Use; // Provide Use as a common UseTy type -// Provide a specialization of real_type to work with use's... to make them a -// bit more transparent. -// -template class real_type > { typedef X *Type; }; - +template struct simplify_type > { + typedef typename simplify_type::SimpleType SimpleType; + + static SimpleType getSimplifiedValue(const UseTy &Val) { + return (SimpleType)Val.get(); + } +}; +template struct simplify_type > { + typedef typename simplify_type::SimpleType SimpleType; + + static SimpleType getSimplifiedValue(const UseTy &Val) { + return (SimpleType)Val.get(); + } +}; // isa - Provide some specializations of isa so that we don't have to include // the subtype header files to test to see if the value is a subclass... // -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::TypeVal; -} -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::TypeVal; -} -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::ConstantVal; -} -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::ConstantVal; -} -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::ArgumentVal; +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::TypeVal; } -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::ArgumentVal; +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::ConstantVal; } -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::InstructionVal; +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::ArgumentVal; } -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::InstructionVal; +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::InstructionVal; } -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::BasicBlockVal; +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::BasicBlockVal; } -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::BasicBlockVal; +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::FunctionVal; } -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::FunctionVal; -} -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::FunctionVal; -} -template <> inline bool isa(const Value *Val) { - return Val->getValueType() == Value::GlobalVariableVal; -} -template <> inline bool isa(Value *Val) { - return Val->getValueType() == Value::GlobalVariableVal; -} -template <> inline bool isa(const Value *Val) { - return isa(Val) || isa(Val); +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueType() == Value::GlobalVariableVal; } -template <> inline bool isa(Value *Val) { +template <> inline bool isa_impl(const Value &Val) { return isa(Val) || isa(Val); } -- cgit v1.1