Skip to content

Commit c96646e

Browse files
committed
Merge remote-tracking branch 'origin/main' into next
2 parents 1991422 + 2237d86 commit c96646e

File tree

8 files changed

+17
-106
lines changed

8 files changed

+17
-106
lines changed

CMakeLists.txt

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -874,12 +874,7 @@ include(CMakePushCheckState)
874874

875875
# Print out path and version of any installed commands
876876
message(STATUS "CMake (${CMAKE_COMMAND}) Version: ${CMAKE_VERSION}")
877-
if(XCODE)
878-
set(version_flag -version)
879-
else()
880-
set(version_flag --version)
881-
endif()
882-
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} ${version_flag}
877+
execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --version
883878
OUTPUT_VARIABLE _CMAKE_MAKE_PROGRAM_VERSION
884879
OUTPUT_STRIP_TRAILING_WHITESPACE)
885880
message(STATUS "CMake Make Program (${CMAKE_MAKE_PROGRAM}) Version: ${_CMAKE_MAKE_PROGRAM_VERSION}")
@@ -1147,14 +1142,6 @@ endif()
11471142
# Configure SDKs.
11481143
#
11491144

1150-
if(XCODE)
1151-
# FIXME: It used to be the case that Xcode would force
1152-
# -m${platform}-version-min flags that would conflict with those computed
1153-
# by build-script. version-min flags are deprecated in favor of -target since
1154-
# clang-11, so we might be able to undo this.
1155-
set(SWIFT_SDKS "OSX")
1156-
endif()
1157-
11581145
# FIXME: the parameters we specify in SWIFT_SDKS are lacking architecture specifics,
11591146
# so we need to hard-code it. For example, the SDK for Android is just 'ANDROID',
11601147
# and we have to specify SWIFT_SDK_ANDROID_ARCHITECTURES separately.
@@ -1597,22 +1584,6 @@ swift_install_in_component(FILES "LICENSE.txt"
15971584
DESTINATION "share/swift"
15981585
COMPONENT license)
15991586

1600-
# Add a documentation target so that documentation shows up in the
1601-
# Xcode project.
1602-
if(XCODE)
1603-
add_custom_target(Documentation
1604-
SOURCES
1605-
README.md
1606-
docs)
1607-
1608-
file(GLOB SWIFT_TOPLEVEL_HEADERS
1609-
${CMAKE_CURRENT_SOURCE_DIR}/include/swift${dir}/*.h
1610-
${CMAKE_CURRENT_SOURCE_DIR}/include/swift${dir}/*.td
1611-
${CMAKE_CURRENT_SOURCE_DIR}/include/swift${dir}/*.def)
1612-
add_custom_target(Miscellaneous
1613-
SOURCES ${SWIFT_TOPLEVEL_HEADERS})
1614-
endif()
1615-
16161587
# New standard library build
16171588
option(SWIFT_ENABLE_NEW_RUNTIME_BUILD "Build Swift runtimes with new build system" OFF)
16181589
if(SWIFT_ENABLE_NEW_RUNTIME_BUILD)

SwiftCompilerSources/CMakeLists.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,6 @@ function(add_swift_compiler_modules_library name)
279279
endforeach()
280280

281281
# Create a static library containing all module object files.
282-
if (XCODE)
283-
# Xcode does not compile libraries that contain only object files.
284-
# Therefore, it fails to create the static library. As a workaround,
285-
# we add an empty source file force_lib.c to the target.
286-
set(all_obj_files force_lib.c ${all_obj_files})
287-
endif()
288282
add_library(${name} STATIC ${all_obj_files})
289283
add_dependencies(${name} ${all_module_targets})
290284
set_target_properties(${name} PROPERTIES LINKER_LANGUAGE CXX)

SwiftCompilerSources/Sources/Optimizer/ModulePasses/MandatoryPerformanceOptimizations.swift

Lines changed: 7 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@ private func optimizeFunctionsTopDown(using worklist: inout FunctionWorklist,
5252
_ moduleContext: ModulePassContext) {
5353
while let f = worklist.pop() {
5454
moduleContext.transform(function: f) { context in
55-
if !context.loadFunction(function: f, loadCalleesRecursively: true) {
56-
return
55+
if context.loadFunction(function: f, loadCalleesRecursively: true) {
56+
optimize(function: f, context, moduleContext, &worklist)
5757
}
58-
optimize(function: f, context, moduleContext, &worklist)
5958
}
6059

6160
// Generic specialization takes care of removing metatype arguments of generic functions.
@@ -316,8 +315,7 @@ private func shouldInline(apply: FullApplySite, callee: Function, alreadyInlined
316315

317316
private extension FullApplySite {
318317
func resultIsUsedInGlobalInitialization() -> SmallProjectionPath? {
319-
guard parentFunction.isGlobalInitOnceFunction,
320-
let global = parentFunction.getInitializedGlobal() else {
318+
guard let global = parentFunction.initializedGlobal else {
321319
return nil
322320
}
323321

@@ -441,25 +439,6 @@ private extension Value {
441439
}
442440
}
443441

444-
private extension Function {
445-
/// Analyzes the global initializer function and returns global it initializes (from `alloc_global` instruction).
446-
func getInitializedGlobal() -> GlobalVariable? {
447-
if !isDefinition {
448-
return nil
449-
}
450-
for inst in self.entryBlock.instructions {
451-
switch inst {
452-
case let agi as AllocGlobalInst:
453-
return agi.global
454-
default:
455-
break
456-
}
457-
}
458-
459-
return nil
460-
}
461-
}
462-
463442
fileprivate struct FunctionWorklist {
464443
private(set) var functions = Array<Function>()
465444
private var pushedFunctions = Set<Function>()
@@ -481,20 +460,10 @@ fileprivate struct FunctionWorklist {
481460
pushIfNotVisited(f)
482461
}
483462

484-
// Annotated global init-once functions
485-
if f.isGlobalInitOnceFunction {
486-
if let global = f.getInitializedGlobal(),
487-
global.mustBeInitializedStatically {
488-
pushIfNotVisited(f)
489-
}
490-
}
491-
492-
// @const global init-once functions
493-
if f.isGlobalInitOnceFunction {
494-
if let global = f.getInitializedGlobal(),
495-
global.mustBeInitializedStatically {
496-
pushIfNotVisited(f)
497-
}
463+
// Initializers of globals which must be initialized statically.
464+
if let global = f.initializedGlobal,
465+
global.mustBeInitializedStatically {
466+
pushIfNotVisited(f)
498467
}
499468
}
500469
}

SwiftCompilerSources/Sources/Optimizer/Utilities/OptUtils.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,11 +763,14 @@ private struct EscapesToValueVisitor : EscapeVisitor {
763763
}
764764

765765
extension Function {
766+
/// Analyzes the global initializer function and returns global it initializes (from `alloc_global` instruction).
766767
var initializedGlobal: GlobalVariable? {
767-
if !isGlobalInitOnceFunction {
768+
guard isGlobalInitOnceFunction,
769+
let firstBlock = blocks.first
770+
else {
768771
return nil
769772
}
770-
for inst in entryBlock.instructions {
773+
for inst in firstBlock.instructions {
771774
if let allocGlobal = inst as? AllocGlobalInst {
772775
return allocGlobal.global
773776
}

SwiftCompilerSources/Sources/SIL/GlobalVariable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ final public class GlobalVariable : CustomStringConvertible, HasShortDescription
6969
return bridged.canBeInitializedStatically()
7070
}
7171

72+
/// True if the global has an attribute, like `@const` or `@section` which requires the global to be
73+
/// initialized statically.
7274
public var mustBeInitializedStatically: Bool {
7375
return bridged.mustBeInitializedStatically()
7476
}

lib/RemoteAST/CMakeLists.txt

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
if(XCODE)
2-
file(GLOB_RECURSE REMOTE_LIB_HEADERS
3-
${SWIFT_SOURCE_DIR}/include/swift/Remote/*.h
4-
${SWIFT_SOURCE_DIR}/include/swift/Remote/*.def)
5-
6-
set_source_files_properties(${REMOTE_LIB_HEADERS}
7-
PROPERTIES
8-
HEADER_FILE_ONLY true)
9-
source_group("libRemote Headers" FILES ${REMOTE_LIB_HEADERS})
10-
else()
11-
set(REMOTE_LIB_HEADERS)
12-
endif()
13-
141
add_swift_host_library(swiftRemoteAST STATIC
152
RemoteAST.cpp
16-
InProcessMemoryReader.cpp
17-
${REMOTE_LIB_HEADERS})
3+
InProcessMemoryReader.cpp)
184
target_link_libraries(swiftRemoteAST PUBLIC
195
swiftDemangling)
206
target_link_libraries(swiftRemoteAST PRIVATE

test/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ function(swift_configure_lit_site_cfg source_path destination_path installed_nam
1212
string(REPLACE ${CMAKE_CFG_INTDIR} ${SWIFT_BUILD_MODE} LLVM_TOOLS_DIR ${LLVM_TOOLS_BINARY_DIR})
1313
string(REPLACE ${CMAKE_CFG_INTDIR} ${SWIFT_BUILD_MODE} LLVM_LIBS_DIR ${LLVM_LIBRARY_DIR})
1414

15-
if (XCODE)
16-
string(REPLACE ${CMAKE_CFG_INTDIR} Debug LIT_SWIFTLIB_DIR ${SWIFTLIB_DIR})
17-
else ()
18-
set(LIT_SWIFTLIB_DIR ${SWIFTLIB_DIR})
19-
endif ()
15+
set(LIT_SWIFTLIB_DIR ${SWIFTLIB_DIR})
2016

2117
configure_file("${source_path}" "${destination_path}" @ONLY)
2218

tools/SourceKit/CMakeLists.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,6 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
7979
else()
8080
message(FATAL_ERROR "Can't understand SOURCEKIT_DEPLOYMENT_OS '${SOURCEKIT_DEPLOYMENT_OS}';")
8181
endif()
82-
83-
# Add deployment target to C/C++ compiler and linker flags.
84-
# FIXME: CMAKE_OSX_DEPLOYMENT_TARGET falls over when used for iOS versions.
85-
if (XCODE)
86-
if (SOURCEKIT_DEPLOYMENT_OS MATCHES "^macosx")
87-
set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
88-
else()
89-
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET ${SOURCEKIT_DEPLOYMENT_TARGET})
90-
endif()
91-
endif()
9282
endif()
9383

9484
include_directories(BEFORE

0 commit comments

Comments
 (0)