mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add option to enable global-isel on arm64 archs
LLVM will eventually switch over to using global-isel on arm64 archs. Setting this option (SWIFT_ENABLE_GLOBAL_ISEL_ARM64) can be used to experiment with that in Swift before the switch happens.
This commit is contained in:
@@ -439,6 +439,10 @@ option(SWIFT_ENABLE_DISPATCH
|
|||||||
"Enable use of libdispatch"
|
"Enable use of libdispatch"
|
||||||
TRUE)
|
TRUE)
|
||||||
|
|
||||||
|
option(SWIFT_ENABLE_GLOBAL_ISEL_ARM64
|
||||||
|
"Enable global isel on arm64, arm64e, arm64_32"
|
||||||
|
FALSE)
|
||||||
|
|
||||||
cmake_dependent_option(SWIFT_BUILD_SYNTAXPARSERLIB
|
cmake_dependent_option(SWIFT_BUILD_SYNTAXPARSERLIB
|
||||||
"Build the Swift Syntax Parser library" TRUE
|
"Build the Swift Syntax Parser library" TRUE
|
||||||
"SWIFT_ENABLE_DISPATCH" FALSE)
|
"SWIFT_ENABLE_DISPATCH" FALSE)
|
||||||
|
|||||||
@@ -343,6 +343,8 @@ public:
|
|||||||
/// Whether to disable using mangled names for accessing concrete type metadata.
|
/// Whether to disable using mangled names for accessing concrete type metadata.
|
||||||
unsigned DisableConcreteTypeMetadataMangledNameAccessors : 1;
|
unsigned DisableConcreteTypeMetadataMangledNameAccessors : 1;
|
||||||
|
|
||||||
|
unsigned EnableGlobalISel : 1;
|
||||||
|
|
||||||
/// The number of threads for multi-threaded code generation.
|
/// The number of threads for multi-threaded code generation.
|
||||||
unsigned NumThreads = 0;
|
unsigned NumThreads = 0;
|
||||||
|
|
||||||
@@ -396,7 +398,8 @@ public:
|
|||||||
UseTypeLayoutValueHandling(true),
|
UseTypeLayoutValueHandling(true),
|
||||||
GenerateProfile(false), EnableDynamicReplacementChaining(false),
|
GenerateProfile(false), EnableDynamicReplacementChaining(false),
|
||||||
DisableRoundTripDebugTypes(false), DisableDebuggerShadowCopies(false),
|
DisableRoundTripDebugTypes(false), DisableDebuggerShadowCopies(false),
|
||||||
DisableConcreteTypeMetadataMangledNameAccessors(false), CmdArgs(),
|
DisableConcreteTypeMetadataMangledNameAccessors(false),
|
||||||
|
EnableGlobalISel(false), CmdArgs(),
|
||||||
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
|
SanitizeCoverage(llvm::SanitizerCoverageOptions()),
|
||||||
TypeInfoFilter(TypeInfoDumpFilter::All) {}
|
TypeInfoFilter(TypeInfoDumpFilter::All) {}
|
||||||
|
|
||||||
|
|||||||
@@ -12,4 +12,6 @@
|
|||||||
|
|
||||||
#cmakedefine01 SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED
|
#cmakedefine01 SWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED
|
||||||
|
|
||||||
|
#cmakedefine01 SWIFT_ENABLE_GLOBAL_ISEL_ARM64
|
||||||
|
|
||||||
#endif // SWIFT_CONFIG_H
|
#endif // SWIFT_CONFIG_H
|
||||||
|
|||||||
@@ -1873,6 +1873,12 @@ static bool ParseIRGenArgs(IRGenOptions &Opts, ArgList &Args,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SWIFT_ENABLE_GLOBAL_ISEL_ARM64 &&
|
||||||
|
(Triple.getArch() == llvm::Triple::aarch64 ||
|
||||||
|
Triple.getArch() == llvm::Triple::aarch64_32)) {
|
||||||
|
Opts.EnableGlobalISel = true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,6 +175,9 @@ swift::getIRTargetOptions(const IRGenOptions &Opts, ASTContext &Ctx) {
|
|||||||
if (Clang->getTargetInfo().getTriple().isOSBinFormatWasm())
|
if (Clang->getTargetInfo().getTriple().isOSBinFormatWasm())
|
||||||
TargetOpts.ThreadModel = llvm::ThreadModel::Single;
|
TargetOpts.ThreadModel = llvm::ThreadModel::Single;
|
||||||
|
|
||||||
|
if (Opts.EnableGlobalISel)
|
||||||
|
TargetOpts.EnableGlobalISel = true;
|
||||||
|
|
||||||
clang::TargetOptions &ClangOpts = Clang->getTargetInfo().getTargetOpts();
|
clang::TargetOptions &ClangOpts = Clang->getTargetInfo().getTargetOpts();
|
||||||
return std::make_tuple(TargetOpts, ClangOpts.CPU, ClangOpts.Features, ClangOpts.Triple);
|
return std::make_tuple(TargetOpts, ClangOpts.CPU, ClangOpts.Features, ClangOpts.Triple);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,6 +138,14 @@ function(_add_target_variant_c_compile_flags)
|
|||||||
|
|
||||||
set(result ${${CFLAGS_RESULT_VAR_NAME}})
|
set(result ${${CFLAGS_RESULT_VAR_NAME}})
|
||||||
|
|
||||||
|
if ("${CFLAGS_ARCH}" STREQUAL "arm64" OR
|
||||||
|
"${CFLAGS_ARCH}" STREQUAL "arm64e" OR
|
||||||
|
"${CFLAGS_ARCH}" STREQUAL "arm64_32")
|
||||||
|
if (SWIFT_ENABLE_GLOBAL_ISEL_ARM64)
|
||||||
|
list(APPEND result "-fglobal-isel")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
_add_target_variant_c_compile_link_flags(
|
_add_target_variant_c_compile_link_flags(
|
||||||
SDK "${CFLAGS_SDK}"
|
SDK "${CFLAGS_SDK}"
|
||||||
ARCH "${CFLAGS_ARCH}"
|
ARCH "${CFLAGS_ARCH}"
|
||||||
|
|||||||
Reference in New Issue
Block a user