[cfe-dev] Bugfixer's question about how C calling convention corresponds to platform CC

陳韋任 (Wei-Ren Chen) chenwj at iis.sinica.edu.tw
Mon Oct 8 20:19:20 PDT 2012


> My understanding is that somewhere in the code there should be an equating of the C calling convention with a platform specific convention, and from then on function definitions will automatically be output with the "no marker" form "define @foo". I _think_ what's happening it that this equating isn't occurring, so that when functions are created with the natural platform calling convention LLVM doesn't realise this convention is the same as the C convention, i.e., I don't think it's something that should need doing for each function but is a missing initialisation step.
> 
> However, we still need to figure out where this happens. Any insight from anyone appreciated.

  Do you really think CC_AAPCS or CC_AAPCS_VFP sould be equal to C
calling convention? If so, how about making ClangCallConvToLLVMCallConv
return llvm::CallingConv::C for CC_AAPCS and CC_AAPCS_VFP like this?

--- lib/CodeGen/CGCall.cpp      (revision 165477)
+++ lib/CodeGen/CGCall.cpp      (working copy)
@@ -39,8 +39,9 @@
   case CC_X86StdCall: return llvm::CallingConv::X86_StdCall;
   case CC_X86FastCall: return llvm::CallingConv::X86_FastCall;
   case CC_X86ThisCall: return llvm::CallingConv::X86_ThisCall;
-  case CC_AAPCS: return llvm::CallingConv::ARM_AAPCS;
-  case CC_AAPCS_VFP: return llvm::CallingConv::ARM_AAPCS_VFP;
+  // CC_AAPCS and CC_AAPCS_VFP should be equal to CallingConv::C
+  case CC_AAPCS: return llvm::CallingConv::C;
+  case CC_AAPCS_VFP: return llvm::CallingConv::C;
   // TODO: add support for CC_X86Pascal to llvm
   }
 }

Regards,
chenwj

-- 
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj




More information about the cfe-dev mailing list