Swift SIL: add var Function.instructions

To be used to iterate over all instructions in a function without the need of two loops - one for blocks and one for instructions.
This commit is contained in:
Erik Eckstein
2022-08-10 19:25:39 +02:00
parent fd4e98a51e
commit 3bba7caacc
7 changed files with 68 additions and 77 deletions

View File

@@ -41,6 +41,11 @@ final public class Function : CustomStringConvertible, HasShortDescription {
entryBlock.arguments.lazy.map { $0 as! FunctionArgument }
}
/// All instructions of all blocks.
public var instructions: LazySequence<FlattenSequence<LazyMapSequence<List<BasicBlock>, List<Instruction>>>> {
blocks.lazy.flatMap { $0.instructions }
}
public var numIndirectResultArguments: Int {
SILFunction_numIndirectResultArguments(bridged)
}