diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-09-06 00:28:43 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-09-06 00:28:43 +0000 |
commit | a6519b1d543654b9b6a694ed3288e393612d3589 (patch) | |
tree | 8c7dfb11c96c9ec3b55b971078b44eca98c25c7d /llvm/lib/CodeGen | |
parent | dfc4fc9f02f5853a8ecd176b18cce21a30a04dc1 (diff) | |
download | bcm5719-llvm-a6519b1d543654b9b6a694ed3288e393612d3589.tar.gz bcm5719-llvm-a6519b1d543654b9b6a694ed3288e393612d3589.zip |
CodeGen: ensure that libcalls are always AAPCS CC
All of the builtins are designed to be invoked with ARM AAPCS CC even on ARM
AAPCS VFP CC hosts. Tweak the default initialisation to ARM AAPCS CC rather
than C CC for ARM/thumb targets.
The changes to the tests are necessary to ensure that the calling convention for
the lowered library calls are honoured. Furthermore, these adjustments cause
certain branch invocations to change to branch-and-link since the returned value
needs to be moved across registers (d0 -> r0, r1).
llvm-svn: 280683
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringBase.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringBase.cpp b/llvm/lib/CodeGen/TargetLoweringBase.cpp index 85c277a5025..f7322622c03 100644 --- a/llvm/lib/CodeGen/TargetLoweringBase.cpp +++ b/llvm/lib/CodeGen/TargetLoweringBase.cpp @@ -488,12 +488,11 @@ static void InitLibcallNames(const char **Names, const Triple &TT) { Names[RTLIB::DEOPTIMIZE] = "__llvm_deoptimize"; } -/// InitLibcallCallingConvs - Set default libcall CallingConvs. -/// -static void InitLibcallCallingConvs(CallingConv::ID *CCs) { - for (int i = 0; i < RTLIB::UNKNOWN_LIBCALL; ++i) { - CCs[i] = CallingConv::C; - } +/// Set default libcall CallingConvs. +static void InitLibcallCallingConvs(CallingConv::ID *CCs, const Triple &T) { + bool IsARM = T.getArch() == Triple::arm || T.getArch() == Triple::thumb; + for (int LC = 0; LC < RTLIB::UNKNOWN_LIBCALL; ++LC) + CCs[LC] = IsARM ? CallingConv::ARM_AAPCS : CallingConv::C; } /// getFPEXT - Return the FPEXT_*_* value for the given types, or @@ -835,7 +834,7 @@ TargetLoweringBase::TargetLoweringBase(const TargetMachine &tm) : TM(tm) { InitLibcallNames(LibcallRoutineNames, TM.getTargetTriple()); InitCmpLibcallCCs(CmpLibcallCCs); - InitLibcallCallingConvs(LibcallCallingConvs); + InitLibcallCallingConvs(LibcallCallingConvs, TM.getTargetTriple()); } void TargetLoweringBase::initActions() { |