IR: MDNode => Value: Add Instruction::getMDNode()

Add `Instruction::getMDNode()` that casts to `MDNode` before changing
`Instruction::getMetadata()` to return `Value`.  This avoids adding
`cast_or_null<MDNode>` boiler-plate throughout the code.

Part of PR21433.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221023 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan P. N. Exon Smith
2014-10-31 23:58:04 +00:00
parent 8d2e511d3b
commit 9ed44978ef
2 changed files with 28 additions and 0 deletions

View File

@@ -609,6 +609,14 @@ MDNode *Instruction::getMetadataImpl(StringRef Kind) const {
return getMetadataImpl(getContext().getMDKindID(Kind));
}
MDNode *Instruction::getMDNodeImpl(unsigned KindID) const {
return getMetadataImpl(KindID);
}
MDNode *Instruction::getMDNodeImpl(StringRef Kind) const {
return getMetadataImpl(Kind);
}
void Instruction::dropUnknownMetadata(ArrayRef<unsigned> KnownIDs) {
SmallSet<unsigned, 5> KnownSet;
KnownSet.insert(KnownIDs.begin(), KnownIDs.end());