[llvm] 7cfe32d - [Driver] Hook up Haiku ARM support (#67222)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 8 21:49:58 PDT 2023
Author: Brad Smith
Date: 2023-10-09T00:49:53-04:00
New Revision: 7cfe32d4d8da6eb6ea558a584a3a52e2e8a97a3c
URL: https://github.com/llvm/llvm-project/commit/7cfe32d4d8da6eb6ea558a584a3a52e2e8a97a3c
DIFF: https://github.com/llvm/llvm-project/commit/7cfe32d4d8da6eb6ea558a584a3a52e2e8a97a3c.diff
LOG: [Driver] Hook up Haiku ARM support (#67222)
Added:
Modified:
clang/lib/Basic/Targets.cpp
clang/lib/Basic/Targets/ARM.cpp
clang/lib/Driver/ToolChains/Arch/ARM.cpp
clang/test/Driver/arm-abi.c
clang/test/Driver/haiku.c
llvm/lib/TargetParser/ARMTargetParser.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index 80822f65662850d..8130f90a276749e 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -219,6 +219,8 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple,
return std::make_unique<OpenBSDTargetInfo<ARMleTargetInfo>>(Triple, Opts);
case llvm::Triple::RTEMS:
return std::make_unique<RTEMSTargetInfo<ARMleTargetInfo>>(Triple, Opts);
+ case llvm::Triple::Haiku:
+ return std::make_unique<HaikuTargetInfo<ARMleTargetInfo>>(Triple, Opts);
case llvm::Triple::NaCl:
return std::make_unique<NaClTargetInfo<ARMleTargetInfo>>(Triple, Opts);
case llvm::Triple::Win32:
diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 06e99e67c875584..1e809283748b66c 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -257,6 +257,7 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
bool IsFreeBSD = Triple.isOSFreeBSD();
bool IsOpenBSD = Triple.isOSOpenBSD();
bool IsNetBSD = Triple.isOSNetBSD();
+ bool IsHaiku = Triple.isOSHaiku();
// FIXME: the isOSBinFormatMachO is a workaround for identifying a Darwin-like
// environment where size_t is `unsigned long` rather than `unsigned int`
@@ -323,7 +324,7 @@ ARMTargetInfo::ARMTargetInfo(const llvm::Triple &Triple,
default:
if (IsNetBSD)
setABI("apcs-gnu");
- else if (IsFreeBSD || IsOpenBSD)
+ else if (IsFreeBSD || IsOpenBSD || IsHaiku)
setABI("aapcs-linux");
else
setABI("aapcs");
diff --git a/clang/lib/Driver/ToolChains/Arch/ARM.cpp b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
index bb66db5feae8c3b..8e1cff0b443eeeb 100644
--- a/clang/lib/Driver/ToolChains/Arch/ARM.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/ARM.cpp
@@ -404,6 +404,7 @@ arm::FloatABI arm::getDefaultFloatABI(const llvm::Triple &Triple) {
}
break;
+ case llvm::Triple::Haiku:
case llvm::Triple::OpenBSD:
return FloatABI::SoftFP;
diff --git a/clang/test/Driver/arm-abi.c b/clang/test/Driver/arm-abi.c
index 7bf5977992f65a2..139456cf98e1478 100644
--- a/clang/test/Driver/arm-abi.c
+++ b/clang/test/Driver/arm-abi.c
@@ -33,6 +33,8 @@
// RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
// RUN: %clang -target arm--openbsd- %s -### -o %t.o 2>&1 \
// RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
+// RUN: %clang -target arm--haiku- %s -### -o %t.o 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-AAPCS-LINUX %s
// Otherwise, ABI is selected based on environment
// RUN: %clang -target arm---android %s -### -o %t.o 2>&1 \
diff --git a/clang/test/Driver/haiku.c b/clang/test/Driver/haiku.c
index 021ab522be06e5c..3888c6732923228 100644
--- a/clang/test/Driver/haiku.c
+++ b/clang/test/Driver/haiku.c
@@ -65,3 +65,8 @@
// CHECK-X86_64-SHARED-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
// CHECK-X86_64-SHARED: "{{.*}}ld{{(.exe)?}}"
// CHECK-X86_64-SHARED-NOT: "[[SYSROOT]]/boot/system/develop/lib/start_dyn.o"
+
+// Check default ARM CPU, ARMv6
+// RUN: %clang -### %s 2>&1 --target=arm-unknown-haiku \
+// RUN: | FileCheck --check-prefix=CHECK-ARM-CPU %s
+// CHECK-ARM-CPU: "-target-cpu" "arm1176jzf-s"
diff --git a/llvm/lib/TargetParser/ARMTargetParser.cpp b/llvm/lib/TargetParser/ARMTargetParser.cpp
index c84928eeb07b140..20225232b3cccb7 100644
--- a/llvm/lib/TargetParser/ARMTargetParser.cpp
+++ b/llvm/lib/TargetParser/ARMTargetParser.cpp
@@ -526,7 +526,8 @@ StringRef ARM::computeDefaultTargetABI(const Triple &TT, StringRef CPU) {
default:
if (TT.isOSNetBSD())
return "apcs-gnu";
- if (TT.isOSFreeBSD() || TT.isOSOpenBSD() || TT.isOHOSFamily())
+ if (TT.isOSFreeBSD() || TT.isOSOpenBSD() || TT.isOSHaiku() ||
+ TT.isOHOSFamily())
return "aapcs-linux";
return "aapcs";
}
@@ -542,6 +543,7 @@ StringRef ARM::getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch) {
case llvm::Triple::FreeBSD:
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
+ case llvm::Triple::Haiku:
if (!MArch.empty() && MArch == "v6")
return "arm1176jzf-s";
if (!MArch.empty() && MArch == "v7")
@@ -574,6 +576,8 @@ StringRef ARM::getARMCPUForArch(const llvm::Triple &Triple, StringRef MArch) {
// If no specific architecture version is requested, return the minimum CPU
// required by the OS and environment.
switch (Triple.getOS()) {
+ case llvm::Triple::Haiku:
+ return "arm1176jzf-s";
case llvm::Triple::NetBSD:
switch (Triple.getEnvironment()) {
case llvm::Triple::EABI:
More information about the llvm-commits
mailing list