1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

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
This commit is contained in:
Duncan P. N. Exon Smith 2015-04-24 20:16:42 +00:00
parent 2fcc0180e4
commit 4122fc2fd6
2 changed files with 23 additions and 21 deletions

View File

@ -954,10 +954,9 @@ public:
typedef std::pair<unsigned, TrackingMDNodeRef> MDPairTy; typedef std::pair<unsigned, TrackingMDNodeRef> MDPairTy;
typedef SmallVector<MDPairTy, 2> MDMapTy; typedef SmallVector<MDPairTy, 2> MDMapTy;
/// MetadataStore - Collection of per-instruction metadata used in this /// Collection of per-instruction metadata used in this context.
/// context. DenseMap<const Instruction *, MDMapTy> InstructionMetadata;
DenseMap<const Instruction *, MDMapTy> MetadataStore;
/// DiscriminatorTable - This table maps file:line locations to an /// DiscriminatorTable - This table maps file:line locations to an
/// integer representing the next DWARF path discriminator to assign to /// integer representing the next DWARF path discriminator to assign to
/// instructions in different blocks at the same location. /// instructions in different blocks at the same location.

View File

@ -997,17 +997,17 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
if (!hasMetadataHashEntry()) if (!hasMetadataHashEntry())
return; // Nothing to remove! return; // Nothing to remove!
DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &MetadataStore = DenseMap<const Instruction *, LLVMContextImpl::MDMapTy> &InstructionMetadata =
getContext().pImpl->MetadataStore; getContext().pImpl->InstructionMetadata;
if (KnownSet.empty()) { if (KnownSet.empty()) {
// Just drop our entry at the store. // Just drop our entry at the store.
MetadataStore.erase(this); InstructionMetadata.erase(this);
setHasMetadataHashEntry(false); setHasMetadataHashEntry(false);
return; return;
} }
LLVMContextImpl::MDMapTy &Info = MetadataStore[this]; LLVMContextImpl::MDMapTy &Info = InstructionMetadata[this];
unsigned I; unsigned I;
unsigned E; unsigned E;
// Walk the array and drop any metadata we don't know. // Walk the array and drop any metadata we don't know.
@ -1025,7 +1025,7 @@ void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
if (E == 0) { if (E == 0) {
// Drop our entry at the store. // Drop our entry at the store.
MetadataStore.erase(this); InstructionMetadata.erase(this);
setHasMetadataHashEntry(false); 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. // Handle the case when we're adding/updating metadata on an instruction.
if (Node) { if (Node) {
LLVMContextImpl::MDMapTy &Info = getContext().pImpl->MetadataStore[this]; LLVMContextImpl::MDMapTy &Info =
getContext().pImpl->InstructionMetadata[this];
assert(!Info.empty() == hasMetadataHashEntry() && assert(!Info.empty() == hasMetadataHashEntry() &&
"HasMetadata bit is wonked"); "HasMetadata bit is wonked");
if (Info.empty()) { if (Info.empty()) {
@ -1067,15 +1068,16 @@ void Instruction::setMetadata(unsigned KindID, MDNode *Node) {
// Otherwise, we're removing metadata from an instruction. // Otherwise, we're removing metadata from an instruction.
assert((hasMetadataHashEntry() == assert((hasMetadataHashEntry() ==
(getContext().pImpl->MetadataStore.count(this) > 0)) && (getContext().pImpl->InstructionMetadata.count(this) > 0)) &&
"HasMetadata bit out of date!"); "HasMetadata bit out of date!");
if (!hasMetadataHashEntry()) if (!hasMetadataHashEntry())
return; // Nothing to remove! 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. // Common case is removing the only entry.
if (Info.size() == 1 && Info[0].first == KindID) { if (Info.size() == 1 && Info[0].first == KindID) {
getContext().pImpl->MetadataStore.erase(this); getContext().pImpl->InstructionMetadata.erase(this);
setHasMetadataHashEntry(false); setHasMetadataHashEntry(false);
return; return;
} }
@ -1103,8 +1105,9 @@ MDNode *Instruction::getMetadataImpl(unsigned KindID) const {
return DbgLoc.getAsMDNode(); return DbgLoc.getAsMDNode();
if (!hasMetadataHashEntry()) return nullptr; 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"); assert(!Info.empty() && "bit out of sync with hash table");
for (const auto &I : Info) for (const auto &I : Info)
@ -1123,12 +1126,12 @@ void Instruction::getAllMetadataImpl(
std::make_pair((unsigned)LLVMContext::MD_dbg, DbgLoc.getAsMDNode())); std::make_pair((unsigned)LLVMContext::MD_dbg, DbgLoc.getAsMDNode()));
if (!hasMetadataHashEntry()) return; if (!hasMetadataHashEntry()) return;
} }
assert(hasMetadataHashEntry() && assert(hasMetadataHashEntry() &&
getContext().pImpl->MetadataStore.count(this) && getContext().pImpl->InstructionMetadata.count(this) &&
"Shouldn't have called this"); "Shouldn't have called this");
const LLVMContextImpl::MDMapTy &Info = const LLVMContextImpl::MDMapTy &Info =
getContext().pImpl->MetadataStore.find(this)->second; getContext().pImpl->InstructionMetadata.find(this)->second;
assert(!Info.empty() && "Shouldn't have called this"); assert(!Info.empty() && "Shouldn't have called this");
Result.reserve(Result.size() + Info.size()); Result.reserve(Result.size() + Info.size());
@ -1144,10 +1147,10 @@ void Instruction::getAllMetadataOtherThanDebugLocImpl(
SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const { SmallVectorImpl<std::pair<unsigned, MDNode *>> &Result) const {
Result.clear(); Result.clear();
assert(hasMetadataHashEntry() && assert(hasMetadataHashEntry() &&
getContext().pImpl->MetadataStore.count(this) && getContext().pImpl->InstructionMetadata.count(this) &&
"Shouldn't have called this"); "Shouldn't have called this");
const LLVMContextImpl::MDMapTy &Info = const LLVMContextImpl::MDMapTy &Info =
getContext().pImpl->MetadataStore.find(this)->second; getContext().pImpl->InstructionMetadata.find(this)->second;
assert(!Info.empty() && "Shouldn't have called this"); assert(!Info.empty() && "Shouldn't have called this");
Result.reserve(Result.size() + Info.size()); Result.reserve(Result.size() + Info.size());
for (auto &I : Info) for (auto &I : Info)
@ -1162,6 +1165,6 @@ void Instruction::getAllMetadataOtherThanDebugLocImpl(
/// this instruction. /// this instruction.
void Instruction::clearMetadataHashEntries() { void Instruction::clearMetadataHashEntries() {
assert(hasMetadataHashEntry() && "Caller should check"); assert(hasMetadataHashEntry() && "Caller should check");
getContext().pImpl->MetadataStore.erase(this); getContext().pImpl->InstructionMetadata.erase(this);
setHasMetadataHashEntry(false); setHasMetadataHashEntry(false);
} }