diff options
Diffstat (limited to 'include/llvm/Metadata.h')
-rw-r--r-- | include/llvm/Metadata.h | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/include/llvm/Metadata.h b/include/llvm/Metadata.h index 179010b..f1e7a22 100644 --- a/include/llvm/Metadata.h +++ b/include/llvm/Metadata.h @@ -31,26 +31,10 @@ template<typename ValueSubClass, typename ItemParentClass> //===----------------------------------------------------------------------===// -// MetadataBase - A base class for MDNode and MDString. -class MetadataBase : public Value { -protected: - MetadataBase(const Type *Ty, unsigned scid) - : Value(Ty, scid) {} - -public: - - /// Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const MetadataBase *) { return true; } - static bool classof(const Value *V) { - return V->getValueID() == MDStringVal || V->getValueID() == MDNodeVal; - } -}; - -//===----------------------------------------------------------------------===// /// MDString - a single uniqued string. /// These are used to efficiently contain a byte sequence for metadata. /// MDString is always unnamd. -class MDString : public MetadataBase { +class MDString : public Value { MDString(const MDString &); // DO NOT IMPLEMENT StringRef Str; @@ -87,7 +71,7 @@ class MDNodeOperand; //===----------------------------------------------------------------------===// /// MDNode - a tuple of other values. -class MDNode : public MetadataBase, public FoldingSetNode { +class MDNode : public Value, public FoldingSetNode { MDNode(const MDNode &); // DO NOT IMPLEMENT void operator=(const MDNode &); // DO NOT IMPLEMENT friend class MDNodeOperand; @@ -154,8 +138,9 @@ public: // getFunction - If this metadata is function-local and recursively has a // function-local operand, return the first such operand's parent function. - // Otherwise, return null. - Function *getFunction() const; + // Otherwise, return null. getFunction() should not be used for performance- + // critical code because it recursively visits all the MDNode's operands. + const Function *getFunction() const; // destroy - Delete this node. Only when there are no uses. void destroy(); |