[PATCH] D137512: [clang] Add Swift support for MIPS
Alsey Coleman Miller via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 14 22:06:12 PST 2022
colemancda updated this revision to Diff 475337.
colemancda added a comment.
Rebased
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137512/new/
https://reviews.llvm.org/D137512
Files:
clang/lib/Basic/Targets/Mips.h
clang/lib/CodeGen/TargetInfo.cpp
Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -7864,7 +7864,7 @@
//===----------------------------------------------------------------------===//
namespace {
-class MipsABIInfo : public ABIInfo {
+class MipsABIInfo : public SwiftABIInfo {
bool IsO32;
const unsigned MinABIStackAlignInBytes, StackAlignInBytes;
void CoerceToIntArgs(uint64_t TySize,
@@ -7873,9 +7873,10 @@
llvm::Type* returnAggregateInRegs(QualType RetTy, uint64_t Size) const;
llvm::Type* getPaddingType(uint64_t Align, uint64_t Offset) const;
public:
- MipsABIInfo(CodeGenTypes &CGT, bool _IsO32) :
- ABIInfo(CGT), IsO32(_IsO32), MinABIStackAlignInBytes(IsO32 ? 4 : 8),
- StackAlignInBytes(IsO32 ? 8 : 16) {}
+ MipsABIInfo(CodeGenTypes &CGT, bool _IsO32)
+ : SwiftABIInfo(CGT), IsO32(_IsO32),
+ MinABIStackAlignInBytes(IsO32 ? 4 : 8),
+ StackAlignInBytes(IsO32 ? 8 : 16) {}
ABIArgInfo classifyReturnType(QualType RetTy) const;
ABIArgInfo classifyArgumentType(QualType RetTy, uint64_t &Offset) const;
@@ -7883,6 +7884,14 @@
Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
QualType Ty) const override;
ABIArgInfo extendType(QualType Ty) const;
+
+private:
+ bool shouldPassIndirectlyForSwift(ArrayRef<llvm::Type *> scalars,
+ bool asReturnValue) const override {
+ return occupiesMoreThan(CGT, scalars, /*total*/ 4);
+ }
+
+ bool isSwiftErrorInRegister() const override { return false; }
};
class MIPSTargetCodeGenInfo : public TargetCodeGenInfo {
Index: clang/lib/Basic/Targets/Mips.h
===================================================================
--- clang/lib/Basic/Targets/Mips.h
+++ clang/lib/Basic/Targets/Mips.h
@@ -407,6 +407,17 @@
bool validateTarget(DiagnosticsEngine &Diags) const override;
bool hasBitIntType() const override { return true; }
+
+ CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
+ switch (CC) {
+ case CC_Swift:
+ return CCCR_OK;
+ case CC_SwiftAsync:
+ return CCCR_Error;
+ default:
+ return CCCR_Warning;
+ }
+ }
};
} // namespace targets
} // namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137512.475337.patch
Type: text/x-patch
Size: 2312 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221115/f956b565/attachment-0001.bin>
More information about the cfe-commits
mailing list