diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-24 20:16:42 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-04-24 20:16:42 +0000 |
| commit | 391fc56ffd1831565ce3050442a562529665d101 (patch) | |
| tree | 44a1d8f217830a46bcbbba789f7f8ca989374b25 /llvm/lib | |
| parent | 44e768e777cbb4c8c3a4ecf92cf3f6809d5643a9 (diff) | |
| download | bcm5719-llvm-391fc56ffd1831565ce3050442a562529665d101.tar.gz bcm5719-llvm-391fc56ffd1831565ce3050442a562529665d101.zip | |
IR: Rename LLVMContextImpl::MetadataStore to InstructionMetadata
Rename `MetadataStore` to the more explicit `InstructionMetadata`. This
will make room for `FunctionMetadata` (start of PR23340).
llvm-svn: 235763
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/LLVMContextImpl.h | 7 | ||||
| -rw-r--r-- | llvm/lib/IR/Metadata.cpp | 37 |
2 files changed, 23 insertions, 21 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 4eb37fd14be..aa4c697455b 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -954,10 +954,9 @@ public: typedef std::pair<unsigned, TrackingMDNodeRef> MDPairTy; typedef SmallVector<MDPairTy, 2> MDMapTy; - /// MetadataStore - Collection of per-instruction metadata used in this - /// context. - DenseMap<const Instruction *, MDMapTy> MetadataStore; - + /// Collection of per-instruction metadata used in this context. + DenseMap<const Instruction *, MDMapTy> InstructionMetadata; + /// DiscriminatorTable - This table maps file:line locations to an /// integer representing the next DWARF path discriminator to assign to /// instructions in different blocks at the same location. diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 93098b9da7e..886c084fb99 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -997,17 +997,17 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) { if (!hasMetadataHashEntry()) return; // Nothing to remove! - DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &MetadataStore = - getContext().pImpl->MetadataStore; + DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &InstructionMetadata = + getContext().pImpl->InstructionMetadata; if (KnownSet.empty()) { // Just drop our entry at the store. - MetadataStore.erase(this); + InstructionMetadata.erase(this); setHasMetadataHashEntry(false); return; } - LLVMContextImpl::MDMapTy &Info = MetadataStore[this]; + LLVMContextImpl::MDMapTy &Info = InstructionMetadata[this]; unsigned I; unsigned E; // Walk the array and drop any metadata we don't know. @@ -1025,7 +1025,7 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) { if (E == 0) { // Drop our entry at the store. - MetadataStore.erase(this); + InstructionMetadata.erase(this); setHasMetadataHashEntry(false); } } @@ -1045,7 +1045,8 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) { // Handle the case when we're adding/updating metadata on an instruction. if (Node) { - LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this]; + LLVMContextImpl::MDMapTy &Info = + getContext().pImpl->InstructionMetadata[this]; assert(!Info.empty() == hasMetadataHashEntry() && "HasMetadata bit is wonked"); if (Info.empty()) { @@ -1067,15 +1068,16 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) { // Otherwise, we're removing metadata from an instruction. assert((hasMetadataHashEntry() == - (getContext().pImpl->MetadataStore.count(this) > 0)) && + (getContext().pImpl->InstructionMetadata.count(this) > 0)) && "HasMetadata bit out of date!"); if (!hasMetadataHashEntry()) return; // Nothing to remove! - LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this]; + LLVMContextImpl::MDMapTy &Info = + getContext().pImpl->InstructionMetadata[this]; // Common case is removing the only entry. if (Info.size() == 1 && Info[0].first == KindID) { - getContext().pImpl->MetadataStore.erase(this); + getContext().pImpl->InstructionMetadata.erase(this); setHasMetadataHashEntry(false); return; } @@ -1103,8 +1105,9 @@ MDNode *Instruction::getMetadataImpl(unsigned KindID) const { return DbgLoc.getAsMDNode(); if (!hasMetadataHashEntry()) return nullptr; - - LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this]; + + LLVMContextImpl::MDMapTy &Info = + getContext().pImpl->InstructionMetadata[this]; assert(!Info.empty() && "bit out of sync with hash table"); for (const auto &I : Info) @@ -1123,12 +1126,12 @@ void Instruction::getAllMetadataImpl( std::make_pair((unsigned)LLVMContext::MD_dbg, DbgLoc.getAsMDNode())); if (!hasMetadataHashEntry()) return; } - + assert(hasMetadataHashEntry() && - getContext().pImpl->MetadataStore.count(this) && + getContext().pImpl->InstructionMetadata.count(this) && "Shouldn't have called this"); const LLVMContextImpl::MDMapTy &Info = - getContext().pImpl->MetadataStore.find(this)->second; + getContext().pImpl->InstructionMetadata.find(this)->second; assert(!Info.empty() && "Shouldn't have called this"); Result.reserve(Result.size() + Info.size()); @@ -1144,10 +1147,10 @@ void Instruction::getAllMetadataOtherThanDebugLocImpl( SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const { Result.clear(); assert(hasMetadataHashEntry() && - getContext().pImpl->MetadataStore.count(this) && + getContext().pImpl->InstructionMetadata.count(this) && "Shouldn't have called this"); const LLVMContextImpl::MDMapTy &Info = - getContext().pImpl->MetadataStore.find(this)->second; + getContext().pImpl->InstructionMetadata.find(this)->second; assert(!Info.empty() && "Shouldn't have called this"); Result.reserve(Result.size() + Info.size()); for (auto &I : Info) @@ -1162,6 +1165,6 @@ void Instruction::getAllMetadataOtherThanDebugLocImpl( /// this instruction. void Instruction::clearMetadataHashEntries() { assert(hasMetadataHashEntry() && "Caller should check"); - getContext().pImpl->MetadataStore.erase(this); + getContext().pImpl->InstructionMetadata.erase(this); setHasMetadataHashEntry(false); } |

