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
Erik Eckstein
75da7d9d3e
Swift SIL: add a StringParser utility for simple parsing tasks
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
Erik Eckstein
cec4b82b39
swift SIL: add some SIL type related bridging
...
* `Function.argumentTypes` and `Function.resultType`
* `Type.isNominal`, `Type.isClass`, `Type.isTuple`, `Type.isStruct` and `Type.isEnum`
* `Type.getFieldIndexOfNominal`
* `Type.getFieldTypeOfNominal`
* `Type.tupleElements`
* `Type.description` for better debugging
# Conflicts:
# SwiftCompilerSources/Sources/SIL/Type.swift
# SwiftCompilerSources/Sources/SIL/Utils.swift
# SwiftCompilerSources/Sources/SIL/Value.swift
# include/swift/SIL/SILBridging.h
# lib/SIL/Utils/SILBridging.cpp
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
Max Desiatov
7eb3bdd746
libswift: add SubstitutionMap to Swift code
2022-01-19 18:51:18 +00:00
Max Desiatov
f2aefad246
libswift: clean up SIL/Function.swift formatting
2022-01-19 18:51:18 +00:00
Max Desiatov
c780969f79
libswift: clean up SIL/Type.swift formatting
2022-01-19 18:51:18 +00:00
Max Desiatov
196140ab95
libswift: clean up SIL/Utils.swift formatting
2022-01-19 18:51:18 +00:00
Max Desiatov
a0a2d8887b
libswift: clean up Instruction.swift formatting
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
Erik Eckstein
24b62d4d7c
Swift SIL: add a few utilities and instructions
...
* instructions: function_ref, mark_dependence
* add `BuiltinInst.id`
* add isObjC and canAllocOnStack for alloc_ref and alloc_ref_dynamic
* add `ApplySite::referencedFunction`
* add `Builder.createDeallocStackRef`
* add == and != operators for `Function`
* add `List.first` and `ReverseList.first`
2022-01-12 15:47:15 +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
383c52aa35
SIL: rename dealloc_ref [stack] -> dealloc_stack_ref
...
Introduce a new instruction `dealloc_stack_ref ` and remove the `stack` flag from `dealloc_ref`.
The `dealloc_ref [stack]` was confusing, because all it does is to mark the deallocation of the stack space for a stack promoted object.
2022-01-07 16:20:27 +01: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