Andrew Trick
4796e55256
SwiftCompilerSources CopyingInstruction
...
And UnmanagedRetain/Release.
2024-01-30 08:38:57 -08:00
Andrew Trick
9950784adb
SwiftCompilerSources API for SourceDestAddrInstructions.
2024-01-30 08:38:57 -08:00
Andrew Trick
1396d6b9d0
Bridge YieldInfo
2024-01-30 08:38:57 -08:00
Andrew Trick
9770ce41a2
Improve the ArgumentConvention API
2024-01-30 08:38:57 -08:00
Arnold Schwaighofer
edd7eaa0d7
OSLog: os_log strings should be in the __oslogstring section on machO
...
rdar://121384422
2024-01-26 08:30:56 -08:00
Andrew Trick
3f8a35e64f
ForwardingUtils comments and cleanup.
2024-01-22 23:55:29 -08:00
Andrew Trick
d9a8a0eb60
Added SourceDestAddrInstruction
2024-01-22 23:42:54 -08:00
Andrew Trick
e7a3ceb0d5
SwiftCompilerSources: add VarDecl.sourceLoc
2024-01-22 08:29:07 -08:00
Andrew Trick
a80686b485
[SIL] bridge MoveValue and BeginBorrow .isFromVarDecl
2024-01-22 08:29:07 -08:00
Andrew Trick
e4d8277723
SwiftCompilerSources: add UseList ignoreTypeDependence
2024-01-17 08:37:14 -08:00
Andrew Trick
f69dfe4e79
Add OperandOwnership.endsLifetime
...
And rename `uses.lifetimeEndingUses` to `uses.endingLifetime`
2024-01-17 08:37:14 -08:00
Andrew Trick
d8b901052a
Add Swift SIL instructions needed by AddressUseVisitor
2024-01-17 08:37:14 -08:00
Erik Eckstein
3229749257
SwiftCompilerSources: move some private utilities of passes into OptUtils
...
* `var Function.initializedGlobal`
* `func getGlobalInitialization`
and add `var CollectionLikeSequence.singleElement`
2024-01-10 09:34:01 +01:00
Erik Eckstein
bc99986cf9
SIL: add a dependency token operand to global_addr
...
Optionally, the dependency to the initialization of the global can be specified with a dependency token `depends_on <token>`.
This is usually a `builtin "once"` which calls the initializer for the global variable.
2024-01-10 09:33:58 +01:00
nate-chandler
7365f9f36b
Merge pull request #70774 from nate-chandler/nfc/20240108/1/deinit-barrier-component-predicates
...
[NFC] SIL: Clarified deinit barrier APIs.
2024-01-08 23:11:38 -08:00
Nate Chandler
77fd37be99
[NFC] SIL: Renamed maySynchronize.
...
Dropped the NotConsideringSideEffects suffix.
2024-01-08 13:35:20 -08:00
Andrew Trick
264cbaea42
Add mark_dependence [nonescaping] flag.
...
The dependent 'value' may be marked 'nonescaping', which guarantees that the
lifetime dependence is statically enforceable. In this case, the compiler
must be able to follow all values forwarded from the dependent 'value', and
recognize all final (non-forwarded, non-escaping) use points. This implies
that `findPointerEscape` is false. A diagnostic pass checks that the
incoming SIL to verify that these use points are all initially within the
'base' lifetime. Regular 'mark_dependence' semantics ensure that
optimizations cannot violate the lifetime dependence after diagnostics.
2024-01-04 14:47:35 -08:00
Andrew Trick
2128c21106
Migrate SwiftCompilerSources to FunctionConvention.
...
Layers:
- FunctionConvention: AST FunctionType: results, parameters
- ArgumentConventions: SIL function arguments
- ApplyOperandConventions: applied operands
The meaning of an integer index is determined by the collection
type. All the mapping between the various indices (results,
parameters, SIL argument, applied arguments) is restricted to the
collection type that owns that mapping. Remove the concept of a
"caller argument index".
2024-01-03 12:24:50 -08:00
Meghana Gupta
ba4cedd5e5
Merge pull request #70582 from meg-gupta/resultdependsoninsil
...
Make _resultDependsOn/_resultDependsOnSelf available in SIL
2024-01-02 10:49:20 -08:00
Erik Eckstein
85be96354f
SimplifyBuiltin: fix simplification of is_same_metatype with dynamic_self types
...
Dynamic self types are not the same as non-dynamic self types.
Fixes a miscompile with dynamic self type comparisons.
rdar://119943508
2024-01-02 09:23:42 +01:00
Meghana Gupta
3c56a7a88e
Bridge hasResultDependsOnSelf()
2023-12-29 02:06:15 -08:00
Meghana Gupta
334ede0b01
Bridge hasResultDependsOn()
2023-12-29 02:06:12 -08:00
Andrew Trick
7dc3d72483
Merge pull request #70485 from atrick/bridge-util
...
[NFC] Bridging and utilities for SwiftCompilerSources required by lifetime dependence utilities.
2023-12-19 13:07:45 -08:00
Andrew Trick
d0b47b878c
SwiftCompilerSources: add CollectionLikeSequence.contains()
2023-12-19 02:05:16 -08:00
Andrew Trick
3f0d309ed4
SwiftCompilerSources: add Sequence.walk()
2023-12-19 02:05:16 -08:00
Andrew Trick
53d3c63ef7
[SIL] add Value.hasLifetime
2023-12-19 02:05:16 -08:00
Andrew Trick
ed53ab764a
[SIL] add Value.lifetimeEndingUses
2023-12-19 02:05:16 -08:00
Andrew Trick
2a9aef9eb8
[SIL] add BeginApplyInst.token
2023-12-19 02:05:16 -08:00
Andrew Trick
0ddf2a8514
[SIL] add BasicBlock.singleSuccessor
2023-12-19 02:05:16 -08:00
Andrew Trick
c1f0f06907
[SIL] Add FunctionConvention.swift
...
Bridge information about the AST function type that does not require a
SIL function body.
Support querying the function type's ResultInfo.
2023-12-18 09:43:18 -08:00
Andrew Trick
7a18dd46d5
[SIL] Add Argument.incomingOperand(inPredecessor:)
2023-12-18 09:43:10 -08:00
Andrew Trick
3407ccd693
[SIL] bridge Argument.isReborrow
2023-12-18 09:28:23 -08:00
Andrew Trick
b637f06acd
[SIL] Bridge findPointerEscape() and fix OnoneSimplifyable
...
Do not bridge the hasPointerEscape flag until it is implemented.
2023-12-18 09:16:55 -08:00
Erik Eckstein
84e06322b9
SwiftCompilerSources: bridge_object_to_word is not a ForwardingInstruction
...
Fix this mismatch between C++ SIL and swift SIL.
Fixes a crash in begin_borrow simplification
Also add an assert to catch such cases.
rdar://119763595
2023-12-18 11:08:22 +01:00
Erik Eckstein
60baf111ff
Remove Type.selfOrAnyFieldHasValueDeinit
...
It's not needed anymore
2023-12-13 20:03:02 +01:00
Erik Eckstein
e652f2c92e
SIL: add the alloc_vector and vector instructions
...
* `alloc_vector`: allocates an uninitialized vector of elements on the stack or in a statically initialized global
* `vector`: creates an initialized vector in a statically initialized global
2023-12-09 18:49:55 +01:00
Erik Eckstein
9514b3450c
SwiftCompilerSources: add some context APIs
...
* `Context.moduleIsSerialized`
* `Context.getBuiltinIntegerType`
* `Instruction.move(before:)`
2023-12-09 18:48:50 +01:00
Erik Eckstein
0bd6034270
SwiftCompilerSources: add some Builder APIs
...
* `createAddressToPointer`
* `createLoadBorrow`
2023-12-09 18:48:50 +01:00
Erik Eckstein
bfeb2128cb
remove default value for the keepUnique argument of Builder.createEndCOWMutation
...
This avoids bugs because the default value false is sometimes not the right choice.
NFC
2023-12-06 15:40:08 +01:00
eeckstein
10ff55b2b3
Merge pull request #70155 from eeckstein/refactoring
...
MemoryLifetimeVerifier: use CalleeCache instead of AliasAnalysis
2023-12-04 08:53:59 +01:00
Erik Eckstein
0897d8a720
MemoryLifetimeVerifier: use CalleeCache instead of AliasAnalysis
...
To verify if a function may read from an indirect argument, don't use AliasAnalysis.
Instead use the CalleeCache to get the list of callees of an apply instruction.
Then use a simple call-back into the swift Function to check if a callee has any relevant memory effect set.
This avoids a dependency from SIL to the Optimizer.
It fixes a linker error when building some unit tests in debug.
2023-12-01 19:20:18 +01:00
Erik Eckstein
80ace58104
SwiftCompilerSources: split SIL/Utils.swift into multiple files
2023-12-01 19:20:13 +01:00
Erik Eckstein
ec4c815506
SwiftCompilerSources: move WalkUtils and AccessUtils from the Optimizer module to the SIL module
...
Those utilities are conceptually part of the SIL definition.
2023-12-01 19:20:13 +01:00
zoecarver
69498e2f2e
[opt] Add three new perf annotations: @_noRuntime, @_noExistential, and @_noObjCBridging.
2023-12-01 09:13:24 -07:00
Erik Eckstein
6aaf2005d3
SwiftCompilerSources: remove the BeginBorrowInst.endBorrows API
...
Using this API almost certainly indicates a bug, because it neglects re-borrows.
2023-11-27 16:20:47 +01:00
Erik Eckstein
e4d227a5fb
SwiftCompilerSources: add StoreBorrowInst and BorrowIntroducingInstruction
...
`BorrowIntroducingInstruction` is a protocol to which all instructions conform which start a borrow-scope which must be ended by `EndBorrowInst` instructions: `begin_borrow`, `load_borrow` and `store_borrow`
2023-11-27 16:20:47 +01:00
eeckstein
67ebbee39e
Merge pull request #69955 from eeckstein/deinit-devirtualizer
...
Optimizer: de-virtualize deinits of non-copyable types
2023-11-27 12:41:49 +01:00
Erik Eckstein
37c715c58c
SwiftCompilerSources: add EndLifetimeInst
2023-11-27 09:21:33 +01:00
Erik Eckstein
6f6c0a5608
SwiftCompilerSources: add a few enum related APIs in Type and Builder
...
* `Type.getEnumCases`
* `Builder.createUncheckedTakeEnumDataAddr`
* `Builder.createSwitchEnumAddr`
2023-11-27 09:21:33 +01:00
Erik Eckstein
fc534e1c28
SwiftCompilerSources: better APIs for handling resilient nominal types
...
* add `NominalTypeDecl.isResilient`
* make the return type of `Type.getNominalFields` optional and return nil in case the nominal type is resilient.
This forces users of this API to think about what to do in case the nominal type is resilient.
2023-11-27 09:21:33 +01:00