Commit Graph

1173 Commits

Author SHA1 Message Date
Erik Eckstein
fb00bc3b44 Swift SIL: add the SmallProjectionPath utility
The `SmallProjectionPath` represents a path of value or address projections.
It’s used for defining argument effects for functions and for the new escape analysis.
2022-01-25 11:29:25 +01:00
Erik Eckstein
887b5ca891 add a Swift pass which can run unit tests.
The `run-unit-tests` is a "pseudo" pass which is invoked from sil-opt and runs all the unit tests, implemented in Swift.
This is done from the `swift-unit-tests.sil` lit test.
2022-01-25 11:29:25 +01:00
Erik Eckstein
93f5d9f176 swift SIL: Type.getStructFields -> Type.getNominalFields
To be able to get class fields as well as struct fields
2022-01-25 11:29:25 +01:00
Max Desiatov
1f53563780 libswift: remove Instruction.mayReadRefCount 2022-01-19 18:51:19 +00:00
Max Desiatov
40e805de11 libswift: simplify ReleaseDevirtualizer.swift 2022-01-19 18:51:19 +00:00
Max Desiatov
d7144c0046 libswift: implement isFieldOnlyNonTrivialField 2022-01-19 18:51:19 +00:00
Max Desiatov
848fa70529 libswift: reimplement Instruction helpers in Swift 2022-01-19 18:51:19 +00:00
Max Desiatov
b964dba177 libswift: implement ReleaseDevirtualizer in Swift 2022-01-19 18:51:19 +00:00
Max Desiatov
7d961001d3 libswift: bridge more functions from SILBuilder 2022-01-19 18:51:18 +00:00
Erik Eckstein
82ad1fa5a1 CalleeAnalysis: add getDestructors(destroyInst: Instruction) 2022-01-12 15:47:16 +01:00
Erik Eckstein
31143bf79c Swift Optimizer: add the Builder.insert(after: Instruction ...) utility
For inserting new instruction after another instruction. This is especially interesting if the insertion point is a terminator.
In this case, the new instruction(s) are inserted in the successor block(s).
2022-01-12 15:47:16 +01:00
Erik Eckstein
e028239cc2 Swift Optimizer: add AllocRefInstBase.setIsStackAllocatable 2022-01-12 15:47:16 +01:00
Erik Eckstein
e152b2cb4a Swift Optimizer: add the fixStackNesting utility in PassContext
This bridges to the StackNesting utility in C++
2022-01-12 15:47:16 +01:00
Erik Eckstein
a24b17a333 Swift Optimizer: add the dominator and post-dominator tree analysis 2022-01-12 15:47:16 +01:00
Erik Eckstein
4440beb555 Swift Optimizer: add bridging to the DeadEndBlocksAnalysis 2022-01-12 15:47:16 +01:00
Erik Eckstein
40200d6544 Swift Optimizer: add BasicBlock utility data structures and rename StackList
* add `BasicBlockSet`
* add `BasicBlockWorklist`
* add `BasicBlockRange`, which defines a range of blocks from a common dominating “begin” block to a set of “end” blocks.
* add  `InstructionRange`, which is similar to `BasicBlockRange`, just on instruction level. It can be used for value lifetime analysis.
* rename `StackList` -> `Stack` and move it to `Optimizer/DataStructures`
* rename `PassContext.passContext` to `PassContext._bridged`
* add notify-functions to PassContext
2022-01-12 15:47:16 +01:00
Erik Eckstein
345fcbe39a Improve collections in the swift SIL/Optimizer
Improve block/instruction lists and similar collections

* pretty print collections in the form “[a, b, c]”
* also do this for lazy sequences
* define a custom Mirror
* in a collection, only print the name of blocks, functions and globals (instead of the full object)
* replace `BasicBlock.reverseInstructions` with `BasicBlock.instructions.reversed()` - in an efficient way
2022-01-12 15:47:16 +01:00
Max Desiatov
e90fc5f2d0 libswift: add single-threaded pass docs, fix test 2022-01-10 12:03:14 +00:00
Max Desiatov
42e6fac1ea libswift: reimplement AssumeSingleThreaded pass 2022-01-10 08:47:43 +00:00
Max Desiatov
e54524d7a5 Gardening: remove trailing whitespaces in libswift 2022-01-09 21:09:57 +00:00
Erik Eckstein
3540c01125 rename initializeLibSwift -> InitializeSwiftModules
and some updates in comments.
2021-12-22 11:31:52 +01:00
Erik Eckstein
ba364a17ef libswift: rename cmake targets and functions
libswift -> swiftCompilerModules or swiftCompilerSources
2021-12-22 11:31:52 +01:00
Erik Eckstein
4beb94c2f9 Rename the libswift directory to SwiftCompilerSources 2021-12-22 09:46:25 +01:00