Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

[SystemZ] Support Swift calling convention #13

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/Basic/Targets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6271,6 +6271,16 @@ class SystemZTargetInfo : public TargetInfo {
.Default(false);
}

CallingConvCheckResult checkCallingConvention(CallingConv CC) const override {
switch (CC) {
case CC_C:
case CC_Swift:
return CCCR_OK;
default:
return CCCR_Warning;
}
}

StringRef getABI() const override {
if (HasVector)
return "vector";
Expand Down
10 changes: 8 additions & 2 deletions lib/CodeGen/TargetInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5638,12 +5638,12 @@ void NVPTXTargetCodeGenInfo::addNVVMMetadata(llvm::Function *F, StringRef Name,

namespace {

class SystemZABIInfo : public ABIInfo {
class SystemZABIInfo : public SwiftABIInfo {
bool HasVector;

public:
SystemZABIInfo(CodeGenTypes &CGT, bool HV)
: ABIInfo(CGT), HasVector(HV) {}
: SwiftABIInfo(CGT), HasVector(HV) {}

bool isPromotableIntegerType(QualType Ty) const;
bool isCompoundType(QualType Ty) const;
Expand All @@ -5663,6 +5663,12 @@ class SystemZABIInfo : public ABIInfo {

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);
}
};

class SystemZTargetCodeGenInfo : public TargetCodeGenInfo {
Expand Down