Swift SIL: add some APIs

This commit is contained in:
Erik Eckstein
2023-05-19 18:33:11 +02:00
parent b707b5a595
commit ee1c52bc77
9 changed files with 103 additions and 2 deletions

View File

@@ -107,6 +107,19 @@ public struct UseList : CollectionLikeSequence {
return nil
}
public func getSingleUser<I: Instruction>(ofType: I.Type) -> I? {
var result: I? = nil
for use in self {
if let user = use.instruction as? I {
if result != nil {
return nil
}
result = user
}
}
return result
}
public var isSingleUse: Bool { singleUse != nil }
public func makeIterator() -> Iterator {