Skip to content

Commit 8b9ebcc

Browse files
authored
Merge pull request #83856 from gottesmm/pr-3a5aea3430d587158233a9d47b24c1b46ddd709e
[frontend] Expose via a LangOption whether or not the compiler is compiling for a triple that supports AArch64 TBI.
2 parents 0b75992 + bfecaa3 commit 8b9ebcc

File tree

5 files changed

+19
-0
lines changed

5 files changed

+19
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,9 @@ namespace swift {
671671
bool RestrictNonProductionExperimentalFeatures = false;
672672
#endif
673673

674+
/// Set to true if we support AArch64TBI.
675+
bool HasAArch64TBI = false;
676+
674677
bool isConcurrencyModelTaskToThread() const {
675678
return ActiveConcurrencyModel == ConcurrencyModel::TaskToThread;
676679
}

include/swift/Frontend/Frontend.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ class CompilerInvocation {
274274
/// C++ stdlib is the default for the specified target.
275275
void computeCXXStdlibOptions();
276276

277+
/// Compute whether or not we support aarch64TBI
278+
void computeAArch64TBIOptions();
279+
277280
/// Computes the runtime resource path relative to the given Swift
278281
/// executable.
279282
static void computeRuntimeResourcePathFromExecutablePath(

lib/DriverTool/sil_opt_main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ int sil_opt_main(ArrayRef<const char *> argv, void *MainAddr) {
814814
Invocation.getLangOptions().UnavailableDeclOptimizationMode =
815815
options.UnavailableDeclOptimization;
816816

817+
Invocation.computeAArch64TBIOptions();
818+
817819
// Enable strict concurrency if we have the feature specified or if it was
818820
// specified via a command line option to sil-opt.
819821
if (Invocation.getLangOptions().hasFeature(Feature::StrictConcurrency)) {

lib/Frontend/CompilerInvocation.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,13 @@ setBridgingHeaderFromFrontendOptions(ClangImporterOptions &ImporterOpts,
371371
FrontendOpts.InputsAndOutputs.getFilenameOfFirstInput();
372372
}
373373

374+
void CompilerInvocation::computeAArch64TBIOptions() {
375+
auto &LLVMArgs = getFrontendOptions().LLVMArgs;
376+
auto aarch64_use_tbi =
377+
std::find(LLVMArgs.begin(), LLVMArgs.end(), "-aarch64-use-tbi");
378+
LangOpts.HasAArch64TBI = aarch64_use_tbi != LLVMArgs.end();
379+
}
380+
374381
void CompilerInvocation::computeCXXStdlibOptions() {
375382
// The MSVC driver in Clang is not aware of the C++ stdlib, and currently
376383
// always assumes libstdc++, which is incorrect: the Microsoft stdlib is
@@ -4099,6 +4106,8 @@ bool CompilerInvocation::parseArgs(
40994106
setIRGenOutputOptsFromFrontendOptions(IRGenOpts, FrontendOpts);
41004107
setBridgingHeaderFromFrontendOptions(ClangImporterOpts, FrontendOpts);
41014108
computeCXXStdlibOptions();
4109+
computeAArch64TBIOptions();
4110+
41024111
if (LangOpts.hasFeature(Feature::Embedded)) {
41034112
IRGenOpts.InternalizeAtLink = true;
41044113
IRGenOpts.DisableLegacyTypeInfo = true;

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4614,6 +4614,8 @@ int main(int argc, char *argv[]) {
46144614
InitInvok.computeCXXStdlibOptions();
46154615
}
46164616

4617+
InitInvok.computeAArch64TBIOptions();
4618+
46174619
if (!options::InProcessPluginServerPath.empty()) {
46184620
InitInvok.getSearchPathOptions().InProcessPluginServerPath =
46194621
options::InProcessPluginServerPath;

0 commit comments

Comments
 (0)