Commit Graph

12 Commits

Author SHA1 Message Date
Erik Eckstein
c8473da3a9 Swift Optimizer: add SpecificInstructionSet and SpecificInstructionWorklist
To be used for specific instruction types
2024-10-11 09:41:36 +02:00
Erik Eckstein
7512acfd31 SwiftCompilerSources: fix debug description of Set
Make each instruction to appear in a separate line
2024-07-29 17:33:43 +02:00
Erik Eckstein
3c368575b4 SwiftCompilerSources: add a few utility APIs 2024-04-10 13:38:10 +02:00
Erik Eckstein
367dc1a299 SwiftCompilerSources: add OperandSet and OperandWorklist
Implemented by bridging the C++ OperandSet, similar to BasicBlockSet and NodeSet
2024-03-21 15:52:39 +01:00
Erik Eckstein
010efc1ca6 Swift Bridging: use C++ instead of C bridging for the optimizer 2023-03-21 15:33:09 +01:00
Erik Eckstein
22f03cdde6 Swift Optimizer: generalize the worklist data structure
Rename `BasicBlockWorklist.swift` to `Worklist` and make it generic for any elements.
Also, add methods `popAndForget` and `isEmpty`
2023-01-16 16:16:51 +01:00
Erik Eckstein
cc68bd98c9 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
2023-01-16 15:11:34 +01:00
Erik Eckstein
81ac311c83 Swift Optimizer: add the DeadEndBlocks utility for finding dead-end blocks.
Dead-end blocks are blocks from which there is no path to the function exit (`return`, `throw` or unwind).
These are blocks which end with an unreachable instruction and blocks from which all paths end in "unreachable" blocks.
2022-10-05 07:37:41 +02:00
Erik Eckstein
aea26bbc6e Swift SIL: add a utility protocol NoReflectionChildren for better debug output with lldb po
Let's lldb's `po` command not print any "internal" properties of the conforming type.
This is useful if the `description` already contains all the information of a type instance.
2022-10-05 07:37:41 +02:00
Erik Eckstein
de6e539a0a Swift Optimizer: make the set's insert functions return a Bool.
Returning true if the element was not contained in the set before inserting
2022-08-24 17:54:46 +02:00
Erik Eckstein
3bba7caacc 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.
2022-08-24 17:54:46 +02:00
Erik Eckstein
49a5b3ebdc Swift SIL: add ValueSet and InstructionSet utilities.
These sets are _much_ more efficient than `Set<Value>` and `Set<Instruction>` because they bridge to the efficient `NodeSet`.
Insertions/deletions are just bit operations.
2022-07-13 14:27:50 +02:00