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

Karel Gardas karel.gardas at centrum.cz
Fri Oct 14 07:55:53 PDT 2011


Hi Duncan,

On 10/14/11 03:56 PM, 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);
>> > + }
>>
>> > This bit looks dubious. Why do you need to do it?
>>
>> What exactly? We need to test if this is GHC calling convention or not
>> and if
>> its, then return different set of callee saved regs. What exactly
>> don't you like
>> on this piece?
>
> I don't see anyone else rummaging around inside the original function
> for the
> calling convention, so why do you need to?

Based on knowledge of calling convention we return different set of 
callee saved registers. For example on ARM and when GHC CC is used, we 
return empty set.

> If this information is useful to
> have, why isn't it in the machine function?

Honestly speaking, I don't know. The code in question is not written by 
me, but IMHO the motivation was just to get job done and allow later 
someone with better knowledge of LLVM internals to do required 
refactoring -- if you are pointing on the fact why we have not 
refactored calling convention call from Function to MachineFuction yet.

Thanks,
Karel



More information about the llvm-dev mailing list