From 183912af7947e7c48da64d94b6fe78ebb09cc7ec Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Thu, 31 Dec 2009 01:32:41 +0000 Subject: [PATCH] Remove #include of metadata.h from intrinsicinst.h. The only method that needs it (DbgValueInst::getValue) has been moved out of line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92323 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/IntrinsicInst.h | 5 +---- include/llvm/Value.h | 4 ++++ lib/VMCore/IntrinsicInst.cpp | 8 ++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/llvm/IntrinsicInst.h b/include/llvm/IntrinsicInst.h index 9893e1f8780..3c18de10674 100644 --- a/include/llvm/IntrinsicInst.h +++ b/include/llvm/IntrinsicInst.h @@ -25,7 +25,6 @@ #define LLVM_INTRINSICINST_H #include "llvm/Constants.h" -#include "llvm/Metadata.h" #include "llvm/Function.h" #include "llvm/Instructions.h" #include "llvm/Intrinsics.h" @@ -175,9 +174,7 @@ namespace llvm { /// DbgValueInst - This represents the llvm.dbg.value instruction. /// struct DbgValueInst : public DbgInfoIntrinsic { - Value *getValue() const { - return cast(getOperand(1))->getOperand(0); - } + Value *getValue() const; Value *getOffset() const { return getOperand(2); } MDNode *getVariable() const { return cast(getOperand(3)); } diff --git a/include/llvm/Value.h b/include/llvm/Value.h index 4d94a301916..f0bd8bea1ed 100644 --- a/include/llvm/Value.h +++ b/include/llvm/Value.h @@ -42,6 +42,7 @@ class AssemblyAnnotationWriter; class ValueHandleBase; class LLVMContext; class Twine; +class MDNode; //===----------------------------------------------------------------------===// // Value Class @@ -350,6 +351,9 @@ template <> inline bool isa_impl(const Value &Val) { return isa(Val) || isa(Val) || isa(Val); } +template <> inline bool isa_impl(const Value &Val) { + return Val.getValueID() == Value::MDNodeVal; +} // Value* is only 4-byte aligned. diff --git a/lib/VMCore/IntrinsicInst.cpp b/lib/VMCore/IntrinsicInst.cpp index b508f6b4ca9..5e0f42e063b 100644 --- a/lib/VMCore/IntrinsicInst.cpp +++ b/lib/VMCore/IntrinsicInst.cpp @@ -69,3 +69,11 @@ Value *DbgStopPointInst::getDirectory() const { assert(LLVMDebugVersion == (7 << 16) && "Verify operand indices"); return getContext()->getOperand(4); } + +//===----------------------------------------------------------------------===// +/// DbgValueInst - This represents the llvm.dbg.value instruction. +/// + +Value *DbgValueInst::getValue() const { + return cast(getOperand(1))->getOperand(0); +}