[llvm-commits] [patch] Update llvm-gcc to produce "" for the default calling convention on ARM

Rafael Espindola espindola at google.com
Thu Jun 17 19:15:16 PDT 2010


> See ARMISelLowering.cpp:247. I have a more precise patch for this area
> I haven't submitted yet, but the essence is the same.
>
> Also, ARM (CodeSourcery) introduced the syntax
> __attribute__((pcs("aapcs"))) into GCC to allow mixed declarations of
> different CCs. I haven't yet patched llvm-gcc or Clang with this
> syntax, but I wanted to be prepared to do so when we saw a use for it.
> (I have no idea why ARM wanted this syntax since they just slipped it
> in with other changes.)

I see. The problem are the bits of LLVM before the ARM backend. They
don't know that "" is the same as some other calling convention. Yet,
we want to be able to have passes that create call to new functions.
Without making the basic LLVM passes aware of CC equivalences, I think
what we can do is

*) Declare that any pass introducing a new call to an external
function must assume the "' calling convention. A consequence of this
is that for AAPCS_VFP most functions would have the arm_aapcs_vfpcc
calling convention, but libcalls would have "".
*) Declare that any pass introducing a new call should do so with the
same calling convention as the call being replaced.
*) Add the CC to use to some target data

The problem with the first and third options are that it assumes that
all functions we could possible with to add calls to have the same CC.
The second option is more flexible in that we would be able to add
calls to functions with different CCs, but it assumes that we will
always be replacing an existing call.

Which option do you guys think is best? I still think we can implement
all that we need with the first one. Lets see

on a target with AAPCS_VFP calling convention
*) Library functions take "" as the calling convention
*) All normal functions take arm_aapcs_vfpcc
*) If given an attribute CC that is not aapcs, set the calling
convention accordingly. If it is aapcs, use ""

AAPCS and APCS stay as they are.

Do you think this would work? Am I missing something?

> deep
>

Cheers,
-- 
Rafael Ávila de Espíndola




More information about the llvm-commits mailing list