Karel Gardas
2011-Oct-14 13:52 UTC
[LLVMdev] Request for merge: GHC/ARM calling convention.
Hi Duncan, > 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? Thanks! Karel
Duncan Sands
2011-Oct-14 13:56 UTC
[LLVMdev] Request for merge: GHC/ARM calling convention.
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? If this information is useful to have, why isn't it in the machine function? Ciao, Duncan.
Karel Gardas
2011-Oct-14 14:55 UTC
[LLVMdev] Request for merge: GHC/ARM calling convention.
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
Possibly Parallel Threads
- [LLVMdev] Request for merge: GHC/ARM calling convention.
- [LLVMdev] Request for merge: GHC/ARM calling convention.
- [LLVMdev] Request for merge: GHC/ARM calling convention.
- [LLVMdev] Request for merge: GHC/ARM calling convention.
- [LLVMdev] Request for merge: GHC/ARM calling convention.