Stub out room for ARM APCS ABI implementation (and AAPCS_VFP, although you can't

hit this via command line options yet).

llvm-svn: 81595
This commit is contained in:
Daniel Dunbar 2009-09-12 01:00:39 +00:00
parent d59655c992
commit 020daa9476
2 changed files with 45 additions and 2 deletions

View File

@ -1327,6 +1327,22 @@ llvm::Value *PIC16ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
namespace { namespace {
class ARMABIInfo : public ABIInfo { class ARMABIInfo : public ABIInfo {
public:
enum ABIKind {
APCS = 0,
AAPCS = 1,
AAPCS_VFP
};
private:
ABIKind Kind;
public:
ARMABIInfo(ABIKind _Kind) : Kind(_Kind) {}
private:
ABIKind getABIKind() const { return Kind; }
ABIArgInfo classifyReturnType(QualType RetTy, ABIArgInfo classifyReturnType(QualType RetTy,
ASTContext &Context, ASTContext &Context,
llvm::LLVMContext &VMCOntext) const; llvm::LLVMContext &VMCOntext) const;
@ -1352,6 +1368,21 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI, ASTContext &Context,
it != ie; ++it) { it != ie; ++it) {
it->info = classifyArgumentType(it->type, Context, VMContext); it->info = classifyArgumentType(it->type, Context, VMContext);
} }
// ARM always overrides the calling convention.
switch (getABIKind()) {
case APCS:
FI.setEffectiveCallingConvention(llvm::CallingConv::ARM_APCS);
break;
case AAPCS:
FI.setEffectiveCallingConvention(llvm::CallingConv::ARM_AAPCS);
break;
case AAPCS_VFP:
FI.setEffectiveCallingConvention(llvm::CallingConv::ARM_AAPCS_VFP);
break;
}
} }
ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty,
@ -1544,8 +1575,14 @@ const ABIInfo &CodeGenTypes::getABIInfo() const {
case llvm::Triple::arm: case llvm::Triple::arm:
case llvm::Triple::thumb: case llvm::Triple::thumb:
// FIXME: Support for OABI? // FIXME: We should get this from the target, we also need a -target-abi
return *(TheABIInfo = new ARMABIInfo()); // because the user should have some control over this.
//
// FIXME: We want to know the float calling convention as well.
if (Triple.getOS() == llvm::Triple::Darwin)
return *(TheABIInfo = new ARMABIInfo(ARMABIInfo::APCS));
return *(TheABIInfo = new ARMABIInfo(ARMABIInfo::AAPCS));
case llvm::Triple::pic16: case llvm::Triple::pic16:
return *(TheABIInfo = new PIC16ABIInfo()); return *(TheABIInfo = new PIC16ABIInfo());

View File

@ -0,0 +1,6 @@
// RUN: clang-cc -triple armv7-apple-darwin9 -emit-llvm -o - %s | FileCheck %s
// CHECK: define arm_apcscc signext i8 @f0()
char f0(void) {
return 0;
}