diff options
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Instruction.h | 12 | ||||
-rw-r--r-- | include/llvm/LLVMContext.h | 6 | ||||
-rw-r--r-- | include/llvm/Support/ValueHandle.h | 2 |
3 files changed, 17 insertions, 3 deletions
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index cf9dc4456f..41841126b3 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -17,6 +17,7 @@ #include "llvm/User.h" #include "llvm/ADT/ilist_node.h" +#include "llvm/Support/ValueHandle.h" namespace llvm { @@ -31,6 +32,7 @@ class Instruction : public User, public ilist_node<Instruction> { Instruction(const Instruction &); // Do not implement BasicBlock *Parent; + TrackingVH<MDNode> DbgInfo; // 'dbg' Metadata cache. enum { /// HasMetadataBit - This is a bit stored in the SubClassData field which @@ -123,7 +125,7 @@ public: /// hasMetadata() - Return true if this instruction has any metadata attached /// to it. bool hasMetadata() const { - return (getSubclassDataFromValue() & HasMetadataBit) != 0; + return DbgInfo != 0 || hasMetadataHashEntry(); } /// getMetadata - Get the metadata of given kind attached to this Instruction. @@ -155,6 +157,12 @@ public: void setMetadata(const char *Kind, MDNode *Node); private: + /// hasMetadataHashEntry - Return true if we have an entry in the on-the-side + /// metadata hash. + bool hasMetadataHashEntry() const { + return (getSubclassDataFromValue() & HasMetadataBit) != 0; + } + // These are all implemented in Metadata.cpp. MDNode *getMetadataImpl(unsigned KindID) const; MDNode *getMetadataImpl(const char *Kind) const; @@ -315,7 +323,7 @@ private: return Value::getSubclassDataFromValue(); } - void setHasMetadata(bool V) { + void setHasMetadataHashEntry(bool V) { setValueSubclassData((getSubclassDataFromValue() & ~HasMetadataBit) | (V ? HasMetadataBit : 0)); } diff --git a/include/llvm/LLVMContext.h b/include/llvm/LLVMContext.h index 6d36d5eb1e..ea7f4a2d8e 100644 --- a/include/llvm/LLVMContext.h +++ b/include/llvm/LLVMContext.h @@ -36,6 +36,12 @@ public: LLVMContext(); ~LLVMContext(); + // Pinned metadata names, which always have the same value. This is a + // compile-time performance optimization, not a correctness optimization. + enum { + MD_dbg = 1 // "dbg" -> 1. + }; + /// getMDKindID - Return a unique non-zero ID for the specified metadata kind. /// This ID is uniqued across modules in the current LLVMContext. unsigned getMDKindID(StringRef Name) const; diff --git a/include/llvm/Support/ValueHandle.h b/include/llvm/Support/ValueHandle.h index 82c3caeb3a..0e61d093b9 100644 --- a/include/llvm/Support/ValueHandle.h +++ b/include/llvm/Support/ValueHandle.h @@ -302,7 +302,7 @@ class TrackingVH : public ValueHandleBase { ValueTy *getValPtr() const { CheckValidity(); - return static_cast<ValueTy*>(ValueHandleBase::getValPtr()); + return (ValueTy*)ValueHandleBase::getValPtr(); } void setValPtr(ValueTy *P) { CheckValidity(); |