[llvm] r321045 - TargetLowering: Fix InitLibcallCallingConvs() overriding things set in InitLibcalls()

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 16:20:33 PST 2017


Author: matze
Date: Mon Dec 18 16:20:33 2017
New Revision: 321045

URL: http://llvm.org/viewvc/llvm-project?rev=321045&view=rev
Log:
TargetLowering: Fix InitLibcallCallingConvs() overriding things set in InitLibcalls()

I missed the fact that the later called InitLibcallCallingConvs()
overrides some things set in InitLibcalls() when I did the refactoring
in r321036.

Fix by merging InitLibcallCallingConvs() into InitLibcalls() and doing
the initialization earlier.

Modified:
    llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp

Modified: llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp?rev=321045&r1=321044&r2=321045&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringBase.cpp Mon Dec 18 16:20:33 2017
@@ -117,6 +117,9 @@ void TargetLoweringBase::InitLibcalls(co
   setLibcallName(RTLIB::code, name);
 #include "llvm/CodeGen/RuntimeLibcalls.def"
 #undef HANDLE_LIBCALL
+  // Initialize calling conventions to their default.
+  for (int LC = 0; LC < RTLIB::UNKNOWN_LIBCALL; ++LC)
+    setLibcallCallingConv((RTLIB::Libcall)LC, CallingConv::C);
 
   // A few names are different on particular architectures or environments.
   if (TT.isOSDarwin()) {
@@ -158,12 +161,6 @@ void TargetLoweringBase::InitLibcalls(co
   }
 }
 
-/// Set default libcall CallingConvs.
-static void InitLibcallCallingConvs(CallingConv::ID *CCs) {
-  for (int LC = 0; LC < RTLIB::UNKNOWN_LIBCALL; ++LC)
-    CCs[LC] = CallingConv::C;
-}
-
 /// getFPEXT - Return the FPEXT_*_* value for the given types, or
 /// UNKNOWN_LIBCALL if there is none.
 RTLIB::Libcall RTLIB::getFPEXT(EVT OpVT, EVT RetVT) {
@@ -552,7 +549,6 @@ TargetLoweringBase::TargetLoweringBase(c
 
   InitLibcalls(TM.getTargetTriple());
   InitCmpLibcallCCs(CmpLibcallCCs);
-  InitLibcallCallingConvs(LibcallCallingConvs);
 }
 
 void TargetLoweringBase::initActions() {




More information about the llvm-commits mailing list