[PATCH] [PPC64]: Add support for Swift calling convention
Andrew Jeffery via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 12 21:19:42 PDT 2017
On Wed, 2017-04-12 at 14:01 -0700, Adrian Prantl wrote:
> Is it possible to add a testcase for this?
I will look into it.
Thanks for the review!
Andrew
>
> -- 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
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170413/b643ef6d/attachment.sig>
More information about the cfe-commits
mailing list