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

陳韋任 (Wei-Ren Chen) chenwj at iis.sinica.edu.tw
Wed Oct 3 20:34:11 PDT 2012


On Wed, Oct 03, 2012 at 09:42:50AM +0100, David Tweed wrote:
> Hi, I'm lost in the twisty maze of Tools.cpp and Toolchain.cpp in the course
> of tracking down some regression test issues on ARM. I can see in
> AsmWriter.cpp that an explicit call convention marker, such as ARM_AAPCS
> will be emitted in every case except when the calling convention is C.
> However, my impression is sometimes the C calling convention _is_ a specific
> convention, such as ARM_AAPCS and in that case basic generated function
> calls from clang are marked with a C calling convention. However, I'm
> haven't been able to find the piece of code that implements this
> "knowledge". Could anyone help point it out to me, or is this understanding
> wrong? It looks like FileCheck expects CC markers to appear only when
> explicitly requested and not that the triple-implied ABI CC marker gets
> attached to every generated function: that's what a general user should
> expect of clang as well?

  What output you want? AFAIK, most test cases only expect to see something like,

    define void @foo

  rather then

    define arm_aapcs_vfpcc void @foo

>From AssemblyWriter::printFunction,

  if (F->getCallingConv() != CallingConv::C) {
    PrintCallingConv(F->getCallingConv(), Out);
    Out << " ";
  }

if the function's calling convention is NOT C, then the result is NOT what FileCheck
expect. So do you expect no matter the triple is arm-linux-gnueabihf or arm-linux-gnueabi,
the result should be "define void @foo"? In other word, function's calling convention
should be C? If so, then we need to figure out how to set F->getCallingConv() to
CallingConv::C. Otherwise, those pattern in test cases need some tweaks.

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