Daniil Kovalev
|
02fcd218d7
|
Address review comments
|
2025-10-15 05:14:15 +03:00 |
|
Daniil Kovalev
|
b3d31c7d51
|
Bridging: Implement bridges required for ongoing AutoDiff changes
In #83926, part of the changes resolving #68944 is submitted. The AutoDiff
closure specialization optimizer pass relies on several bridges not
implemented yet.
This patch introduces these missing bridges. See the list of the changes below.
**AST:**
* Define `.asValueDecl` on each BridgedXXXDecl type that's also a ValueDecl.
* Define `.asNominalTypeDecl` on each BridgedXXXDecl type that's also a NominalTypeDecl.
* Define `.asGenericContext` on each BridgedXXXDecl type that's also a GenericContext.
* `class BridgedSourceFile`:
- Make nullable
- `func addTopLevelDecl(_ decl: BridgedDecl)`
* `class BridgedFileUnit`:
- `func castToSourceFile() -> BridgedNullableSourceFile`
* `class BridgedDecl`:
- `func getDeclContext() -> BridgedDeclContext`
* `class BridgedParamDecl`:
- `func cloneWithoutType() -> BridgedParamDecl`
- `func setInterfaceType(_ type : BridgedASTType)`
* Define `BridgedDecl.setImplicit()` instead of `BridgedParamDecl.setImplicit()`
* `class BridgedGenericContext`:
- `setGenericSignature(_ genSig: BridgedGenericSignature)`
* Change return type of `BridgedEnumDecl.createParsed(/*...*/)` from `BridgedNominalTypeDecl` to `BridgedEnumDecl`
* `class BridgedValueDecl`:
- `func setAccess(_ accessLevel: swift.AccessLevel)`
* `class BridgedNominalTypeDecl`:
- `func addMember(_ member: BridgedDecl)`
* `class BridgedGenericTypeParamDecl`:
- `func createImplicit(declContext: BridgedDeclContext, name: swift.Identifier, depth: UInt, index: UInt, paramKind: swift.GenericTypeParamKind)`
* `class ValueDecl`:
- `var baseIdentifier: swift.Identifier`
* `class NominalTypeDecl`:
- `var declaredInterfaceType: Type`
* `class EnumElementDecl`:
- `var parameterList: BridgedParameterList`
- `var nameStr: StringRef`
* `struct GenericSignature`:
- `var canonicalSignature: CanGenericSignature`
* `struct CanGenericSignature`:
- `var isEmpty: Bool`
- `var genericSignature: GenericSignature`
* `struct Type`:
- `func mapTypeOutOfContext() -> Type`
- `func getReducedType(sig: GenericSignature) -> CanonicalType`
- `func GenericTypeParam_getName() -> swift.Identifier`
- `func GenericTypeParam_getDepth() -> UInt`
- `func GenericTypeParam_getIndex() -> UInt`
- `func GenericTypeParam_getParamKind() -> swift.GenericTypeParamKind`
* `struct CanonicalType`:
- `func SILFunctionType_getSubstGenericSignature() -> CanGenericSignature`
- `func loweredType(in function: SIL.Function) -> SIL.Type`
**SIL:**
* `class Argument`:
- `func replaceAllUsesWith(newArg: Argument)`
* `class BasicBlock`:
- `func insertPhiArgument(atPosition: Int, type: Type, ownership: Ownership, _ context: some MutatingContext) -> Argument`
* `struct Builder`:
- `func createTuple(elements: [Value]) -> TupleInst`
* `protocol Context`:
- `func getTupleType(elements: [AST.Type]) -> AST.Type`
- `func getTupleTypeWithLabels(elements: [AST.Type], labels: [swift.Identifier]) -> AST.Type`
* `class Function`:
- `var sourceFile: BridgedNullableSourceFile`
- `func mapTypeIntoContext(_ type: Type) -> Type`
* `class PartialApplyInst`:
- `var substitutionMap: SubstitutionMap`
* `class SwitchEnumInst`:
- `var numCases: Int`
- `public func getSuccessorForDefault() -> BasicBlock?`
* `Type`:
- `var category: ValueCategory`
- `func getEnumCasePayload(caseIdx: Int, function: Function) -> Type`
- `func mapTypeOutOfContext() -> Type`
- `static func getPrimitiveType(canType: CanonicalType, silValueCategory: ValueCategory) -> Type`
* `struct EnumCase`:
- `let enumElementDecl: EnumElementDecl`
* `struct TupleElementArray`:
- `func label(at index: Int) -> swift.Identifier`
* Define `enum ValueCategory` with `address` and `object` elements
|
2025-10-06 17:56:38 +03:00 |
|
Anthony Latsis
|
6eb5d7d857
|
Bridging: Bridge swift::SourceLoc directly
|
2025-07-15 21:33:06 +01:00 |
|
Anthony Latsis
|
0e0fbc4160
|
Bridging: Bridge swift::Identifier directly
|
2025-07-10 17:58:13 +01:00 |
|
Anthony Latsis
|
de46b95e7e
|
ASTBridging: Bridge swift::GenericTypeParamKind directly
|
2025-06-20 16:46:03 +01:00 |
|
Anthony Latsis
|
dcbf2781c5
|
ASTBridging: Bridge swift::RequirementReprKind directly
|
2025-06-20 16:46:03 +01:00 |
|
Anthony Latsis
|
69a27e1735
|
ASTBridging: Bridge swift::LayoutConstraintKind directly
|
2025-06-20 16:46:03 +01:00 |
|
Anthony Latsis
|
b347aedeb0
|
ASTBridging: Encapsulate some operations on BridgedLayoutConstraint
NB: Switching from factory methods to initializers as well crashes on
Windows.
|
2025-06-20 16:44:49 +01:00 |
|
Rintaro Ishizaki
|
a506bae136
|
[ASTGen] Generate 'IsExpansionPattern' generic requirements
E.g. `where repeat each T: Comparable`
|
2025-03-07 10:28:47 -08:00 |
|
Rintaro Ishizaki
|
2b14a233b7
|
[ASTGen] Generate generic layout constraint
|
2025-02-19 16:38:00 -08:00 |
|
Rintaro Ishizaki
|
b5859240ab
|
[ASTGen] Split ASTBridging.cpp into multiple files
ASTBridging.cpp was getting too big.
|
2024-10-04 10:48:56 -07:00 |
|