Kuba Mracek
efd8f08ea0
[embedded] Add notifyCallsChanged() to specializeClassMethodInst
2023-09-20 09:49:57 -07:00
Kuba Mracek
f0c8a59486
[embedded] Drop notifyInstructionsChanged() from specializeVTable() as we're not changing any instructions
2023-09-20 09:48:31 -07:00
Kuba Mracek
89df0426e0
[embedded] Specialize vtables when processing instructions, not bulk
2023-09-20 09:41:09 -07:00
Kuba Mracek
03f927eca1
[embedded] Perform VTable specialization iteratively as part of MandatoryPerformanceOptimizations
2023-09-20 09:41:09 -07:00
Erik Eckstein
ad594f2713
Swift SIL: add some APIs
...
* `AssignInst`
* `Function.isDestructor`
* `MarkUninitializedInst.kind`
* `Type.isMoveOnly`
* `RefElementAddrInst.isImmutable` and `RefElementAddrInst.set(isImmutable:)`
* `BeginBorrowInst.endBorrows`
* `Context.hadError` and `Context.silStage`
2023-09-19 15:10:30 +02:00
Erik Eckstein
d9826f6043
SimplifyBranch: don't leave an empty block after merging two basic blocks
...
Although empty blocks are cleaned up at the end of every Simplification pass, it's not legal SIL to have empty blocks and subsequent simplification passes may crash because of this.
rdar://115169880
2023-09-11 14:11:46 +02:00
Erik Eckstein
8223b3e210
MandatoryPerformanceOptimizations: fix some problems with inilning
...
* don't inline functions if it's not possible - by checking `SILInliner::canInlineApplySite`
* fix stack nesting after inlining a `begin_apply`
2023-08-10 15:01:47 +02:00
Kuba Mracek
5dac59ce71
Move TargetConstantFolding pass to the simplification passes in Swift, enable using MemoryLayout's .size, .stride, .alignment fields in forced-const global initializers
2023-07-31 10:54:07 -07:00
Erik Eckstein
f623a879ce
Swift Optimizer: add LoadInst.set(ownership:)
2023-07-21 07:19:12 +02:00
Erik Eckstein
ff913d2fa6
Swift Optimizer: add the FunctionPassContext.swiftArrayDecl API
2023-07-21 07:19:12 +02:00
Erik Eckstein
2e9de24e2a
Swift Optimizer: add the SSAUpdater utility
2023-07-21 07:19:12 +02:00
Erik Eckstein
625619ee17
SIL: add a bare attribute to global_value
...
The `bare` attribute indicates that the object header is not used throughout the lifetime of the value.
This means, no reference counting operations are performed on the object and its metadata is not used.
The header of bare objects doesn't need to be initialized.
2023-06-29 06:57:05 +02:00
Erik Eckstein
b08710d911
SIL: add a bare attribute to alloc_ref
...
The `bare` attribute indicates that the object header is not used throughout the lifetime of the object.
This means, no reference counting operations are performed on the object and its metadata is not used.
The header of bare objects doesn't need to be initialized.
2023-06-29 06:57:05 +02:00
Erik Eckstein
d02765fd54
Swift SIL: some new APIs and some refactoring
2023-05-25 16:28:41 +02:00
Erik Eckstein
585395b67c
Swift Optimizer: add Context.lookupStdlibFunction
2023-05-22 15:34:26 +02:00
Erik Eckstein
38de5b1ab5
Swift SIL/Optimizer: implement cloning of static init values of globals in Swift
...
* add the StaticInitCloner utility
* remove bridging of `copyStaticInitializer` and `createStaticInitializer`
* add `Context.mangleOutlinedVariable` and `Context.createGlobalVariable`
2023-05-22 15:34:26 +02:00
Erik Eckstein
dc3cb18029
Swift Optimizer: add the MandatoryPerformanceOptimizations pass
...
As a replacement for the old MandatoryGenericSpecializer
The pass it not enabled yet in the pass pipeline
2023-05-11 08:11:44 +02:00
Erik Eckstein
82734b6ac2
Swift Optimizer: simplification for apply, try_apply, begin_apply and partial_apply
...
* move the apply of partial_apply transformation from simplify-apply to simplify-partial_apply
* delete dead partial_apply instructions
* devirtualize apply, try_apply and begin_apply
2023-05-11 08:11:44 +02:00
Erik Eckstein
6eff928989
Swift Optimizer: add a message to an assert
2023-05-11 08:11:44 +02:00
Erik Eckstein
08e75f2c50
Swift SIL: add the Operand.set API
...
as a shortcut for `Instruction.setOperand`
2023-05-11 08:03:19 +02:00
Erik Eckstein
2b117fd3ee
Swift Optimizer: add APIs to copy from or to a global static initializer
...
* `Context.copyStaticInitializer(fromInitValue:, to:)`
* `FunctionPassContext.createStaticInitializer(for:,initValue:)`
2023-05-08 21:23:36 +02:00
Erik Eckstein
9b51e69dac
Swift Optimizer: constant fold builtins in the simplification passes
2023-05-08 21:23:36 +02: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
4445373808
Swift Bridging: use C++ instead of C bridging for BridgedInstruction
2023-03-21 15:33:09 +01:00
Erik Eckstein
c4f5bab5b7
Swift Bridging: use C++ instead of C bridging for BridgedBasicBlock
2023-03-21 15:33:09 +01:00
Erik Eckstein
ae7770d911
Swift Bridging: use C++ instead of C bridging for BridgedFunction
2023-03-21 15:33:09 +01:00
Erik Eckstein
eecea088e7
Swift Bridging: use C++ instead of C bridging for BridgedOperand and BridgedValue
2023-03-21 15:33:09 +01:00
Erik Eckstein
230c93df30
SIL Optimizer: add some SIL modification APIs
...
* `MutatingContext.notifyInvalidatedStackNesting` and `MutatingContext.needFixStackNesting`
* `MutatingContext.tryDeleteDeadClosure`
* `MutatingContext.erase(block:)`
* `Undef.get`
* `BasicBlock.moveAllInstructions`
* `BasicBlock.eraseAllArguments`
* `BasicBlock.moveAllArguments`
* `TermInst.replaceBranchTarget`
2023-01-16 19:00:09 +01:00
Erik Eckstein
393d1a1488
SIL Builder: rename insert(at:) -> insert(before:)
...
It matches with `insert(after:)` and the intent should be clearer now
2023-01-16 15:11:34 +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