summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/TargetABIInfo.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-09-12 01:00:39 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-09-12 01:00:39 +0000
commit020daa9476b5a2c8bce553066b0121d39de151fe (patch)
tree6bc2cd84706e8f34abe073a4b486d708fb085133 /clang/lib/CodeGen/TargetABIInfo.cpp
parentd59655c992a3e90cc84071d293566b8d406f198f (diff)
downloadbcm5719-llvm-020daa9476b5a2c8bce553066b0121d39de151fe.tar.gz
bcm5719-llvm-020daa9476b5a2c8bce553066b0121d39de151fe.zip
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
Diffstat (limited to 'clang/lib/CodeGen/TargetABIInfo.cpp')
-rw-r--r--clang/lib/CodeGen/TargetABIInfo.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/TargetABIInfo.cpp b/clang/lib/CodeGen/TargetABIInfo.cpp
index 1ebad5dd5c2..c85504e64cc 100644
--- a/clang/lib/CodeGen/TargetABIInfo.cpp
+++ b/clang/lib/CodeGen/TargetABIInfo.cpp
@@ -1327,6 +1327,22 @@ llvm::Value *PIC16ABIInfo::EmitVAArg(llvm::Value *VAListAddr, QualType Ty,
namespace {
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,
ASTContext &Context,
llvm::LLVMContext &VMCOntext) const;
@@ -1352,6 +1368,21 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI, ASTContext &Context,
it != ie; ++it) {
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,
@@ -1544,8 +1575,14 @@ const ABIInfo &CodeGenTypes::getABIInfo() const {
case llvm::Triple::arm:
case llvm::Triple::thumb:
- // FIXME: Support for OABI?
- return *(TheABIInfo = new ARMABIInfo());
+ // FIXME: We should get this from the target, we also need a -target-abi
+ // 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:
return *(TheABIInfo = new PIC16ABIInfo());
OpenPOWER on IntegriCloud