From 34c1af83e159cfe0f43e7a855e84783f301fc1f1 Mon Sep 17 00:00:00 2001 From: Sandeep Patel Date: Tue, 5 Apr 2011 00:23:47 +0000 Subject: [PATCH] Set AAPCS-VFP calling convention accordingly and hard float ABI command handling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128866 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/BackendUtil.cpp | 2 +- lib/CodeGen/TargetInfo.cpp | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp index 6358b9fc15..1d2936072e 100644 --- a/lib/CodeGen/BackendUtil.cpp +++ b/lib/CodeGen/BackendUtil.cpp @@ -190,7 +190,7 @@ bool EmitAssemblyHelper::AddEmitPasses(BackendAction Action, } // Set float ABI type. - if (CodeGenOpts.FloatABI == "soft") + if (CodeGenOpts.FloatABI == "soft" || CodeGenOpts.FloatABI == "softfp") llvm::FloatABIType = llvm::FloatABI::Soft; else if (CodeGenOpts.FloatABI == "hard") llvm::FloatABIType = llvm::FloatABI::Hard; diff --git a/lib/CodeGen/TargetInfo.cpp b/lib/CodeGen/TargetInfo.cpp index d8b0de67a6..5db9a8e640 100644 --- a/lib/CodeGen/TargetInfo.cpp +++ b/lib/CodeGen/TargetInfo.cpp @@ -16,6 +16,7 @@ #include "ABIInfo.h" #include "CodeGenFunction.h" #include "clang/AST/RecordLayout.h" +#include "clang/Frontend/CodeGenOptions.h" #include "llvm/Type.h" #include "llvm/Target/TargetData.h" #include "llvm/ADT/Triple.h" @@ -2814,13 +2815,16 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() { case llvm::Triple::arm: case llvm::Triple::thumb: - // FIXME: We want to know the float calling convention as well. - if (strcmp(getContext().Target.getABI(), "apcs-gnu") == 0) - return *(TheTargetCodeGenInfo = - new ARMTargetCodeGenInfo(Types, ARMABIInfo::APCS)); + { + ARMABIInfo::ABIKind Kind = ARMABIInfo::AAPCS; + + if (strcmp(getContext().Target.getABI(), "apcs-gnu") == 0) + Kind = ARMABIInfo::APCS; + else if (CodeGenOpts.FloatABI == "hard") + Kind = ARMABIInfo::AAPCS_VFP; - return *(TheTargetCodeGenInfo = - new ARMTargetCodeGenInfo(Types, ARMABIInfo::AAPCS)); + return *(TheTargetCodeGenInfo = new ARMTargetCodeGenInfo(Types, Kind)); + } case llvm::Triple::ppc: return *(TheTargetCodeGenInfo = new PPC32TargetCodeGenInfo(Types)); -- 2.40.0