[llvm-dev] Suggestion / Help regarding new calling convention

vivek pandya via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 20 07:39:32 PDT 2016

Dear Community,

To improve current interprocedural register allocation (IPRA) , we have
planned to set callee saved registers to none for local functions,
currently I am doing it in following way:

if (F->hasLocalLinkage()  && !F->hasAddressTaken()) {
   DEBUG(dbgs() << "Function has LocalLinkage \n");

but we think threre should be clean and properway to do this perhaps like:

if (F->hasLocalLinkage() && !F->hasAddressTaken()) {
    DEBUG(dbgs() << "Function has LocalLinkage \n");

So I would like to know any better suggestions and if it is better to add a
new CC for this purpose then what aspects should be considered while
defining a new CC. Actually in this case the new CC does not really
required to define how parameters should be passed or any special rule for
return value etc , it just required to set callee saved registers to be
none. So what are the minimal things required to define such a CC?

Other alternative that I have thought was to add new attribute for function
and use it like following in TargetFrameLowering::determineCalleeSaves()

 // In Naked functions we aren't going to save any registers.
  if (MF.getFunction()->hasFnAttribute(Attribute::Naked))

Any suggestions / thoughts are welcomed !

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160620/523dc115/attachment.html>

More information about the llvm-dev mailing list