Skip to content

[pull] swiftwasm from main #5486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 121 commits into from
Jun 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
371e3c9
[CAS] Teach swift-frontend to replay result from cache
cachemeifyoucan Apr 20, 2023
f2b02c1
[Serialization] Improve a diagnostic text
xymus May 18, 2023
e0014b4
[Serialization|NFC] Move free floating functions to methods
xymus May 8, 2023
a475f4c
[Serialization|NFC] Intro diagnoseAndConsumeError
xymus May 18, 2023
5c0ae94
Optimizer: add simplification for the `value_to_bridge_object` instru…
eeckstein May 24, 2023
d02765f
Swift SIL: some new APIs and some refactoring
eeckstein May 24, 2023
3747a28
Optimizer: add simplification for init_enum_data_addr
eeckstein May 24, 2023
24837b4
IRGen: change a few enum utility functions to be able to create enums…
eeckstein May 23, 2023
f2a8fb5
IRGen: add `EnumPayload.dump()` for debugging
eeckstein May 24, 2023
fe367e8
Optimizer/IRGen: allow enums in static initializers of globals
eeckstein May 24, 2023
b2bc2c7
AST: Introduce PackElementType
slavapestov May 22, 2023
0493710
AST: Split off TypeSubstitution.cpp from Type.cpp
slavapestov May 23, 2023
9d5b6d8
Sema: Remove unused local variable
slavapestov May 18, 2023
65b5f82
[Serialization|NFC] Extract some diagnostic logic into diagnoseModula…
xymus May 25, 2023
4f66fcf
[Serialization] Intro -Rmodule-recovery to remark about silent errors
xymus May 8, 2023
4184714
[Module printing] Don't print attached macros in generated interfaces
DougGregor May 25, 2023
64b353c
Revert "[Driver] Derive '-external-plugin-path'"
rintaro May 25, 2023
548ff3a
[Test] Ensure that a class using the Observable macro builds a proper…
DougGregor May 25, 2023
78b4391
[Dependency Scannning] Handle special case import of Clang Private "s…
artemcm May 25, 2023
508bf8a
[move-only] Teach SILGenApply how to emit subscripts with borrowed ba…
gottesmm May 21, 2023
5d9ab63
[move-only] When we emit a noncopyable temporary allocation, always a…
gottesmm May 23, 2023
7b27997
Fix a crash during an operator type check with package acl
elsh May 25, 2023
dc974e8
Fix SILCombine to preserve a release of a move-only type
atrick May 25, 2023
7d0510a
Merge pull request #66131 from DougGregor/interfaces-without-macros
DougGregor May 26, 2023
af1df92
IRGen: Avoid emitting resilient tag indices for unavailable enum cases.
tshortli May 25, 2023
1a84fc7
Merge pull request #66118 from eeckstein/global-enums
eeckstein May 26, 2023
2ea162b
[Test] Use production available features in option-filtering.swift (#…
drexin May 26, 2023
7502f3c
[Macros] Fix existential diagnostics for declaration macro expansions
rxwei May 25, 2023
bac171c
relax ordering checks a bit, the deinits may not actually run in
ktoso May 26, 2023
44e1995
Merge pull request #66166 from ktoso/wip-discarding-error-task-leak
swift-ci May 26, 2023
9b3faad
Merge pull request #66126 from slavapestov/pack-element-refactoring
slavapestov May 26, 2023
2d41efe
[Build] Don't configure LLDB with tests enabled if the tests will be …
Michael137 May 26, 2023
658f0ea
[Runtime] Refactor layout string runtime functions to simplify future…
drexin May 26, 2023
8f0382c
[test] Replace swift_obj_root for alternates that work in LLVM unifie…
drodriguez May 26, 2023
fe8fd91
[AST] NFC: Fold `PackConformance::isInvalid` into `ProtocolConformanc…
xedin May 25, 2023
3897e9a
Merge pull request #66161 from atrick/fix-silcombine
atrick May 26, 2023
495f9b2
Merge pull request #66145 from rintaro/revert-driver-external-plugin-…
rintaro May 26, 2023
47d3b18
Merge pull request #66132 from rxwei/109779928
rxwei May 26, 2023
ff696c4
Merge pull request #66155 from apple/es-crash
elsh May 26, 2023
c9edaee
[move-only] Make sure that we handle load [take] that are actually bo…
gottesmm May 25, 2023
71157f6
tests: fix a test file for arm64e
eeckstein May 26, 2023
7b66c70
[move-only] Restrict 508bf8ae2141f379d24dd0ae2902e5672fc52e9f so it o…
gottesmm May 26, 2023
e0438d2
Disable taskgroup test on freestanding; they're not supported
ktoso May 26, 2023
2d5f33e
Add @_used and @_section attributes for global variables and top-leve…
kubamracek May 26, 2023
950ff0f
Merge pull request #66153 from xedin/rework-pack-conf-isinvalid
xedin May 26, 2023
642980c
[Serialization] Add flag to force unsafe recovery from some xref fail…
xymus May 9, 2023
b3f1d40
Remove not-necessary import Darwin
ktoso May 26, 2023
bc5e8ba
Merge pull request #66148 from artemcm/PrivateClangSubmoduleScan
artemcm May 26, 2023
d50f20e
[Serialization] Make a warning the diagnostic about attempting recovery
xymus May 26, 2023
2b785e4
[move-only] Teach SILGen how to recognize a borrowed read subscript w…
gottesmm May 26, 2023
61dd300
Improve diagnostics when package acl is used but no package-name is p…
elsh May 26, 2023
261f32c
Merge pull request #66139 from xymus/r-module-recovery
xymus May 26, 2023
854e7dc
s/passed/specified
elsh May 27, 2023
381f292
Merge pull request #66180 from eeckstein/fix-testfile
swift-ci May 27, 2023
e4adb8d
Merge pull request #66181 from ktoso/fix-compilation-minimal
swift-ci May 27, 2023
ce452f7
Merge pull request #66157 from tshortli/unavailable-resilient-enum-tag
tshortli May 27, 2023
dfed93d
Merge pull request #66171 from apple/bugfix/lldb-buildbots-skip-lldb-…
Michael137 May 27, 2023
79a2ff5
Merge pull request #66189 from apple/es-diag
elsh May 27, 2023
8579c19
[move-only] Make sure that we serialize deinits and if we are not abl…
gottesmm May 24, 2023
1d04df9
[move-only] Teach deinit devirtualization how to handle devirtualizin…
gottesmm May 26, 2023
a52302d
Some misc fixes for tests.
gottesmm May 28, 2023
f676b75
[Swift-ObjC-Interop] Speculative cyclic lookup fix
NuriAmari May 28, 2023
c3fbe24
Merge pull request #66185 from gottesmm/rdar-109904633-109679168
gottesmm May 28, 2023
577e76b
[move-only] Change closure capture diagnostic for let patterns to say…
gottesmm May 26, 2023
7386a7e
[Macros] Rework the way we assign closure and local discriminators
DougGregor May 28, 2023
c9383ff
[CMake] Add paths for building Swift code against host toolchain
DougGregor May 29, 2023
9984247
Merge pull request #66197 from gottesmm/pr-be9250eb18cad6c40a8f7beb82…
gottesmm May 29, 2023
1dfd8d6
Merge pull request #66094 from gottesmm/pr-9cc91f1b6b3ff60686adb825c4…
gottesmm May 29, 2023
c0ce58c
[move-only] Make sure to run the moveonly interpreter test also at -O…
gottesmm May 29, 2023
a41c369
[CMake] Fix host library builds and rpaths for testing macros
DougGregor May 29, 2023
5cdd34a
Merge pull request #66198 from DougGregor/closure-local-discriminator…
DougGregor May 29, 2023
3ca1358
[SourceKit] Fix paths when including the new Swift compiler
DougGregor May 29, 2023
638c2cd
[Walker] Don't visit VarDecls encountered in freestanding macro expan…
DougGregor May 29, 2023
f20edfa
Merge pull request #66202 from DougGregor/visit-var-decls-in-freestan…
DougGregor May 29, 2023
b806b86
Merge pull request #66199 from DougGregor/cmake-host-swift-paths-linux
DougGregor May 29, 2023
1cf20fb
Merge pull request #66200 from gottesmm/pr-413ea9fd17cc63014b8f20897f…
gottesmm May 29, 2023
0b7d8ab
[AutoDiff] Remove 'readnone' attribute from autoDiffCreateLinearMapCo…
asl May 30, 2023
8140efb
[SwiftSyntax] Remove `requiresLeadingNewline` from basic format
kimdv May 24, 2023
e03bd0a
[test] Fully disable moveonly_interface.swift
hamishknight May 29, 2023
74bd36e
Merge pull request #66204 from hamishknight/disable-moveonly-interface
hamishknight May 30, 2023
bf868b0
[Runtime] Add ptrauth to standard concurrency descriptors.
mikeash May 30, 2023
60ef958
don't break a doc comment with a regular comment (#66136)
QuietMisdreavus May 30, 2023
93864f6
[Variadic Generics] drop requirement of .element for tuple expansion …
sophiapoirier May 30, 2023
814ca43
Merge pull request #66186 from xymus/force-workaround
xymus May 30, 2023
da15bf6
Merge pull request #66210 from mikeash/ptrauth-standard-concurrency-d…
swift-ci May 30, 2023
0ceab44
[DiscardingTG] Fix runtime signature mismatch for statically known ->…
kateinoigakukun May 30, 2023
895b4df
ARCSequenceOpts: fix a wrong handling of applies with indirect out ar…
eeckstein May 30, 2023
d0b412e
Merge pull request #66106 from kimdv/kimdv/remove-newline-from-swift-…
kimdv May 30, 2023
daaee27
Merge pull request #65924 from cachemeifyoucan/eng/PR-swift-cache-replay
cachemeifyoucan May 30, 2023
0594efc
Merge pull request #66214 from sophiapoirier/tuple-expansion-without-…
sophiapoirier May 30, 2023
0e7ad1e
Frontend: Don't append `-target-min-inlining-target target` to implic…
tshortli May 16, 2023
c464207
Fix IRGen/section.swift test to work on 32-bit platforms too (#66215)
kubamracek May 30, 2023
bbfd410
swift_build_support/cmake.py: parallelize default CMake build (#66212)
MaxDesiatov May 30, 2023
f467295
[IRGen] Fix refcount bytes computation for single payload enums (#66216)
drexin May 30, 2023
78b2229
[Macros] Factor out SourceFile creation for macro expanded buffer
rintaro May 30, 2023
ea4646f
Merge pull request #66177 from NuriAmari/cyclic-lookup-fix
NuriAmari May 30, 2023
fef908e
[Sema] Increase impact of ternary then branch aiming better diagnostics
LucianoPAlmeida May 30, 2023
eeede46
[Test] Note that test requires observation to be built
DougGregor May 31, 2023
bde0426
Merge pull request #66229 from DougGregor/test-requires-observation
shahmishal May 31, 2023
17d121f
Merge pull request #65954 from tshortli/swiftinterface-inlinable-func…
tshortli May 31, 2023
5db2b28
[Runtime] Handle single payload enums in swift_resolve_resilientAcces…
drexin May 31, 2023
1d90de1
Merge pull request #66208 from LucianoPAlmeida/diag-ternary
LucianoPAlmeida May 31, 2023
36b1fee
Merge pull request #66221 from eeckstein/fix-arc-sequence-opts
eeckstein May 31, 2023
a933aac
[test] Disable async_taskgroup_discarding_dontLeak.swift
hamishknight May 31, 2023
3c585d5
Merge pull request #66234 from hamishknight/disable-test
hamishknight May 31, 2023
d9d0397
Merge pull request #66219 from swiftwasm/pr-0a78621ff9f12f4599ec769c2…
kateinoigakukun May 31, 2023
9541dc1
[test] Disable async_taskgroup_discarding.swift
hamishknight May 31, 2023
8b82cc6
Merge pull request #66237 from hamishknight/disable-test
hamishknight May 31, 2023
92fab06
IRGen: fix generation of static enums with function payloads
eeckstein May 31, 2023
3ac9fc6
InitializeStaticGlobals: remove dead instructions in global initializer
eeckstein May 31, 2023
22bb683
tests: Disable some tests in assemblyvision_remark/cast_remarks_objc.…
eeckstein May 31, 2023
e3452e0
[test] Disable async_task_priority.swift for arm64e
hamishknight May 31, 2023
4640f07
Merge pull request #66242 from hamishknight/disable-test
hamishknight May 31, 2023
f4937ef
[NFC] fix option description typo in `StdlibOptions.cmake`
MaxDesiatov May 31, 2023
be89b4a
Merge pull request #66245 from apple/maxd/fix-cmake-option-typo
swift-ci May 31, 2023
94f8109
Merge pull request #66233 from rintaro/macros-creatsourcefile
rintaro May 31, 2023
bea8da2
Merge pull request #66239 from eeckstein/disable-assembly-vision-tests
hamishknight May 31, 2023
65bb599
Merge pull request #66238 from eeckstein/fix-static-enums
hamishknight May 31, 2023
21d57e8
[lit] Repair tests for stdlib-only build
kateinoigakukun May 31, 2023
1769c88
[NFC] SwiftCompilerSources/CMakeLists.txt: fix comment typo (#66235)
MaxDesiatov May 31, 2023
4eb06c2
Merge pull request #66253 from swiftwasm/pr-1dafbe0303e3b956fa169232e…
swift-ci May 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SwiftCompilerSources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ else()
add_subdirectory(Sources)

# TODO: generate this dynamically through the modulemap; this cannot use `sed`
# as that is not available on all paltforms (e.g. Windows).
# as that is not available on all platforms (e.g. Windows).
#
# step 1: generate a dummy source file, which just includes all headers
# defined in include/swift/module.modulemap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ let initializeStaticGlobalsPass = FunctionPass(name: "initialize-static-globals"

context.erase(instruction: allocInst)
context.erase(instruction: storeToGlobal)
context.removeTriviallyDeadInstructionsIgnoringDebugUses(in: function)
}

/// Analyses the global initializer function and returns the `alloc_global` and `store`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ swift_compiler_sources(Optimizer
SimplifyDebugStep.swift
SimplifyDestructure.swift
SimplifyGlobalValue.swift
SimplifyInitEnumDataAddr.swift
SimplifyLoad.swift
SimplifyPartialApply.swift
SimplifyStrongRetainRelease.swift
SimplifyStructExtract.swift
SimplifyTupleExtract.swift
SimplifyUncheckedEnumData.swift)
SimplifyUncheckedEnumData.swift
SimplifyValueToBridgeObject.swift)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//===--- SimplifyInitEnumDataAddr.swift -----------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

import SIL

extension InitEnumDataAddrInst : OnoneSimplifyable {
func simplify(_ context: SimplifyContext) {

// Optimize the sequence
// ```
// %1 = init_enum_data_addr %enum_addr, #someCaseWithPayload
// store %payload to %1
// inject_enum_addr %enum_addr, #someCaseWithPayload
// ```
// to
// ```
// %1 = enum $E, #someCaseWithPayload, %payload
// store %1 to %enum_addr
// ```
// This sequence of three instructions must appear in consecutive order.
// But usually this is the case, because it's generated this way by SILGen.
//
if let nextInst = self.next,
let store = nextInst as? StoreInst,
store.destination == self,
let singleUse = self.uses.singleUse,
singleUse.instruction == store,
let nextAfterStore = store.next,
let inject = nextAfterStore as? InjectEnumAddrInst,
inject.enum == self.enum,
inject.enum.type.isLoadable(in: parentFunction) {

assert(self.caseIndex == inject.caseIndex, "mismatching case indices when creating an enum")

let builder = Builder(before: store, context)
let enumInst = builder.createEnum(caseIndex: self.caseIndex, payload: store.source, enumType: self.enum.type.objectType)
let storeOwnership = StoreInst.Ownership(for: self.enum.type, in: parentFunction, initialize: true)
builder.createStore(source: enumInst, destination: self.enum, ownership: storeOwnership)
context.erase(instruction: store)
context.erase(instruction: inject)
context.erase(instruction: self)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//===--- SimplifyValueToBridgeObject.swift --------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2023 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

import SIL

extension ValueToBridgeObjectInst : OnoneSimplifyable {
func simplify(_ context: SimplifyContext) {

// Optimize the sequence
// ```
// %1 = value_to_bridge_object %0
// %2 = struct $SomeInt (%1)
// %3 = unchecked_trivial_bit_cast %2
// %4 = struct_extract %3, #valueFieldInInt
// %5 = value_to_bridge_object %4
// ```
// to
// ```
// %5 = value_to_bridge_object %0
// ```
// This sequence comes up in the code for constructing an empty string literal.
//
if let se = self.value as? StructExtractInst,
let utbc = se.struct as? UncheckedTrivialBitCastInst,
let vtbo = utbc.fromValue as? ValueToBridgeObjectInst {
self.operand.set(to: vtbo.value, context)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ struct FunctionPassContext : MutatingContext {
var notifyInstructionChanged: (Instruction) -> () { return { inst in } }

func continueWithNextSubpassRun(for inst: Instruction? = nil) -> Bool {
let bridgedInst = OptionalBridgedInstruction(inst?.bridged.obj)
return _bridged.continueWithNextSubpassRun(bridgedInst)
return _bridged.continueWithNextSubpassRun(inst.bridged)
}

func createSimplifyContext(preserveDebugInfo: Bool, notifyInstructionChanged: @escaping (Instruction) -> ()) -> SimplifyContext {
Expand Down
15 changes: 12 additions & 3 deletions SwiftCompilerSources/Sources/SIL/Builder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public struct Builder {
return notifyNew(cast.getAs(UpcastInst.self))
}

public func createLoad(fromAddress: Value, ownership: LoadInst.LoadOwnership) -> LoadInst {
public func createLoad(fromAddress: Value, ownership: LoadInst.Ownership) -> LoadInst {
let load = bridged.createLoad(fromAddress.bridged, ownership.rawValue)
return notifyNew(load.getAs(LoadInst.self))
}
Expand Down Expand Up @@ -184,6 +184,12 @@ public struct Builder {
let ued = bridged.createUncheckedEnumData(enumVal.bridged, caseIndex, resultType.bridged)
return notifyNew(ued.getAs(UncheckedEnumDataInst.self))
}

public func createEnum(caseIndex: Int, payload: Value?, enumType: Type) -> EnumInst {
let enumInst = bridged.createEnum(caseIndex, payload.bridged, enumType.bridged)
return notifyNew(enumInst.getAs(EnumInst.self))
}

@discardableResult
public func createSwitchEnum(enum enumVal: Value,
cases: [(Int, BasicBlock)],
Expand Down Expand Up @@ -225,20 +231,23 @@ public struct Builder {
return notifyNew(bridged.createGlobalValue(global.bridged).getAs(GlobalValueInst.self))
}

@discardableResult
public func createStruct(type: Type, elements: [Value]) -> StructInst {
let structInst = elements.withBridgedValues { valuesRef in
return bridged.createStruct(type.bridged, valuesRef)
}
return notifyNew(structInst.getAs(StructInst.self))
}

@discardableResult
public func createTuple(type: Type, elements: [Value]) -> TupleInst {
let tuple = elements.withBridgedValues { valuesRef in
return bridged.createTuple(type.bridged, valuesRef)
}
return notifyNew(tuple.getAs(TupleInst.self))
}

@discardableResult
public func createStore(source: Value, destination: Value, ownership: StoreInst.Ownership) -> StoreInst {
let store = bridged.createStore(source.bridged, destination.bridged, ownership.rawValue)
return notifyNew(store.getAs(StoreInst.self))
}
}
1 change: 1 addition & 0 deletions SwiftCompilerSources/Sources/SIL/GlobalVariable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ extension Instruction {
return !fri.referencedFunction.isAsync
case is StructInst,
is TupleInst,
is EnumInst,
is IntegerLiteralInst,
is FloatLiteralInst,
is ObjectInst,
Expand Down
39 changes: 32 additions & 7 deletions SwiftCompilerSources/Sources/SIL/Instruction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ extension OptionalBridgedInstruction {
}
}

extension Optional where Wrapped == Instruction {
public var bridged: OptionalBridgedInstruction {
OptionalBridgedInstruction(self?.bridged.obj)
}
}

public class SingleValueInstruction : Instruction, Value {
final public var definingInstruction: Instruction? { self }

Expand Down Expand Up @@ -222,11 +228,23 @@ extension StoringInstruction {

final public class StoreInst : Instruction, StoringInstruction {
// must match with enum class StoreOwnershipQualifier
public enum StoreOwnership: Int {
public enum Ownership: Int {
case unqualified = 0, initialize = 1, assign = 2, trivial = 3

public init(for type: Type, in function: Function, initialize: Bool) {
if function.hasOwnership {
if type.isTrivial(in: function) {
self = .trivial
} else {
self = initialize ? .initialize : .assign
}
} else {
self = .unqualified
}
}
}
public var destinationOwnership: StoreOwnership {
StoreOwnership(rawValue: bridged.StoreInst_getStoreOwnership())!
public var destinationOwnership: Ownership {
Ownership(rawValue: bridged.StoreInst_getStoreOwnership())!
}
}

Expand Down Expand Up @@ -307,6 +325,7 @@ final public class DestroyAddrInst : Instruction, UnaryInstruction {
}

final public class InjectEnumAddrInst : Instruction, UnaryInstruction, EnumInstruction {
public var `enum`: Value { operand.value }
public var caseIndex: Int { bridged.InjectEnumAddrInst_caseIndex() }
}

Expand Down Expand Up @@ -351,11 +370,11 @@ final public class LoadInst : SingleValueInstruction, UnaryInstruction {
public var address: Value { operand.value }

// must match with enum class LoadOwnershipQualifier
public enum LoadOwnership: Int {
public enum Ownership: Int {
case unqualified = 0, take = 1, copy = 2, trivial = 3
}
public var ownership: LoadOwnership {
LoadOwnership(rawValue: bridged.LoadInst_getLoadOwnership())!
public var ownership: Ownership {
Ownership(rawValue: bridged.LoadInst_getLoadOwnership())!
}
}

Expand Down Expand Up @@ -388,6 +407,10 @@ final public class UncheckedAddrCastInst : SingleValueInstruction, UnaryInstruct
public var fromAddress: Value { operand.value }
}

final public class UncheckedTrivialBitCastInst : SingleValueInstruction, UnaryInstruction {
public var fromValue: Value { operand.value }
}

final public
class RawPointerToRefInst : SingleValueInstruction, UnaryInstruction {
public var pointer: Value { operand.value }
Expand Down Expand Up @@ -626,7 +649,9 @@ final public
class ObjCMetatypeToObjectInst : SingleValueInstruction, UnaryInstruction {}

final public
class ValueToBridgeObjectInst : SingleValueInstruction, UnaryInstruction {}
class ValueToBridgeObjectInst : SingleValueInstruction, UnaryInstruction {
public var value: Value { return operand.value }
}

final public
class MarkDependenceInst : SingleValueInstruction {
Expand Down
1 change: 1 addition & 0 deletions SwiftCompilerSources/Sources/SIL/Registration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public func registerSILClasses() {
register(UpcastInst.self)
register(UncheckedRefCastInst.self)
register(UncheckedAddrCastInst.self)
register(UncheckedTrivialBitCastInst.self)
register(MarkMustCheckInst.self)
register(ObjectInst.self)
register(RawPointerToRefInst.self)
Expand Down
4 changes: 4 additions & 0 deletions SwiftCompilerSources/Sources/SIL/Type.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public struct Type : CustomStringConvertible, NoReflectionChildren {
return !bridged.isNonTrivialOrContainsRawPointer(function.bridged.getFunction())
}

public func isLoadable(in function: Function) -> Bool {
return bridged.isLoadable(function.bridged.getFunction())
}

public func isReferenceCounted(in function: Function) -> Bool {
return bridged.isReferenceCounted(function.bridged.getFunction())
}
Expand Down
6 changes: 6 additions & 0 deletions SwiftCompilerSources/Sources/SIL/Value.swift
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,9 @@ final class PlaceholderValue : Value {
extension OptionalBridgedValue {
public var value: Value? { obj.getAs(AnyObject.self) as? Value }
}

extension Optional where Wrapped == Value {
public var bridged: OptionalBridgedValue {
OptionalBridgedValue(obj: self?.bridged.obj)
}
}
12 changes: 9 additions & 3 deletions cmake/modules/AddPureSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,15 @@ function(add_pure_swift_host_tool name)
add_executable(${name} ${APSHT_SOURCES})
_add_host_swift_compile_options(${name})

set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH
"@executable_path/../lib/swift/host")
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH
"@executable_path/../lib/swift/host")
else()
set_property(TARGET ${name}
APPEND PROPERTY INSTALL_RPATH
"$ORIGIN/../lib/swift/host")
endif()

set_property(TARGET ${name}
PROPERTY BUILD_WITH_INSTALL_RPATH YES)
Expand Down
24 changes: 19 additions & 5 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
# Make sure we can find the early SwiftSyntax libraries.
target_link_directories(${target} PRIVATE "${SWIFT_PATH_TO_EARLYSWIFTSYNTAX_BUILD_DIR}/lib/swift/host")

# For the "end step" of bootstrapping configurations on Darwin, need to be
# For the "end step" of bootstrapping configurations, we need to be
# able to fall back to the SDK directory for libswiftCore et al.
if (BOOTSTRAPPING_MODE MATCHES "BOOTSTRAPPING.*")
if (NOT "${bootstrapping}" STREQUAL "1")
Expand All @@ -590,6 +590,13 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
get_filename_component(TOOLCHAIN_BIN_DIR ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
get_filename_component(TOOLCHAIN_LIB_DIR "${TOOLCHAIN_BIN_DIR}/../lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" ABSOLUTE)
target_link_directories(${target} PUBLIC ${TOOLCHAIN_LIB_DIR})
else()
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
get_filename_component(swift_dir ${swift_bin_dir} DIRECTORY)
set(host_lib_dir "${swift_dir}/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
target_link_directories(${target} PRIVATE ${host_lib_dir})

set(swift_runtime_rpath "${host_lib_dir}")
endif()
endif()
endif()
Expand Down Expand Up @@ -926,10 +933,17 @@ function(add_swift_host_tool executable)
endif()
endif()

set_property(
TARGET ${executable}
APPEND PROPERTY INSTALL_RPATH
"@executable_path/../${extra_relative_rpath}lib/swift/host")
if(${SWIFT_HOST_VARIANT_SDK} IN_LIST SWIFT_DARWIN_PLATFORMS)
set_property(
TARGET ${executable}
APPEND PROPERTY INSTALL_RPATH
"@executable_path/../${extra_relative_rpath}lib/swift/host")
else()
set_property(
TARGET ${executable}
APPEND PROPERTY INSTALL_RPATH
"$ORIGIN/../${extra_relative_rpath}lib/swift/host")
endif()
endif()

if(ASHT_THINLTO_LD64_ADD_FLTO_CODEGEN_ONLY)
Expand Down
12 changes: 12 additions & 0 deletions docs/ReferenceGuides/UnderscoredAttributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,12 @@ Fully bypasses access control, allowing access to private declarations
in the imported module. The imported module needs to be compiled with
`-Xfrontend -enable-private-imports` for this to work.

## `@_section("section_name")`

Places a global variable or a top-level function into a section of the object
file with the given name. It's the equivalent of clang's
`__attribute__((section))`.

## `@_semantics("uniquely.recognized.id")`

Allows the optimizer to make use of some key invariants in performance critical
Expand Down Expand Up @@ -994,6 +1000,12 @@ for more details.

This `async` function uses the pre-SE-0338 semantics of unsafely inheriting the caller's executor. This is an underscored feature because the right way of inheriting an executor is to pass in the required executor and switch to it. Unfortunately, there are functions in the standard library which need to inherit their caller's executor but cannot change their ABI because they were not defined as `@_alwaysEmitIntoClient` in the initial release.

## `@_used`

Marks a global variable or a top-level function as "used externally" even if it
does not have visible users in the compilation unit. It's the equivalent of
clang's `__attribute__((used))`.

## `@_weakLinked`

Allows a declaration to be weakly-referenced, i.e., any references emitted by
Expand Down
Loading