diff options
author | John McCall <rjmccall@apple.com> | 2016-04-04 18:33:08 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2016-04-04 18:33:08 +0000 |
commit | 12f235215275daa6a1000cfdd5176bd999db36be (patch) | |
tree | 6f718aa8c27e43f843433b260332ae70ef739b60 /clang/lib/CodeGen/ABIInfo.h | |
parent | b8fa6541645e63e9983e0fff34cf4318d18bc420 (diff) | |
download | bcm5719-llvm-12f235215275daa6a1000cfdd5176bd999db36be.tar.gz bcm5719-llvm-12f235215275daa6a1000cfdd5176bd999db36be.zip |
IRGen-level lowering for the Swift calling convention.
llvm-svn: 265324
Diffstat (limited to 'clang/lib/CodeGen/ABIInfo.h')
-rw-r--r-- | clang/lib/CodeGen/ABIInfo.h | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/ABIInfo.h b/clang/lib/CodeGen/ABIInfo.h index 24410715df6..530a7ef560c 100644 --- a/clang/lib/CodeGen/ABIInfo.h +++ b/clang/lib/CodeGen/ABIInfo.h @@ -18,20 +18,25 @@ namespace llvm { class Value; class LLVMContext; class DataLayout; + class Type; } namespace clang { class ASTContext; class TargetInfo; - namespace CodeGen { - class ABIArgInfo; - class Address; - class CGCXXABI; - class CGFunctionInfo; - class CodeGenFunction; - class CodeGenTypes; - } +namespace CodeGen { + class ABIArgInfo; + class Address; + class CGCXXABI; + class CGFunctionInfo; + class CodeGenFunction; + class CodeGenTypes; + class SwiftABIInfo; + +namespace swiftcall { + class SwiftAggLowering; +} // FIXME: All of this stuff should be part of the target interface // somehow. It is currently here because it is not clear how to factor @@ -55,6 +60,8 @@ namespace clang { virtual ~ABIInfo(); + virtual bool supportsSwift() const { return false; } + CodeGen::CGCXXABI &getCXXABI() const; ASTContext &getContext() const; llvm::LLVMContext &getVMContext() const; @@ -112,7 +119,35 @@ namespace clang { CodeGen::ABIArgInfo getNaturalAlignIndirectInReg(QualType Ty, bool Realign = false) const; + + }; + + /// A refining implementation of ABIInfo for targets that support swiftcall. + /// + /// If we find ourselves wanting multiple such refinements, they'll probably + /// be independent refinements, and we should probably find another way + /// to do it than simple inheritance. + class SwiftABIInfo : public ABIInfo { + public: + SwiftABIInfo(CodeGen::CodeGenTypes &cgt) : ABIInfo(cgt) {} + + bool supportsSwift() const final override { return true; } + + virtual bool shouldPassIndirectlyForSwift(CharUnits totalSize, + ArrayRef<llvm::Type*> types, + bool asReturnValue) const = 0; + + virtual bool isLegalVectorTypeForSwift(CharUnits totalSize, + llvm::Type *eltTy, + unsigned elts) const; + + static bool classof(const ABIInfo *info) { + return info->supportsSwift(); + } + }; + +} // end namespace CodeGen } // end namespace clang #endif |