+inline std::ostream &operator<<(std::ostream &OS, const Value &V) {
+ V.print(OS);
+ return OS;
+}
+
+void Use::init(Value *v, User *user) {
+ Val = v;
+ U = user;
+ if (Val) Val->addUse(*this);
+}
+
+Use::~Use() {
+ if (Val) removeFromList();
+}
+
+void Use::set(Value *V) {
+ if (Val) removeFromList();
+ Val = V;
+ if (V) V->addUse(*this);
+}
+
+
+// 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_impl<Constant, Value>(const Value &Val) {
+ return Val.getValueID() >= Value::ConstantFirstVal &&
+ Val.getValueID() <= Value::ConstantLastVal;
+}
+template <> inline bool isa_impl<Argument, Value>(const Value &Val) {
+ return Val.getValueID() == Value::ArgumentVal;
+}
+template <> inline bool isa_impl<InlineAsm, Value>(const Value &Val) {
+ return Val.getValueID() == Value::InlineAsmVal;
+}
+template <> inline bool isa_impl<Instruction, Value>(const Value &Val) {
+ return Val.getValueID() >= Value::InstructionVal;
+}
+template <> inline bool isa_impl<BasicBlock, Value>(const Value &Val) {
+ return Val.getValueID() == Value::BasicBlockVal;
+}
+template <> inline bool isa_impl<Function, Value>(const Value &Val) {
+ return Val.getValueID() == Value::FunctionVal;
+}
+template <> inline bool isa_impl<GlobalVariable, Value>(const Value &Val) {
+ return Val.getValueID() == Value::GlobalVariableVal;
+}
+template <> inline bool isa_impl<GlobalAlias, Value>(const Value &Val) {
+ return Val.getValueID() == Value::GlobalAliasVal;
+}
+template <> inline bool isa_impl<GlobalValue, Value>(const Value &Val) {
+ return isa<GlobalVariable>(Val) || isa<Function>(Val) || isa<GlobalAlias>(Val);
+}
+
+} // End llvm namespace