Swift Optimizer: rework pass context types and instruction passes

* split the `PassContext` into multiple protocols and structs: `Context`, `MutatingContext`, `FunctionPassContext` and `SimplifyContext`
* change how instruction passes work: implement the `simplify` function in conformance to `SILCombineSimplifyable`
* add a mechanism to add a callback for inserted instructions
This commit is contained in:
Erik Eckstein
2023-01-02 16:19:25 +01:00
parent c32d6cd0fb
commit cc68bd98c9
38 changed files with 441 additions and 463 deletions

View File

@@ -48,7 +48,7 @@ struct InstructionRange : CustomStringConvertible, NoReflectionChildren {
private var insertedInsts: InstructionSet
init(begin beginInst: Instruction, _ context: PassContext) {
init(begin beginInst: Instruction, _ context: some Context) {
self.begin = beginInst
self.blockRange = BasicBlockRange(begin: beginInst.parentBlock, context)
self.insertedInsts = InstructionSet(context)