Dump the presence of attached metadata even if we don't know what it is. This

format is not parsable, even if the module is legal. To get parsable output,
dump the module instead of the function or smaller, since metadata kind are
attached to the module (not the context).

llvm-svn: 97124
This commit is contained in:
Nick Lewycky 2010-02-25 06:53:04 +00:00
parent 212e8c87ae
commit ba8ec9a9e4
1 changed files with 10 additions and 6 deletions

View File

@ -1988,12 +1988,16 @@ void AssemblyWriter::printInstruction(const Instruction &I) {
}
// Print Metadata info.
if (!MDNames.empty()) {
SmallVector<std::pair<unsigned, MDNode*>, 4> InstMD;
I.getAllMetadata(InstMD);
for (unsigned i = 0, e = InstMD.size(); i != e; ++i)
Out << ", !" << MDNames[InstMD[i].first]
<< " !" << Machine.getMetadataSlot(InstMD[i].second);
SmallVector<std::pair<unsigned, MDNode*>, 4> InstMD;
I.getAllMetadata(InstMD);
for (unsigned i = 0, e = InstMD.size(); i != e; ++i) {
unsigned Kind = InstMD[i].first;
if (Kind < MDNames.size()) {
Out << ", !" << MDNames[Kind];
} else {
Out << ", !<unknown kind #" << Kind << ">";
}
Out << " !" << Machine.getMetadataSlot(InstMD[i].second);
}
printInfoComment(I);
}