mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-03 05:41:42 +00:00
Do not assume that the module is set.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
127445818e
commit
7f93f4d66c
@ -1303,12 +1303,14 @@ public:
|
||||
: Out(o), Machine(Mac), TheModule(M), AnnotationWriter(AAW) {
|
||||
AddModuleTypesToPrinter(TypePrinter, NumberedTypes, M);
|
||||
// FIXME: Provide MDPrinter
|
||||
MetadataContext &TheMetadata = M->getContext().getMetadata();
|
||||
const StringMap<unsigned> *Names = TheMetadata.getHandlerNames();
|
||||
for (StringMapConstIterator<unsigned> I = Names->begin(),
|
||||
E = Names->end(); I != E; ++I) {
|
||||
const StringMapEntry<unsigned> &Entry = *I;
|
||||
MDNames[I->second] = Entry.getKeyData();
|
||||
if (M) {
|
||||
MetadataContext &TheMetadata = M->getContext().getMetadata();
|
||||
const StringMap<unsigned> *Names = TheMetadata.getHandlerNames();
|
||||
for (StringMapConstIterator<unsigned> I = Names->begin(),
|
||||
E = Names->end(); I != E; ++I) {
|
||||
const StringMapEntry<unsigned> &Entry = *I;
|
||||
MDNames[I->second] = Entry.getKeyData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2029,15 +2031,16 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
|
||||
}
|
||||
|
||||
// Print Metadata info
|
||||
MetadataContext &TheMetadata = I.getContext().getMetadata();
|
||||
const MetadataContext::MDMapTy *MDMap = TheMetadata.getMDs(&I);
|
||||
if (MDMap)
|
||||
for (MetadataContext::MDMapTy::const_iterator MI = MDMap->begin(),
|
||||
ME = MDMap->end(); MI != ME; ++MI)
|
||||
if (const MDNode *MD = dyn_cast_or_null<MDNode>(MI->second))
|
||||
Out << ", !" << MDNames[MI->first]
|
||||
<< " !" << Machine.getMetadataSlot(MD);
|
||||
|
||||
if (!MDNames.empty()) {
|
||||
MetadataContext &TheMetadata = I.getContext().getMetadata();
|
||||
const MetadataContext::MDMapTy *MDMap = TheMetadata.getMDs(&I);
|
||||
if (MDMap)
|
||||
for (MetadataContext::MDMapTy::const_iterator MI = MDMap->begin(),
|
||||
ME = MDMap->end(); MI != ME; ++MI)
|
||||
if (const MDNode *MD = dyn_cast_or_null<MDNode>(MI->second))
|
||||
Out << ", !" << MDNames[MI->first]
|
||||
<< " !" << Machine.getMetadataSlot(MD);
|
||||
}
|
||||
printInfoComment(I);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user