[LLVMdev] Request for merge: GHC/ARM calling convention.

Jakob Stoklund Olesen stoklund at 2pi.dk
Fri Oct 14 14:08:07 PDT 2011


On Oct 14, 2011, at 8:22 AM, Duncan Sands wrote:

> Hi Karel,
> 
>>>>> const unsigned*
>>>>> ARMBaseRegisterInfo::getCalleeSavedRegs(const MachineFunction *MF)
>>>> const {
>>>>> + bool ghcCall = false;
>>>>> +
>>>>> + if (MF) {
>>>>> + const Function *F = MF->getFunction();
>>>>> + ghcCall = (F ? F->getCallingConv() == CallingConv::GHC : false);
>>>>> + }

> yeah, but here MF is (presumably) the callee.  The callee shouldn't be relevant
> to how arguments are marshalled at the call-site.  Especially as there might not
> even be a callee function (case of an indirect call).  Since calls themselves
> are annotated with the calling convention to use, I guess the calling convention
> should be grabbed from the call instruction itself somehow.

TargetRegisterInfo::getCalleeSavedRegs() is called with a pointer to the machine function currently being compiled.

It is used by PEI to determine the registers to spill in the prolog, and it is used by RegisterClassInfo to rearrange allocation orders so the register allocator will use volatile registers before callee-saved registers.

Its behavior depends on the calling convention of the function being compiled. It is not related to call instructions in the function.

/jakob




More information about the llvm-dev mailing list