Modify the targets to set appropriate calling convention defaults and C variables when using a gnueabihf or aapcs-vfp target.

Tested by me and Wei-Ren Chen.

llvm-svn: 166679
This commit is contained in:
David Tweed 2012-10-25 13:33:01 +00:00
parent 5fc11b3554
commit 8f67653d26
2 changed files with 8 additions and 6 deletions

View File

@ -3077,7 +3077,7 @@ public:
}
// FIXME: Override "preferred align" for double and long long.
} else if (Name == "aapcs") {
} else if (Name == "aapcs" || Name == "aapcs-vfp") {
IsAAPCS = true;
// FIXME: Enumerated types are variable width in straight AAPCS.
} else if (Name == "aapcs-linux") {
@ -3212,13 +3212,13 @@ public:
if ('5' <= CPUArch[0] && CPUArch[0] <= '7')
Builder.defineMacro("__THUMB_INTERWORK__");
if (ABI == "aapcs" || ABI == "aapcs-linux") {
if (ABI == "aapcs" || ABI == "aapcs-linux" || ABI == "aapcs-vfp") {
// M-class CPUs on Darwin follow AAPCS, but not EABI.
if (!(getTriple().isOSDarwin() && CPUProfile == "M"))
Builder.defineMacro("__ARM_EABI__");
Builder.defineMacro("__ARM_PCS", "1");
if (!SoftFloat && !SoftFloatABI)
if ((!SoftFloat && !SoftFloatABI) || ABI == "aapcs-vfp")
Builder.defineMacro("__ARM_PCS_VFP", "1");
}

View File

@ -2933,7 +2933,9 @@ void ARMABIInfo::computeInfo(CGFunctionInfo &FI) const {
// Calling convention as default by an ABI.
llvm::CallingConv::ID DefaultCC;
if (isEABI())
if (getContext().getTargetInfo().getTriple().getEnvironmentName()=="gnueabihf")
DefaultCC = llvm::CallingConv::ARM_AAPCS_VFP;
else if (isEABI())
DefaultCC = llvm::CallingConv::ARM_AAPCS;
else
DefaultCC = llvm::CallingConv::ARM_APCS;
@ -4187,10 +4189,10 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
case llvm::Triple::thumb:
{
ARMABIInfo::ABIKind Kind = ARMABIInfo::AAPCS;
if (strcmp(getContext().getTargetInfo().getABI(), "apcs-gnu") == 0)
Kind = ARMABIInfo::APCS;
else if (CodeGenOpts.FloatABI == "hard")
else if (CodeGenOpts.FloatABI == "hard" ||
(CodeGenOpts.FloatABI != "soft" && Triple.getEnvironment()==llvm::Triple::GNUEABIHF))
Kind = ARMABIInfo::AAPCS_VFP;
switch (Triple.getOS()) {