[PATCH] [PPC64]: Add support for Swift calling convention
Adrian Prantl via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 12 14:01:42 PDT 2017
Is it possible to add a testcase for this?
-- adrian
> On Mar 22, 2017, at 5:00 AM, Andrew Jeffery via cfe-commits <cfe-commits at lists.llvm.org> wrote:
>
> Signed-off-by: Andrew Jeffery <andrew at aj.id.au>
> ---
> lib/Basic/Targets.cpp | 11 +++++++++++
> lib/CodeGen/TargetInfo.cpp | 14 ++++++++++++--
> 2 files changed, 23 insertions(+), 2 deletions(-)
>
> diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp
> index fdedd91a3e15..6d7f37f2479a 100644
> --- a/lib/Basic/Targets.cpp
> +++ b/lib/Basic/Targets.cpp
> @@ -1708,6 +1708,17 @@ public:
> }
> return false;
> }
> +
> + CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
> + switch (CC) {
> + case CC_C:
> + case CC_Swift:
> + return CCCR_OK;
> + default:
> + break;
> + }
> + return CCCR_Warning;
> + }
> };
>
> class DarwinPPC32TargetInfo : public DarwinTargetInfo<PPC32TargetInfo> {
> diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp
> index d2fc3888ef29..6193f6c4ac29 100644
> --- a/lib/CodeGen/TargetInfo.cpp
> +++ b/lib/CodeGen/TargetInfo.cpp
> @@ -4175,7 +4175,7 @@ PPC32TargetCodeGenInfo::initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
>
> namespace {
> /// PPC64_SVR4_ABIInfo - The 64-bit PowerPC ELF (SVR4) ABI information.
> -class PPC64_SVR4_ABIInfo : public ABIInfo {
> +class PPC64_SVR4_ABIInfo : public SwiftABIInfo {
> public:
> enum ABIKind {
> ELFv1 = 0,
> @@ -4219,7 +4219,7 @@ private:
> public:
> PPC64_SVR4_ABIInfo(CodeGen::CodeGenTypes &CGT, ABIKind Kind, bool HasQPX,
> bool SoftFloatABI)
> - : ABIInfo(CGT), Kind(Kind), HasQPX(HasQPX),
> + : SwiftABIInfo(CGT), Kind(Kind), HasQPX(HasQPX),
> IsSoftFloatABI(SoftFloatABI) {}
>
> bool isPromotableTypeForABI(QualType Ty) const;
> @@ -4262,6 +4262,16 @@ public:
>
> Address EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
> QualType Ty) const override;
> +
> + bool shouldPassIndirectlyForSwift(CharUnits totalSize,
> + ArrayRef<llvm::Type*> scalars,
> + bool asReturnValue) const override {
> + return occupiesMoreThan(CGT, scalars, /*total*/ 4);
> + }
> +
> + bool isSwiftErrorInRegister() const override {
> + return true;
> + }
> };
>
> class PPC64_SVR4_TargetCodeGenInfo : public TargetCodeGenInfo {
> --
> 2.9.3
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list