================ @@ -208,10 +208,17 @@ bool arm::useAAPCSForMachO(const llvm::Triple &T) { bool arm::isHardTPSupported(const llvm::Triple &Triple) { int Ver = getARMSubArchVersionNumber(Triple); llvm::ARM::ArchKind AK = llvm::ARM::parseArch(Triple.getArchName()); - return Triple.isARM() || AK == llvm::ARM::ArchKind::ARMV6T2 || - (Ver >= 7 && AK != llvm::ARM::ArchKind::ARMV8MBaseline); + return Triple.isARM() || (Ver >= 7 && AK != llvm::ARM::ArchKind::ARMV8MBaseline); } + +// We follow GCC mtp=auto when arch is arm_arch6k and support thumb2 +bool arm::isHardTPAndThumb2(const llvm::Triple &Triple) { + llvm::ARM::ArchKind AK = llvm::ARM::parseArch(Triple.getArchName()); + return Triple.isARM() && AK >= llvm::ARM::ArchKind::ARMV6K && AK != llvm::ARM::ArchKind::ARMV8MBaseline; ---------------- Zhenhang1213 wrote:
Thx for advice, I wanted to implement the same check as gcc, which is in the gcc source code. ``` if (target_thread_pointer == TP_AUTO) { if (arm_arch6k && !TARGET_THUMB1) target_thread_pointer = TP_TPIDRURO; else target_thread_pointer = TP_SOFT; } ``` then the reason I rewrote this interface is that Triple.isARM() includes architectures lower than ARMV6K, and AK == llvm::ARM::ArchKind::ARMV6T2 is covered by Triple.isARM() ``` return Triple.isARM() || AK == llvm::ARM::ArchKind::ARMV6T2 || (Ver >= 7 && AK != llvm::ARM::ArchKind::ARMV8MBaseline); ``` https://github.com/llvm/llvm-project/pull/130027 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits