Commit Graph

17 Commits

Author SHA1 Message Date
Andrew Trick
001b162dc9 Surface addressableForDeps in SILType and FunctionConventions
With this approach, you cannot tell whether a parameter is addressable only
from the function type. Instead you need the SILValue that will be passed to the
call site.
2025-03-23 19:00:42 -07:00
Andrew Trick
a431a7bc5f LifetimeDependence: conditionallyAddressableParamIndices
Preserve conditionallyAddressableParamIndices independent of any
addressableParamIndices. The conditional dependencies are subject to change
based on type substitution.
2025-03-23 16:59:11 -07:00
Erik Eckstein
810064b7dc Cleanup and additions to AST and SIL Type/CanonicalType
* factor out common methods of AST Type/CanonicalType into a `TypeProperties` protocol.
* add more APIs to AST Type/CanoncialType.
* move `MetatypeRepresentation` from SIL.Type to AST.Type and implement it with a swift enum.
* let `Builder.createMetatype` get a CanonicalType as instance type, because the instance type must not be a lowered type.
2025-03-07 15:59:33 +01:00
Andrew Trick
bc6200e592 SwiftCompilerSources: bridge '@'_addressable dependencies 2025-03-03 11:56:37 -08:00
Erik Eckstein
10782cf42b SwiftCompilerSources: introduce the AST module
As the optimizer uses more and more AST stuff, it's now time to create an "AST" module.
Initially it defines following AST datastructures:
* declarations: `Decl` + derived classes
* `Conformance`
* `SubstitutionMap`
* `Type` and `CanonicalType`

Some of those were already defined in the SIL module and are now moved to the AST module.
This change also cleans up a few things:
* proper definition of `NominalTypeDecl`-related APIs in `SIL.Type`
* rename `ProtocolConformance` to `Conformance`
* use `AST.Type`/`AST.CanonicalType` instead of `BridgedASTType` in SIL and the Optimizer
2024-10-02 07:10:29 +02:00
Andrew Trick
1113c757f0 Improve function convention printing. 2024-07-29 23:44:02 -07:00
Andrew Trick
c4c66b4066 [SwiftCompilerSources] add parameter dependencies to conventions.
Add interfaces to FunctionConventions and ArgumentConventions for querying
lifetime dependencies where the target is another parameter.
2024-07-29 23:44:02 -07:00
Meghana Gupta
154989463b Add support for lifetime dependence in parameter position 2024-07-10 14:20:03 -07:00
Akira Hatanaka
42bc49d3fe Add a new parameter convention @in_cxx for non-trivial C++ classes that are passed indirectly and destructed by the caller (#73019)
This corresponds to the parameter-passing convention of the Itanium C++
ABI, in which the argument is passed indirectly and possibly modified,
but not destroyed, by the callee.

@in_cxx is handled the same way as @in in callers and @in_guaranteed in
callees. OwnershipModelEliminator emits the call to destroy_addr that is
needed to destroy the argument in the caller.

rdar://122707697
2024-06-27 09:44:04 -07:00
Kshitij
ab751d57ab [Autodiff] Adds logic to generate specialized functions in the closure-spec pass 2024-05-13 11:16:42 -07:00
Meghana Gupta
9c57458163 Fix index numbering in lifetime dependence 2024-04-08 22:33:28 -07:00
Andrew Trick
8b24382494 SwiftCompilerSources: cleanup and extend ArgumentConventions
Provide APIs needed by lifetime dependence diagnostics, namely LifetimeDependenceConvention.

Reorganize the APIs so it's easy to find related functionality which
API is responsible for which functionality.

Remove the originalFunctionConvention complexity. It is no longer
needed for lifetime dependence inference, and generally should be
avoided in SIL.

Add some placeholder FIXMEs because this not a good PR in which to
change existing functionality.
2024-02-12 09:57:14 -08:00
Andrew Trick
28b60e051d Bridge SILFunctionType LifetimeDependenceInfo 2024-02-12 09:57:14 -08:00
Erik Eckstein
240fa6d937 SIL: make swift ParameterInfo convertible back to C++ SILParameterInfo 2024-01-31 17:16:12 +01:00
Andrew Trick
1396d6b9d0 Bridge YieldInfo 2024-01-30 08:38:57 -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
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