[clang] [clang] Add Swift support for MIPS (PR #205461)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 17:53:37 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Alsey Coleman Miller (colemancda)
<details>
<summary>Changes</summary>
Adds support for compiling Swift targeting the MIPS ABI.
Related to https://github.com/swiftlang/swift/issues/58204
---
Full diff: https://github.com/llvm/llvm-project/pull/205461.diff
2 Files Affected:
- (modified) clang/lib/Basic/Targets/Mips.h (+11)
- (modified) clang/lib/CodeGen/Targets/Mips.cpp (+4-1)
``````````diff
diff --git a/clang/lib/Basic/Targets/Mips.h b/clang/lib/Basic/Targets/Mips.h
index 2f251c7eb8690..ebdd7d083709b 100644
--- a/clang/lib/Basic/Targets/Mips.h
+++ b/clang/lib/Basic/Targets/Mips.h
@@ -433,6 +433,17 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
std::pair<unsigned, unsigned> hardwareInterferenceSizes() const override {
return std::make_pair(32, 32);
}
+
+ CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+ switch (CC) {
+ case CC_Swift:
+ return CCCR_OK;
+ case CC_SwiftAsync:
+ return CCCR_Error;
+ default:
+ return CCCR_Warning;
+ }
+ }
};
class LLVM_LIBRARY_VISIBILITY WindowsMipsTargetInfo
diff --git a/clang/lib/CodeGen/Targets/Mips.cpp b/clang/lib/CodeGen/Targets/Mips.cpp
index 22fdcd95ea8fa..3693e5dbfa91c 100644
--- a/clang/lib/CodeGen/Targets/Mips.cpp
+++ b/clang/lib/CodeGen/Targets/Mips.cpp
@@ -44,7 +44,10 @@ class MIPSTargetCodeGenInfo : public TargetCodeGenInfo {
public:
MIPSTargetCodeGenInfo(CodeGenTypes &CGT, bool IsO32)
: TargetCodeGenInfo(std::make_unique<MipsABIInfo>(CGT, IsO32)),
- SizeOfUnwindException(IsO32 ? 24 : 32) {}
+ SizeOfUnwindException(IsO32 ? 24 : 32) {
+ SwiftInfo =
+ std::make_unique<SwiftABIInfo>(CGT, /*SwiftErrorInRegister=*/false);
+ }
int getDwarfEHStackPointer(CodeGen::CodeGenModule &CGM) const override {
return 29;
``````````
</details>
https://github.com/llvm/llvm-project/pull/205461
More information about the cfe-commits
mailing list