Merge pull request #39083 from beccadax/give-me-some-e

Add arm64 -> arm64e fallback to module loading
This commit is contained in:
Becca Royal-Gordon
2021-09-10 13:12:52 -07:00
committed by GitHub
16 changed files with 94 additions and 21 deletions

View File

@@ -46,8 +46,23 @@ namespace {
void forEachTargetModuleBasename(const ASTContext &Ctx,
llvm::function_ref<void(StringRef)> body) {
auto normalizedTarget = getTargetSpecificModuleTriple(Ctx.LangOpts.Target);
// An arm64 module can import an arm64e module.
Optional<llvm::Triple> normalizedAltTarget;
if ((normalizedTarget.getArch() == llvm::Triple::ArchType::aarch64) &&
(normalizedTarget.getSubArch() !=
llvm::Triple::SubArchType::AArch64SubArch_arm64e)) {
auto altTarget = normalizedTarget;
altTarget.setArchName("arm64e");
normalizedAltTarget = getTargetSpecificModuleTriple(altTarget);
}
body(normalizedTarget.str());
if (normalizedAltTarget) {
body(normalizedAltTarget->str());
}
// We used the un-normalized architecture as a target-specific
// module name. Fall back to that behavior.
body(Ctx.LangOpts.Target.getArchName());
@@ -61,6 +76,10 @@ void forEachTargetModuleBasename(const ASTContext &Ctx,
if (Ctx.LangOpts.Target.getArch() == llvm::Triple::ArchType::arm) {
body("arm");
}
if (normalizedAltTarget) {
body(normalizedAltTarget->getArchName());
}
}
enum class SearchPathKind {